From: <dgr...@us...> - 2009-08-13 01:48:44
|
Revision: 10964 http://x10.svn.sourceforge.net/x10/?rev=10964&view=rev Author: dgrove-oss Date: 2009-08-13 01:48:36 +0000 (Thu, 13 Aug 2009) Log Message: ----------- Eliminate get() method on x10aux::ref, replacing all uses with .operator-> Modified Paths: -------------- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.runtime.17/src-cpp/x10/io/InputStreamReader__InputStream.cc trunk/x10.runtime.17/src-cpp/x10/io/OutputStreamWriter__OutputStream.cc trunk/x10.runtime.17/src-cpp/x10/lang/Object.cc trunk/x10.runtime.17/src-cpp/x10/lang/Rail.h trunk/x10.runtime.17/src-cpp/x10/lang/Ref.h trunk/x10.runtime.17/src-cpp/x10/lang/String.cc trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.cc trunk/x10.runtime.17/src-cpp/x10/lang/ValRail.h trunk/x10.runtime.17/src-cpp/x10/runtime/Deque.cc trunk/x10.runtime.17/src-cpp/x10/runtime/Thread.cc trunk/x10.runtime.17/src-cpp/x10aux/basic_functions.h trunk/x10.runtime.17/src-cpp/x10aux/network.cc trunk/x10.runtime.17/src-cpp/x10aux/ref.h Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java 2009-08-13 01:42:21 UTC (rev 10963) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/MessagePassingCodeGenerator.java 2009-08-13 01:48:36 UTC (rev 10964) @@ -1277,7 +1277,7 @@ emitter.printType(xts.Object(), sw); sw.write(" p0"); sw.write(") {"); sw.newline(4); sw.begin(0); - sw.write("if (p0.get() == this) return true; // short-circuit trivial equality"); + sw.write("if (p0.operator->() == this) return true; // short-circuit trivial equality"); sw.newline(); sw.write("if (!this->" + emitter.translateType(superClass) + "::" + mangled_method_name(STRUCT_EQUALS_METHOD) + "(p0))"); @@ -2133,12 +2133,12 @@ if (ret_type.isVoid()) { sw.write("(__extension__ ({ x10aux::ref<x10::lang::Object> _ = x10aux::placeCheck(x10aux::nullCheck("); n.printSubExpr((Expr) target, assoc, sw, tr); - sw.write(")); (_.get()->*(x10aux::findITable"+chevrons(emitter.translateType(clsType, false))+"(_->_getITables())->"+itable.mangledName(mi)+"))"); + sw.write(")); (_.operator->()->*(x10aux::findITable"+chevrons(emitter.translateType(clsType, false))+"(_->_getITables())->"+itable.mangledName(mi)+"))"); dangling = "; }))"; } else { sw.write("(__extension__ ({ x10aux::ref<x10::lang::Object> _ = x10aux::placeCheck(x10aux::nullCheck("); n.printSubExpr((Expr) target, assoc, sw, tr); - sw.write(")); x10aux::GXX_ICE_Workaround"+chevrons(emitter.translateType(ret_type, true))+"::_((_.get()->*(x10aux::findITable"+chevrons(emitter.translateType(clsType, false))+"(_->_getITables())->"+itable.mangledName(mi)+"))"); + sw.write(")); x10aux::GXX_ICE_Workaround"+chevrons(emitter.translateType(ret_type, true))+"::_((_.operator->()->*(x10aux::findITable"+chevrons(emitter.translateType(clsType, false))+"(_->_getITables())->"+itable.mangledName(mi)+"))"); dangling = "); }))"; } } @@ -2693,14 +2693,14 @@ sw.write("x10aux::ref<x10::lang::Object> " + name + " = "+iteratorTypeRef); sw.write("(__extension__ ({ x10aux::ref<x10::lang::Object> _1 = x10aux::placeCheck(x10aux::nullCheck("); n.print(domain, sw, tr); - sw.write(")); x10aux::GXX_ICE_Workaround"+chevrons(iteratorTypeRef)+"::_((_1.get()->*(x10aux::findITable"+chevrons(iterableType)+"(_1->_getITables())->iterator))()); }));"); sw.newline(); + sw.write(")); x10aux::GXX_ICE_Workaround"+chevrons(iteratorTypeRef)+"::_((_1.operator->()->*(x10aux::findITable"+chevrons(iterableType)+"(_1->_getITables())->iterator))()); }));"); sw.newline(); sw.write((doubleTemplate ? "typename " : "")+iteratorType+"::"+(doubleTemplate ? "template ":"")+"itable<x10::lang::Object> *"+itableName+" = x10aux::findITable"+chevrons(iteratorType)+"("+name+"->_getITables());"); sw.newline(); sw.write("for ("); sw.begin(0); sw.write(";"); sw.allowBreak(2, " "); - sw.write("("+name+".get()->*("+itableName+"->hasNext))();"); + sw.write("("+name+".operator->()->*("+itableName+"->hasNext))();"); sw.allowBreak(2, " "); sw.end(); @@ -2711,7 +2711,7 @@ sw.write(";"); sw.newline(); sw.write(mangled_non_method_name(form.name().id().toString())); - sw.write(" = ("+name+".get()->*("+itableName+"->next))();"); + sw.write(" = ("+name+".operator->()->*("+itableName+"->next))();"); sw.newline(); for (Iterator li = n.locals().iterator(); li.hasNext(); ) { Stmt l = (Stmt) li.next(); @@ -3216,7 +3216,7 @@ (xts.isSubtype(retType, xts.Ref(), tr.context()) || retType.toClass().flags().isInterface())) { - sw.write(".get()"); + sw.write(".operator->()"); } sw.write(";"); } @@ -3262,7 +3262,7 @@ if (lit != null || (t.isClass() && t.toClass().flags().isInterface())) { sw.write("(__extension__ ({ x10aux::ref<x10::lang::Object> _ = x10aux::placeCheck(x10aux::nullCheck("); c.printSubExpr(target, sw, tr); - sw.write(")); "+(mi.returnType().isVoid() ? "" : "x10aux::GXX_ICE_Workaround"+chevrons(emitter.translateType(mi.returnType(), true))+"::_")+"((_.get()->*(x10aux::findITable"+chevrons(emitter.translateType(target.type(), false))+"(_->_getITables())->apply))(");; + sw.write(")); "+(mi.returnType().isVoid() ? "" : "x10aux::GXX_ICE_Workaround"+chevrons(emitter.translateType(mi.returnType(), true))+"::_")+"((_.operator->()->*(x10aux::findITable"+chevrons(emitter.translateType(target.type(), false))+"(_->_getITables())->apply))(");; terminate = ");}))"; } else { sw.write("x10aux::placeCheck(x10aux::nullCheck("); Modified: trunk/x10.runtime.17/src-cpp/x10/io/InputStreamReader__InputStream.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/InputStreamReader__InputStream.cc 2009-08-13 01:42:21 UTC (rev 10963) +++ trunk/x10.runtime.17/src-cpp/x10/io/InputStreamReader__InputStream.cc 2009-08-13 01:48:36 UTC (rev 10964) @@ -26,7 +26,7 @@ } x10_boolean InputStreamReader__InputStream::_struct_equals(ref<Object> p0) { - if (p0.get() == this) return true; // short-circuit trivial equality + if (p0.operator->() == this) return true; // short-circuit trivial equality if (!this->Value::_struct_equals(p0)) return false; // ref<InputStreamReader__InputStream> that = (ref<InputStreamReader__InputStream>) p0; Modified: trunk/x10.runtime.17/src-cpp/x10/io/OutputStreamWriter__OutputStream.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/io/OutputStreamWriter__OutputStream.cc 2009-08-13 01:42:21 UTC (rev 10963) +++ trunk/x10.runtime.17/src-cpp/x10/io/OutputStreamWriter__OutputStream.cc 2009-08-13 01:48:36 UTC (rev 10964) @@ -36,7 +36,7 @@ } x10_boolean OutputStreamWriter__OutputStream::_struct_equals(ref<Object> p0) { - if (p0.get() == this) return true; // short-circuit trivial equality + if (p0.operator->() == this) return true; // short-circuit trivial equality if (!this->Value::_struct_equals(p0)) return false; // ref<OutputStreamWriter__OutputStream> that = (ref<OutputStreamWriter__OutputStream>) p0; Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Object.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Object.cc 2009-08-13 01:42:21 UTC (rev 10963) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Object.cc 2009-08-13 01:48:36 UTC (rev 10964) @@ -13,10 +13,10 @@ x10aux::serialization_buffer &buf, x10aux::addr_map &m) { - if (x10aux::remote_ref::is_remote(this_.get()) || this_.isNull()) { + if (x10aux::remote_ref::is_remote(this_.operator->()) || this_.isNull()) { // cannot dispatch for these "addresses", handle here buf.write(Ref::_serialization_id,m); - buf.write(x10aux::remote_ref::make(this_.get()),m); + buf.write(x10aux::remote_ref::make(this_.operator->()),m); return; } _S_("Serializing an "<<ANSI_SER<<ANSI_BOLD<<"interface"<<ANSI_RESET<< @@ -28,9 +28,9 @@ x10_boolean Object::equals(x10aux::ref<Object> other) { if (x10aux::instanceof<Value>(other)) - return this->equals(x10aux::ref<Value>(reinterpret_cast<Value*>(other.get()))); + return this->equals(x10aux::ref<Value>(reinterpret_cast<Value*>(other.operator->()))); if (x10aux::instanceof<Ref>(other)) - return this->equals(x10aux::ref<Ref>(reinterpret_cast<Ref*>(other.get()))); + return this->equals(x10aux::ref<Ref>(reinterpret_cast<Ref*>(other.operator->()))); assert (false && "Unknown reference type"); return false; } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Rail.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Rail.h 2009-08-13 01:42:21 UTC (rev 10963) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Rail.h 2009-08-13 01:48:36 UTC (rev 10964) @@ -121,7 +121,7 @@ x10aux::ref<x10::lang::Object> initAsObj = init; typename Fun_0_1<x10_int,T>::template itable<x10::lang::Object> *it = x10aux::findITable<Fun_0_1<x10_int,T> >(initAsObj->_getITables()); for (x10_int i=0 ; i<length ; ++i) { - (*rail)[i] = (initAsObj.get()->*(it->apply))(i); + (*rail)[i] = (initAsObj.operator->()->*(it->apply))(i); } return rail; } Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Ref.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Ref.h 2009-08-13 01:42:21 UTC (rev 10963) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Ref.h 2009-08-13 01:48:36 UTC (rev 10964) @@ -29,7 +29,7 @@ x10aux::addr_map &m) { // don't send an id, just serialise the ref (null/local/remote -- we don't care) - buf.write(x10aux::remote_ref::make(this_.get()),m); + buf.write(x10aux::remote_ref::make(this_.operator->()),m); } virtual x10aux::serialization_id_t _get_serialization_id() { return _serialization_id; }; Modified: trunk/x10.runtime.17/src-cpp/x10/lang/String.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/String.cc 2009-08-13 01:42:21 UTC (rev 10963) +++ trunk/x10.runtime.17/src-cpp/x10/lang/String.cc 2009-08-13 01:48:36 UTC (rev 10964) @@ -232,7 +232,7 @@ } x10_boolean String::_struct_equals(ref<Object> p0) { - if (p0.get() == this) return true; // short-circuit trivial equality + if (p0.operator->() == this) return true; // short-circuit trivial equality if (!this->Value::_struct_equals(p0)) return false; ref<String> that = (ref<String>) p0; Modified: trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.cc 2009-08-13 01:42:21 UTC (rev 10963) +++ trunk/x10.runtime.17/src-cpp/x10/lang/Throwable.cc 2009-08-13 01:48:36 UTC (rev 10964) @@ -422,7 +422,7 @@ } x10_boolean Throwable::_struct_equals(ref<Object> p0) { - if (p0.get() == this) return true; // short-circuit trivial equality + if (p0.operator->() == this) return true; // short-circuit trivial equality if (!this->Value::_struct_equals(p0)) return false; ref<Throwable> that = (ref<Throwable>) p0; Modified: trunk/x10.runtime.17/src-cpp/x10/lang/ValRail.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/lang/ValRail.h 2009-08-13 01:42:21 UTC (rev 10963) +++ trunk/x10.runtime.17/src-cpp/x10/lang/ValRail.h 2009-08-13 01:48:36 UTC (rev 10964) @@ -121,7 +121,7 @@ }; template <class T> x10_boolean ValRail<T>::_struct_equals(x10aux::ref<Object> other) { - if (other.get() == this) return true; // short-circuit trivial equality + if (other.operator->() == this) return true; // short-circuit trivial equality if (!this->Value::_struct_equals(other)) return false; x10aux::ref<ValRail> other_rail = other; // different sizes so false @@ -158,7 +158,7 @@ x10aux::ref<x10::lang::Object> initAsObj = init; typename Fun_0_1<x10_int,T>::template itable<x10::lang::Object> *it = x10aux::findITable<Fun_0_1<x10_int,T> >(initAsObj->_getITables()); for (x10_int i=0 ; i<length ; ++i) { - (*rail)[i] = (initAsObj.get()->*(it->apply))(i); + (*rail)[i] = (initAsObj.operator->()->*(it->apply))(i); } return rail; } Modified: trunk/x10.runtime.17/src-cpp/x10/runtime/Deque.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/runtime/Deque.cc 2009-08-13 01:42:21 UTC (rev 10963) +++ trunk/x10.runtime.17/src-cpp/x10/runtime/Deque.cc 2009-08-13 01:48:36 UTC (rev 10964) @@ -66,7 +66,7 @@ Slots *q = queue; int mask = q->capacity - 1; int s = sp; - setSlot(q, s & mask, t.get()); + setSlot(q, s & mask, t.operator->()); storeSp(++s); if ((s -= base) == 1) { ; Modified: trunk/x10.runtime.17/src-cpp/x10/runtime/Thread.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10/runtime/Thread.cc 2009-08-13 01:42:21 UTC (rev 10963) +++ trunk/x10.runtime.17/src-cpp/x10/runtime/Thread.cc 2009-08-13 01:48:36 UTC (rev 10964) @@ -67,7 +67,7 @@ tp->__thread_running = true; ref<Object> taskBody = nullCheck(tp->__taskBody); - (taskBody.get()->*(x10aux::findITable<VoidFun_0_0>(taskBody->_getITables())->apply))(); + (taskBody.operator->()->*(x10aux::findITable<VoidFun_0_0>(taskBody->_getITables())->apply))(); // finished running tp->__thread_running = false; Modified: trunk/x10.runtime.17/src-cpp/x10aux/basic_functions.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/basic_functions.h 2009-08-13 01:42:21 UTC (rev 10963) +++ trunk/x10.runtime.17/src-cpp/x10aux/basic_functions.h 2009-08-13 01:48:36 UTC (rev 10964) @@ -10,7 +10,7 @@ template<class T> inline ref<x10::lang::String> class_name(ref<T> x) { x10aux::nullCheck(x); - return x10::lang::String::Lit(((const T*)x.get())->_type()->name()); + return x10::lang::String::Lit(((const T*)x.operator->())->_type()->name()); } inline ref<x10::lang::String> class_name(const x10_double) { Modified: trunk/x10.runtime.17/src-cpp/x10aux/network.cc =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/network.cc 2009-08-13 01:42:21 UTC (rev 10963) +++ trunk/x10.runtime.17/src-cpp/x10aux/network.cc 2009-08-13 01:48:36 UTC (rev 10964) @@ -75,7 +75,7 @@ assert(buf.consumed()==sz); // FIXME: assert that buf.sofar() == sz deserialized_bytes += sz; asyncs_received++; - (async.get()->*(findITable<VoidFun_0_0>(async->_getITables())->apply))(); + (async.operator->()->*(findITable<VoidFun_0_0>(async->_getITables())->apply))(); } // vim:tabstop=4:shiftwidth=4:expandtab Modified: trunk/x10.runtime.17/src-cpp/x10aux/ref.h =================================================================== --- trunk/x10.runtime.17/src-cpp/x10aux/ref.h 2009-08-13 01:42:21 UTC (rev 10963) +++ trunk/x10.runtime.17/src-cpp/x10aux/ref.h 2009-08-13 01:48:36 UTC (rev 10964) @@ -114,10 +114,6 @@ return *(T*)_val; } - T* GPUSAFE get() const { - return (T*)_val; - } - T* GPUSAFE operator->() const { _R_("Accessing object (*) via reference " << this << "(" << _val << ") of type " << TYPENAME(T)); @@ -165,7 +161,7 @@ template <class T> inline ref<T> placeCheck(ref<T> obj) { #if !defined(NO_PLACE_CHECKS) && !defined(NO_EXCEPTIONS) - if (remote_ref::is_remote(obj.get())) throwBPE(); + if (remote_ref::is_remote(obj.operator->())) throwBPE(); #endif return obj; } @@ -217,14 +213,14 @@ x10_int location (void *ptr); template<class T> x10_int location (x10aux::ref<T> ptr) { - return location(ptr.get()); + return location(ptr.operator->()); } // Hack around g++ 4.1 bugs with statement expression. // See XTENLANG-461. #if defined(__GNUC__) template<class T> class GXX_ICE_Workaround { public: static inline T _(T v) { return v; } }; - template<class T> class GXX_ICE_Workaround<ref<T> > { public: static inline T* _(ref<T> v) { return v.get(); } }; + template<class T> class GXX_ICE_Workaround<ref<T> > { public: static inline T* _(ref<T> v) { return v.operator->(); } }; #else template<class T> class GXX_ICE_Workaround { public: static inline T _(T v) { return v; } }; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vj...@us...> - 2009-08-13 06:26:19
|
Revision: 10967 http://x10.svn.sourceforge.net/x10/?rev=10967&view=rev Author: vj0 Date: 2009-08-13 06:26:05 +0000 (Thu, 13 Aug 2009) Log Message: ----------- Fixed Xtenlang-495. Now typeinference works correctly for each one of the following cases for (p in 0..9) S // ok for ((i) in 0..9) S // ok for ((i,j) in 0..9) S // type-checking error for (p:Point(1) in 0..9) S // ok Needed to introduce the notion of thisVar for constraints and types. Needed to correctly define interfaces for Constrained types T{c} -- see discussion in XTENLANG-495. Needed to fix some bugs in Desugarer -- the correct context was not being passed in. Modified Paths: -------------- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AssignPropertyCall_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/SettableAssign_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Field_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Formal_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Loop_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Special_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/ConstrainedType.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/ConstrainedType_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/Subst.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ClassDef_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ClassType.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10Context_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10FieldInstance_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10MethodInstance_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ParsedClassType.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ParsedClassType_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeMixin.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem_c.java trunk/x10.compiler.p3/src/polyglot/ext/x10/types/XTypeTranslator.java trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Desugarer.java trunk/x10.constraints/src/x10/constraint/XConstraint.java trunk/x10.constraints/src/x10/constraint/XConstraint_c.java trunk/x10.runtime.17/src-x10/x10/array/BaseArray.x10 trunk/x10.runtime.17/src-x10/x10/array/BaseDist.x10 trunk/x10.runtime.17/src-x10/x10/array/BaseRegion.x10 Added Paths: ----------- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ThisVar.java trunk/x10.constraints/src/x10/constraint/ThisVar.java Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AssignPropertyCall_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AssignPropertyCall_c.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/AssignPropertyCall_c.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -207,8 +207,10 @@ } // bind this==self; sup clause may constrain this. - if (thisVar != null) + if (thisVar != null) { known.addSelfBinding(thisVar); + known.setThisVar(thisVar); + } if (! known.entails(result, ctx.constraintProjection(known, result))) { throw new SemanticException("Instances created by this constructor satisfy " + known Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/SettableAssign_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/SettableAssign_c.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/SettableAssign_c.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -93,15 +93,18 @@ return right.type(); } - @Override public Expr left(NodeFactory nf) { + return left(nf, null); + } + //@Override + public Expr left(NodeFactory nf, ContextVisitor cv) { Name apply = Name.make("apply"); Call c = nf.Call(position(), array, nf.Id(position(), apply), index); if (mi != null) { X10TypeSystem xts = (X10TypeSystem) mi.typeSystem(); if (true) { ContextVisitor tc = new ContextVisitor(Globals.currentJob(), xts, nf); - tc = tc.context(xts.emptyContext()); + tc = tc.context(cv == null? xts.emptyContext() : cv.context()); try { return (Expr) c.del().disambiguate(tc).typeCheck(tc).checkConstants(tc); } @@ -113,7 +116,7 @@ argTypes.remove(0); MethodInstance ami = null; try { - Context context = xts.emptyContext(); // ### not right -- should do context(this) + Context context = cv==null ? xts.emptyContext() : cv.context(); // ### not right -- should do context(this) ami = xts.findMethod(mi.container(), xts.MethodMatcher(mi.container(), apply, argTypes, context)); } catch (SemanticException e) { Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Field_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Field_c.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Field_c.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -77,7 +77,9 @@ X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); X10Context c = (X10Context) tc.context(); - + if (c == null) { +assert c != null : "pos=" + position(); + } Type tType = target.type(); if (tType == null) assert tType != null : "type of target of |" + this + "| is null"; @@ -208,6 +210,7 @@ private static final boolean ENABLE_PLACE_TYPES = false; + // TODO: vj -- check this code 08/12/09 protected void checkFieldPlaceType(X10Field_c result, ContextVisitor tc) throws SemanticException { @@ -231,7 +234,8 @@ XConstraint_c pc = new XConstraint_c(); XTerm target = ts.xtypeTranslator().trans(pc, result.target(), xc); if (target != null) { - XTerm eloc = ts.xtypeTranslator().trans(pc, target, ((StructType) ts.Ref()).fieldNamed(Name.make("location"))); + XTerm eloc = ts.xtypeTranslator().trans(pc, target, + ((StructType) ts.Ref()).fieldNamed(Name.make("location"))); Type t = result.target().type(); XTerm here = ts.xtypeTranslator().transHere(); Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Formal_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Formal_c.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Formal_c.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -38,6 +38,7 @@ import polyglot.ext.x10.types.X10TypeMixin; import polyglot.ext.x10.types.X10TypeSystem; import polyglot.ext.x10.visit.X10PrettyPrinterVisitor; +import polyglot.ext.x10.visit.X10Translator; import polyglot.types.ClassDef; import polyglot.types.Context; import polyglot.types.Flags; @@ -181,6 +182,7 @@ ts.MethodMatcher(containerType, Name.make("apply"), Collections.EMPTY_LIST, actualTypes, context)); indexType = mi.returnType(); + } catch (SemanticException e) { } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Loop_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Loop_c.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Loop_c.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -26,7 +26,9 @@ import polyglot.ast.Stmt; import polyglot.ast.Term; import polyglot.ext.x10.types.Subst; +import polyglot.ext.x10.types.X10ArraysMixin; import polyglot.ext.x10.types.X10ClassType; +import polyglot.ext.x10.types.X10FieldInstance; import polyglot.ext.x10.types.X10LocalDef; import polyglot.ext.x10.types.X10MethodInstance; import polyglot.ext.x10.types.X10Type; @@ -53,8 +55,11 @@ import x10.constraint.XConstraint; import x10.constraint.XConstraint_c; import x10.constraint.XFailure; +import x10.constraint.XName; import x10.constraint.XRoot; import x10.constraint.XTerm; +import x10.constraint.XTerms; +import x10.constraint.XVar; /** * Captures the commonality of for, foreach and ateach loops in X10. @@ -110,45 +115,7 @@ return this; } -// Formal setClauses(Formal formal, Expr domain, X10NodeFactory nf) { -// X10Type domainType = (X10Type) domain.type(); -// X10TypeSystem ts = (X10TypeSystem) domainType.typeSystem(); -// -// if (formal.type().type().isInt() && domain instanceof RegionMaker) { -// List<Expr> args = ((RegionMaker) domain).arguments(); -// if (args.size() == 2) { -// Expr lo = args.get(0); -// Expr hi = args.get(1); -// if (lo.type().isIntOrLess() && hi.type().isIntOrLess()) { -// X10Type t = (X10Type) formal.type().type(); -// XConstraint c = X10TypeMixin.xclause(t); -// if (c == null) c = new XConstraint_c(); -// else c = c.copy(); -// -// Expr lbound = nf.Binary(lo.position(), nf.Self(lo.position()).type(ts.Int()), Binary.GE, lo).type(ts.Boolean()); -// Expr ubound = nf.Binary(hi.position(), nf.Self(hi.position()).type(ts.Int()), Binary.LE, hi).type(ts.Boolean()); -// -// try { -// XConstraint lc = ts.xtypeTranslator().constraint(Collections.EMPTY_LIST, lbound, thisVar); -// c.addIn(lc); -// -// XConstraint uc = ts.xtypeTranslator().constraint(Collections.EMPTY_LIST, ubound, thisVar); -// c.addIn(uc); -// } -// catch (SemanticException e) { -// } -// catch (XFailure e) { -// } -// -// Type newType = X10TypeMixin.xclause(X10TypeMixin.baseType(t), c); -// formal.localDef().setType(Types.ref(newType)); -// return formal.type(nf.CanonicalTypeNode(formal.type().position(), Types.ref(newType))); -// } -// } -// } -// -// return formal; -// } + public Node typeCheckOverride(Node parent, ContextVisitor tc) throws SemanticException { TypeChecker tc1 = (TypeChecker) tc.enter(parent, this); @@ -176,16 +143,22 @@ public Node typeCheck(ContextVisitor tc) throws SemanticException { NodeFactory nf = tc.nodeFactory(); X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); - X10Type domainType = (X10Type) domain.type(); - + X10Type domainType = (X10Type) domainTypeRef.get(); + if (domainType == null ) { + // aha, in this case the type inferencer did not run, since an explicit type was givem. + domainType = (X10Type) domain.type(); + } Type formalType = formal.declType(); Type Iterable = ts.Iterable(formalType); - + assert domainType != null + : "formal=" + formal + " domain = " + domain + " position = " + position(); if (ts.isSubtypeWithValueInterfaces(domainType, Iterable, tc.context())) { + // if (X10TypeMixin.areConsistent(formalType, domainType) return this; } -// // Check if there is a method with the appropriate name and type with the left operand as receiver. +// // Check if there is a method with the appropriate name and type with the left + // operand as receiver. // X10MethodInstance mi = ts.findMethod(domainType, ts.MethodMatcher(domainType, Name.make("iterator"), Collections.EMPTY_LIST), tc.context().currentClassDef()); // Type rt = mi.returnType(); // if (! mi.flags().isStatic() && ts.isSubtype(rt, Iterator)) @@ -319,126 +292,142 @@ public Expr cond() { return null; } + // Type inference works as follows. We first seek to establish that the domainType + // is a subtype of Iterable[T] for some T. If we can establish this, we then infer + // that the indexType is T. This must be consistent with the type for T that + // may have been declared or inferred from the structure of the index expression. + // For instance if the index expression is (i), then we will infer from this + // structure that its type is Point{self.rank==1}. + // + // Used to record the domainType. Note that this may change as a result of + // type inference -- We need to extract a proposed indexType from the domainType + // and later we will need to check that Iterable[indexType] is a subtype of + // domainType. Now we may need to create a new existentially quantified variable + // (standing for "this") to share between indexType and domainType. Hence the need + // to record this in domainTypeRef. + + // The canonical example for this is for ((i) in 0..9) S. Here 0..0 will have the + // type Region{self.zeroBased, self.rank=1, self.rectangular}. Now since + // Rectangular implements the interface Iterable[Point{self.rank=this.rank}] + // it is necessary to create a new variable, var, representing this, and update + // the domain type to be Region{self=var, self.zeroBased, self.rank=1, self.rectangular} + // and infer the indexType to be Point{self.rank=var.rank}. + + // Subsequently the + // type checker will be able to verify var:Region{self.zeroBased, self.rank=1} |- + // var <: Iterable[Point{self.rank=var.rank}] and hence the for loop typechecking + // obligation (Iterable[indexType] <: domainType) is satisfied. + + LazyRef<Type> domainTypeRef = Types.lazyRef(null); @Override public Node setResolverOverride(final Node parent, final TypeCheckPreparer v) { - final Expr domain = this.domain; - final X10Loop loop = this; - - Formal f = this.formal; - X10LocalDef li = (X10LocalDef) f.localDef(); - if (f.type() instanceof UnknownTypeNode) { - UnknownTypeNode tn = (UnknownTypeNode) f.type(); + final Expr domain = this.domain; + final X10Loop loop = this; - NodeVisitor childv = v.enter(parent, loop); - childv = childv.enter(loop, domain); + final Formal f = this.formal; + X10LocalDef li = (X10LocalDef) f.localDef(); + if (f.type() instanceof UnknownTypeNode) { + UnknownTypeNode tn = (UnknownTypeNode) f.type(); - if (childv instanceof TypeCheckPreparer) { - TypeCheckPreparer tcp = (TypeCheckPreparer) childv; - final LazyRef<Type> r = (LazyRef<Type>) tn.typeRef(); - TypeChecker tc = new TypeChecker(v.job(), v.typeSystem(), v.nodeFactory(), v.getMemo()); - tc = (TypeChecker) tc.context(tcp.context().freeze()); - - // Create a ref and goal for computing the domain type. - final LazyRef<Type> domainTypeRef = Types.lazyRef(null); - domainTypeRef.setResolver(new TypeCheckExprGoal(loop, domain, tc, domainTypeRef)); - - final X10TypeSystem ts = (X10TypeSystem) v.typeSystem(); - final ClassDef curr = v.context().currentClassDef(); - - // Now, get the index type from the domain. - // FIXME: Dist{self==d} index type is Point{rank==this.rank} - // should be Point{rank==d.rank} - r.setResolver(new Runnable() { - Type getIndexType(Type domainType) { - Type base = X10TypeMixin.baseType(domainType); - - if (base instanceof X10ClassType) { - if (ts.hasSameClassDef(base, ts.Iterable())) { - return X10TypeMixin.getParameterType(base, 0); - } - else { - Type sup = ts.superClass(domainType); - if (sup != null) { - Type t = getIndexType(sup); - if (t != null) return t; - } - for (Type ti : ts.interfaces(domainType)) { - Type t = getIndexType(ti); - if (t != null) { - return t; - } - } - } - } + NodeVisitor childv = v.enter(parent, loop); + childv = childv.enter(loop, domain); -// // HACK: need to add iterable -// try { -// X10MethodInstance mi = (X10MethodInstance) ts.findMethod(domainType, ts.MethodMatcher(domainType, Name.make("iterator"), Collections.EMPTY_LIST), curr); -// return X10TypeMixin.getParameterType(mi.returnType(), 0); -// } -// catch (SemanticException e) { -// } - - return null; - } + if (childv instanceof TypeCheckPreparer) { + final TypeCheckPreparer tcp = (TypeCheckPreparer) childv; + final LazyRef<Type> r = (LazyRef<Type>) tn.typeRef(); + TypeChecker tc = new TypeChecker(v.job(), v.typeSystem(), v.nodeFactory(), + v.getMemo()); + tc = (TypeChecker) tc.context(tcp.context().freeze()); - public void run() { - Type domainType = domainTypeRef.get(); - Type indexType = getIndexType(domainType); - - // subst self for this (from the domain type) in the index type. - Type base = X10TypeMixin.baseType(domainType); - XConstraint c = X10TypeMixin.xclause(domainType); - XTerm selfVar = c != null ? c.bindingForVar(c.self()) : null; - XRoot thisVar = base instanceof X10ClassType ? ((X10ClassType) base).x10Def().thisVar() : null; - if (thisVar != null && selfVar != null) - try { - indexType = Subst.subst(indexType, selfVar, thisVar); - } - catch (SemanticException e) { - } + // Create a ref and goal for computing the domain type. + final LazyRef<Type> domainTypeRef = this.domainTypeRef; + domainTypeRef.setResolver(new TypeCheckExprGoal(loop, domain, tc, domainTypeRef)); - if (indexType != null) { - r.update(indexType); - } - } - }); - } - } - -// final X10TypeSystem ts = (X10TypeSystem) v.typeSystem(); -// -// formal.visitChildren(new NodeVisitor() { -// @Override -// public Node override(final Node parent, Node n) { -// if (n instanceof Formal) { -// Formal f = (Formal) n; -// X10LocalDef li = (X10LocalDef) f.localDef(); -// if (f.type() instanceof UnknownTypeNode) { -// final UnknownTypeNode tn = (UnknownTypeNode) f.type(); -// final LazyRef<Type> r = (LazyRef<Type>) tn.typeRef(); -// r.setResolver(new Runnable() { -// public void run() { -// if (parent instanceof Formal) { -// Formal ff = (Formal) parent; -// Ref<Type> fr = (Ref<Type>) ff.type().typeRef(); -// Type ftype = fr.get(); -// Type t = X10TypeMixin.getParameterType(ftype, 0); -// r.update(t); -// } -// else { -// r.update(ts.unknownType(tn.position())); -// } -// } -// }); -// } -// return null; -// } -// return n; -// } -// }); + final X10TypeSystem ts = (X10TypeSystem) v.typeSystem(); + final ClassDef curr = v.context().currentClassDef(); - return super.setResolverOverride(parent, v); + // Now, get the index type from the domain. + r.setResolver(new Runnable() { + Type getIndexType(Type domainType) { + Type base = X10TypeMixin.baseType(domainType); + + if (base instanceof X10ClassType) { + if (ts.hasSameClassDef(base, ts.Iterable())) { + return X10TypeMixin.getParameterType(base, 0); + } + else { + Type sup = ts.superClass(domainType); + if (sup != null) { + Type t = getIndexType(sup); + if (t != null) return t; + } + for (Type ti : ts.interfaces(domainType)) { + Type t = getIndexType(ti); + if (t != null) { + return t; + } + } + } + } + return null; + } + + public void run() { + Type domainType = domainTypeRef.get(); + Type indexType = getIndexType(domainType); + + Type base = X10TypeMixin.baseType(domainType); + XConstraint c = X10TypeMixin.xclause(domainType); + + XVar selfVar = c != null ? c.self() : null; + XRoot thisVar = base instanceof X10ClassType ? + ((X10ClassType) base).x10Def().thisVar() + : null; + + if (thisVar != null && selfVar != null) + try { + // Generate a new local variable + XVar var = c.genEQV(false); + // And substitute it for this in indexType + indexType = Subst.subst(indexType, var, thisVar); + if (ts.isSubtype(indexType, ts.Point(),tcp.context())) { + int length = ((X10Formal) f).vars().size(); + if (length > 0) { + // Add a self.rank=n clause, if the formal + // has n components. + XVar self = X10TypeMixin.xclause(indexType).self(); + X10FieldInstance fi = + X10ArraysMixin.getProperty(ts.Point(), Name.make("rank")); + XName field = XTerms.makeName(fi.def(), + Types.get(fi.def().container()) + + "#" + fi.name().toString()); + + XTerm v = XTerms.makeField((XVar) self, field); + XTerm rank = XTerms.makeLit(new Integer(length)); + indexType = X10TypeMixin.addBinding(indexType, v, rank); + + } + + + } + + // and add self=this in domainType, updating domainTypeRef. + domainType = X10TypeMixin.addBinding(domainType, var, selfVar); + assert domainType !=null : "help!!"; + domainTypeRef.update(domainType); + } + catch (SemanticException e) { + } + + if (indexType != null) { + r.update(indexType); + } + } + }); + } + } + + return super.setResolverOverride(parent, v); } public Node buildTypes(TypeBuilder tb) throws SemanticException { Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Special_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Special_c.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/ast/X10Special_c.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -124,7 +124,9 @@ XConstraint cc = X10TypeMixin.xclause(t); cc = cc == null ? new XConstraint_c() : cc.copy(); try { - cc.addSelfBinding((XVar) xts.xtypeTranslator().trans(cc, this, c)); + XVar var = (XVar) xts.xtypeTranslator().trans(cc, this, c); + cc.addSelfBinding(var); + cc.setThisVar(var); } catch (XFailure e) { throw new SemanticException("Constraint on this is inconsistent; " + e.getMessage(), position()); Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/ConstrainedType.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/ConstrainedType.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/ConstrainedType.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -20,7 +20,7 @@ import x10.constraint.XConstraint; import x10.constraint.XConstraint_c; -public interface ConstrainedType extends ObjectType, X10NamedType { +public interface ConstrainedType extends ObjectType, X10NamedType, X10ThisVar { Ref<? extends Type> baseType(); ConstrainedType baseType(Ref<? extends Type> baseType); @@ -28,7 +28,9 @@ ConstrainedType constraint(Ref<XConstraint> constraint); XConstraint getRealXClause(); - void setRealXClause(XConstraint c, SemanticException error); + //void setRealXClause(XConstraint c, SemanticException error); void checkRealClause() throws SemanticException; + + //XConstraint realX(); } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/ConstrainedType_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/ConstrainedType_c.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/ConstrainedType_c.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -43,11 +43,21 @@ import x10.constraint.XTerms; import x10.constraint.XVar; +/** + * 09/11/09 + * A ConstrainedType_c represents the type T{c}. It has a basetype (of type Ref<? extends Type>) + * and a constraint (of type Ref<XConstraint>). + * + * @author njnystrom + * @author vj + * + */ public class ConstrainedType_c extends ReferenceType_c implements ConstrainedType { private Ref<x10.constraint.XConstraint> constraint; private Ref<? extends Type> baseType; - public ConstrainedType_c(X10TypeSystem ts, Position pos, Ref<? extends Type> baseType, Ref<x10.constraint.XConstraint> constraint) { + public ConstrainedType_c(X10TypeSystem ts, Position pos, + Ref<? extends Type> baseType, Ref<x10.constraint.XConstraint> constraint) { super(ts, pos); assert ts != null; this.baseType = baseType; @@ -60,6 +70,17 @@ return false; } + /** + * Check that the basetype and constraint agree on thisVar. + */ + public XVar thisVar() { + if (realXClause == null) + realXClause = realX(); + if (! realXClause.consistent()) + return null; + return realXClause.thisVar(); + } + public Ref<? extends Type> baseType() { return baseType; } @@ -114,17 +135,64 @@ protected XConstraint realXClause; protected SemanticException realClauseInvalid; - public XConstraint getRealXClause() { return realXClause; } - public void setRealXClause(XConstraint c, SemanticException error) { + public XConstraint getRealXClause() { + if (realXClause == null) { + realXClause = realX(); + } + return realXClause; + } + /*public void setRealXClause(XConstraint c, SemanticException error) { this.realXClause = c; this.realClauseInvalid = error; + }*/ + + protected XConstraint realX() { + // Now get the root clause and join it with the dep clause. + XConstraint rootClause = X10TypeMixin.realX(Types.get(this.baseType())); + if (rootClause == null) + assert rootClause != null; + + XConstraint depClause = X10TypeMixin.xclause(this); + + try { + X10TypeMixin.getThisVar(rootClause, depClause); + } catch (XFailure z) { + try { + rootClause = rootClause.copy().addIn(depClause); + } catch (XFailure z1) { + } + rootClause.setInconsistent(); + return rootClause; + } + if (depClause == null) + return rootClause; + + XConstraint realClause = rootClause.copy(); + + try { + realClause.addIn(depClause); + realClause.setThisVar(XConstraint_c.getThisVar(rootClause, depClause)); + } + catch (XFailure f) { + realClause.setInconsistent(); + } + + return realClause; + } public void checkRealClause() throws SemanticException { // Force real clause to be computed. - X10TypeMixin.realX(this); - if (realClauseInvalid != null) + if (realXClause == null) + realXClause = realX(); + if (! realXClause.consistent()) { + if (realClauseInvalid != null) { + realClauseInvalid = new SemanticException(this + + " has an inconsistent real clause " + realXClause); + + } throw realClauseInvalid; + } } @Override @@ -152,6 +220,9 @@ return sb.toString(); } + // vj 08/11/09 + // For each FieldInstance fi of baseType, need to return a new FieldInstance fi' obtained + // by adding this: this.constraint. @Override public List<FieldInstance> fields() { Type base = baseType.get(); @@ -161,32 +232,41 @@ return Collections.emptyList(); } + // vj: Revised substantially 08/11/09 + @Override public List<Type> interfaces() { final Type base = baseType.get(); - if (base instanceof ObjectType) { - List<Type> l = ((ObjectType) base).interfaces(); - XConstraint c = constraint.get(); - final XTerm t = c.bindingForVar(c.self()); - if (t != null) { - return new TransformingList<Type, Type>(l, new Transformation<Type, Type>() { - public Type transform(Type o) { - X10TypeSystem xts = (X10TypeSystem) o.typeSystem(); - XConstraint c2 = X10TypeMixin.xclause(o); - c2 = c2 != null ? c2.copy() : new XConstraint_c(); - try { - c2.addSelfBinding(t); - return X10TypeMixin.xclause(o, c2); - } - catch (XFailure e) { - } - return o; - } - }); - } - return l; + if (! (base instanceof ObjectType)) + return Collections.emptyList(); + + List<Type> l = ((ObjectType) base).interfaces(); + XConstraint c = constraint.get(); + // Get or make a name tt for self. + XTerm t = c.bindingForVar(c.self()); + if (t == null) { + t = c.genEQV(true); + } - return Collections.emptyList(); + final XTerm tt = t; + + return new TransformingList<Type, Type>(l, new Transformation<Type, Type>() { + public Type transform(Type o) { + X10TypeSystem xts = (X10TypeSystem) o.typeSystem(); + XConstraint c2 = X10TypeMixin.xclause(o); + c2 = c2 != null ? c2.copy() : new XConstraint_c(); + try { + if (c2.thisVar() != null) + c2.addBinding(c2.thisVar(), tt); + //c2.addSelfBinding(tt); + // c2.substitute(tt, XTerms.) + return X10TypeMixin.xclause(o, c2); + } + catch (XFailure e) { + } + return o; + } + }); } @Override Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/Subst.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/Subst.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/Subst.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -42,6 +42,16 @@ Type base = X10TypeMixin.baseType(t); XConstraint c = X10TypeMixin.xclause(t); + if (t instanceof X10ParsedClassType) { + X10ParsedClassType ct = (X10ParsedClassType) t; + List<Type> newArgs = new ArrayList<Type>(); + for (Type at : ct.typeArguments()) { + Type at2 = subst(at, y, x); + newArgs.add(at2); + } + if (! newArgs.isEmpty()) + return ct.typeArguments(newArgs); + } else if (c != null) { base = subst(base, y, x); @@ -56,17 +66,7 @@ return X10TypeMixin.xclause(base, c); } - if (t instanceof X10ParsedClassType) { - X10ParsedClassType ct = (X10ParsedClassType) t; - List<Type> newArgs = new ArrayList<Type>(); - for (Type at : ct.typeArguments()) { - Type at2 = subst(at, y, x); - newArgs.add(at2); - } - if (! newArgs.isEmpty()) - return ct.typeArguments(newArgs); - } - + return t; } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ClassDef_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ClassDef_c.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ClassDef_c.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -165,12 +165,14 @@ // Add in constraints from the supertypes. This is // no need to change self, and no occurrence of this is possible in // a type's base constraint. + // vj: 08/12/09. Incorrect. this can occur in a type's base constraint. { Type type = Types.get(superType()); if (type != null) { XConstraint rs = X10TypeMixin.realX(type); if (rs != null) { -// rs = rs.substitute(rs.self(), oldThis); + if (rs.thisVar() != null) + rs = rs.substitute(oldThis, (XRoot) rs.thisVar()); result.addIn(rs); } } @@ -234,6 +236,7 @@ // class Place extends Ref { ... } // Disable this for now since it can cause an infinite loop. + // TODO: vj 08/12/09 Revisit this. if (false && result.consistent()) { // Verify that the realclause, as it stands, entails the assertions of the // property. Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ClassType.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ClassType.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ClassType.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -24,9 +24,11 @@ import polyglot.types.Type; import polyglot.util.TransformingList; -/** The representative of ClassType in the X10 type hierarchy. A class is a - * reference; arrays are examples of references which are not classes. +/** The representative of ClassType in the X10 type hierarchy. * + * A class is a reference; arrays are examples of references which are not classes. + * (This is inherited from Java. Needs to be fixed in The Great X01 2.0 Type Redesign. + * * @author vj * */ Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10Context_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10Context_c.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10Context_c.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -303,9 +303,15 @@ currentPlaceConstraint = c; } protected XConstraint currentConstraint; + // vj: TODO: check if this is the right thing to do. public XConstraint currentConstraint() { - if (currentConstraint == null) - return new XConstraint_c(); + if (currentConstraint == null) { + XConstraint c = new XConstraint_c(); + if (! inStaticContext()) { + c.setThisVar(thisVar()); + } + return c; + } return currentConstraint; } public void setCurrentConstraint(XConstraint c) { Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10FieldInstance_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10FieldInstance_c.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10FieldInstance_c.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -28,6 +28,7 @@ import x10.constraint.XConstraint_c; import x10.constraint.XFailure; import x10.constraint.XLocal; +import x10.constraint.XRoot; import x10.constraint.XTerm; /** @@ -121,6 +122,10 @@ // otherwise, we'll get called recursively. XTerm self = xts.xtypeTranslator().trans(c, receiver, this, t); c.addSelfBinding(self); + if (receiver instanceof XRoot) { + // this is the case if we are not in static context. + c.setThisVar((XRoot) receiver); + } rightType = X10TypeMixin.xclause(X10TypeMixin.baseType(t), c); } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10MethodInstance_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10MethodInstance_c.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10MethodInstance_c.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -568,6 +568,7 @@ try { ythis = xts.xtypeTranslator().genEQV(c, thisType, false); c.addSelfBinding(ythis); + c.setThisVar(ythis); } catch (XFailure e) { throw new SemanticException(e.getMessage(), me.position()); @@ -711,6 +712,7 @@ XConstraint yc = X10TypeMixin.xclause(thisType); if (yc != null) { XConstraint yc2 = yc.substitute(ythis, yc.self()); + yc2.setThisVar(ythis); env.addIn(yc2); } } @@ -800,6 +802,7 @@ XConstraint query = me.guard(); if (query != null) { XConstraint query2 = query.substitute(ythis, xthis); + query2.setThisVar(ythis); // XConstraint query3 = query2.substitute(Y, X); XConstraint query3 = query2; XConstraint query4 = query3.substitute(y, x); @@ -1013,6 +1016,9 @@ } c.addSelfBinding(self); + if (! flags.isStatic()) { + c.setThisVar((XVar) receiver); + } rightType = X10TypeMixin.xclause(X10TypeMixin.baseType(t), c); } catch (XFailure f) { Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ParsedClassType.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ParsedClassType.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ParsedClassType.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -15,12 +15,14 @@ import polyglot.types.Flags; import polyglot.types.ParsedClassType; import polyglot.types.Type; +import x10.constraint.XConstraint; /** * @author vj * * */ -public interface X10ParsedClassType extends ParsedClassType, X10ClassType, X10NamedType { +public interface X10ParsedClassType extends ParsedClassType, X10ClassType, X10NamedType, X10ThisVar { + XConstraint getXClause(); } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ParsedClassType_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ParsedClassType_c.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ParsedClassType_c.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -15,6 +15,7 @@ import java.util.List; import polyglot.ast.Expr; +import polyglot.ext.x10.ast.SemanticError; import polyglot.types.ClassDef; import polyglot.types.ClassType; import polyglot.types.ConstructorInstance; @@ -31,14 +32,24 @@ import polyglot.types.TypeObject; import polyglot.types.TypeSystem; import polyglot.types.Types; +import polyglot.util.InternalCompilerError; import polyglot.util.Position; import polyglot.util.Transformation; import polyglot.util.TransformingList; import polyglot.util.TypedList; +import x10.constraint.XConstraint; +import x10.constraint.XConstraint_c; +import x10.constraint.XFailure; import x10.constraint.XRoot; import x10.constraint.XVar; -/** 6/2006 Modified so that every type is now potentially generic and dependent. +/** 08/011/09 An X10ParsedClassType_c represents a type C[T1,..., Tn], where + * C is a class and T1,..., Tn are type parameters. Almost all the information + * supplied by an X10ParsedClassType_c is obtained from the x10ClassDef(), a reference + * to the ClassDef object with which this object is created and that represents the + * underlying class definition. + * + * TODO: * @author vj */ public class X10ParsedClassType_c extends ParsedClassType_c @@ -264,6 +275,8 @@ return new TransformingList<X10FieldDef, FieldInstance>(x10Def().properties(), new X10FieldAsTypeTransform()); } + // TODO: vj 08/11/09. Why are properties not obtained through the ClassDef, just like + // other class members? public List<FieldInstance> properties() { Type superType = superClass(); if (superType instanceof X10ClassType) { @@ -293,9 +306,19 @@ return typeArguments; } + /** + * thisVar is set based on the types used to instantiate this type. All + * the types used must agree on their thisVar. That is the thisVar + * for this type. + */ public X10ParsedClassType typeArguments(List<Type> typeArgs) { X10ParsedClassType_c n = (X10ParsedClassType_c) copy(); n.typeArguments = TypedList.copyAndCheck(typeArgs, Type.class, false); + try { + n.thisVar = X10TypeMixin.getThisVar(typeArgs); + } catch (XFailure z) { + throw new InternalCompilerError(z.toString() + " for type " + this); + } n.subst = null; return n; } @@ -374,5 +397,24 @@ return this == o; } + + XVar thisVar; + public XVar thisVar() { + return thisVar; + } + + XConstraint xClause; + + public XConstraint getXClause() { + if (xClause == null) { + xClause = new XConstraint_c(); + try { + xClause.setThisVar(X10TypeMixin.getThisVar(typeArguments())); + } catch (XFailure f) { + xClause.setInconsistent(); + } + } + return xClause; + } } Added: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ThisVar.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ThisVar.java (rev 0) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10ThisVar.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -0,0 +1,9 @@ +package polyglot.ext.x10.types; + +import x10.constraint.XVar; + +public interface X10ThisVar { + + XVar thisVar(); + +} Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeMixin.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeMixin.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeMixin.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -18,6 +18,7 @@ import polyglot.ast.Binary; import polyglot.ast.Unary; import polyglot.ast.Binary.Operator; +import polyglot.ext.x10.ast.SemanticError; import polyglot.ext.x10.ast.X10ClassDecl_c; import polyglot.frontend.Globals; import polyglot.types.ClassType; @@ -38,11 +39,12 @@ import x10.constraint.XLit; import x10.constraint.XNameWrapper; import x10.constraint.XPromise; +import x10.constraint.XRoot; import x10.constraint.XTerm; import x10.constraint.XVar; /** - * An X10 dependent type. + * Utilities for dealing with X10 dependent types. * @author nystrom */ public class X10TypeMixin { @@ -96,29 +98,7 @@ return new XConstraint_c(); } else if (t instanceof ConstrainedType) { - ConstrainedType ct = (ConstrainedType) t; - - // Now get the root clause and join it with the dep clause. - XConstraint rootClause = realX(Types.get(ct.baseType())); - if (rootClause == null) - assert rootClause != null; - - XConstraint depClause = xclause(ct); - - if (depClause == null) { - return rootClause; - } - else { - XConstraint realClause = rootClause.copy(); - - try { - realClause.addIn(depClause); - } - catch (XFailure f) { - realClause.setInconsistent(); - } - return realClause; - } + return ((ConstrainedType) t).getRealXClause(); } else if (t instanceof X10ClassType) { X10ClassType ct = (X10ClassType) t; @@ -157,6 +137,10 @@ ConstrainedType ct = (ConstrainedType) t; return Types.get(ct.constraint()); } + if (t instanceof X10ParsedClassType) { + X10ParsedClassType ct = (X10ParsedClassType) t; + return ct.getXClause(); + } return null; } public static Type baseType(Type t) { @@ -190,13 +174,15 @@ return t; } public static Type xclause(Type t, XConstraint c) { - if (t == null) - return null; - if (c == null || c.valid()) { - return baseType(t); - } - return xclause(Types.ref(t), Types.ref(c)); + if (t == null) + return null; + if (c == null || c.valid()) { + return baseType(t); + } + return xclause(Types.ref(t), Types.ref(c)); } + // vj: 08/11/09 -- have to recursively walk the + // type parameters and add the constraint to them. public static Type xclause(final Ref<? extends Type> t, final Ref<XConstraint> c) { if (t == null) { return null; @@ -272,7 +258,7 @@ return t instanceof ConstrainedType; } - public static Type addBinding(Type t, XVar t1, XVar t2) { + public static Type addBinding(Type t, XTerm t1, XTerm t2) { try { XConstraint c = xclause(t); if (c == null) { @@ -321,6 +307,19 @@ } return xclause(X10TypeMixin.baseType(t), c); } + + public static Type setThisVar(Type t, XVar v) throws SemanticException { + XConstraint c = xclause(t); + if (c == null) { + c = new XConstraint_c(); + } + else { + c = c.copy(); + } + + c.setThisVar(v); + return xclause(X10TypeMixin.baseType(t), c); + } /** * If the type constrains the given property to @@ -400,4 +399,49 @@ } return Collections.EMPTY_LIST; } + + /** + * Returns the var that is thisvar of all the terms in {t1,t2} that have a thisvar. + * If none do, return null. Else throw a SemanticError. + * @param t1 + * @param t2 + * @return + * @throws SemanticError + */ + public static XVar getThisVar(Type t1, Type t2) throws XFailure { + XVar thisVar = t1 == null ? null : ((X10ThisVar) t1).thisVar(); + if (thisVar == null) + return t2==null ? null : ((X10ThisVar) t2).thisVar(); + if (t2 != null && ! thisVar.equals(((X10ThisVar) t2).thisVar())) + throw new XFailure("Inconsistent this vars " + thisVar + " and " + + ((X10ThisVar) t2).thisVar()); + return thisVar; + } + public static XVar getThisVar(XConstraint t1, XConstraint t2) throws XFailure { + XVar thisVar = t1 == null ? null : t1.thisVar(); + if (thisVar == null) + return t2==null ? null : t2.thisVar(); + if (t2 != null && ! thisVar.equals( t2.thisVar())) + throw new XFailure("Inconsistent this vars " + thisVar + " and " + + ((X10ThisVar) t2).thisVar()); + return thisVar; + } + public static XVar getThisVar(List<Type> typeArgs) throws XFailure { + XVar thisVar = null; + if (typeArgs != null) + for (Type type : typeArgs) { + if (type instanceof X10ThisVar) { + X10ThisVar xtype = (X10ThisVar)type; + XVar o = xtype.thisVar(); + if (thisVar == null) { + thisVar = o; + } else { + if (! thisVar.equals(o)) + throw new XFailure("Inconsistent thisVars in " + typeArgs + + "; cannot instantiate "); + } + } + } + return thisVar; + } } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem_c.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem_c.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/X10TypeSystem_c.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -2271,8 +2271,11 @@ oldThis = fi.x10Def().thisVar(); Type t = fi.type(); - Type newT = oldThis == null ? t : Subst.subst(t, (new XVar[] { v }), (new XRoot[] { oldThis }), new Type[] {}, new ParameterType[] {}); - + Type newT = oldThis == null ? t + : Subst.subst(t, (new XVar[] { v }), (new XRoot[] { oldThis }), new Type[] {}, new ParameterType[] {}); + // TODO: vj: 08/11/09 + // Shouldnt we be setting thisVar on the type? + Type rt = fi.rightType(); Type newRT = oldThis == null ? rt : Subst.subst(rt, (new XVar[] { v }), (new XRoot[] { oldThis }), new Type[] {}, new ParameterType[] {}); Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/types/XTypeTranslator.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/types/XTypeTranslator.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/types/XTypeTranslator.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -69,6 +69,7 @@ ts = xts; } + // TODO: vj 08/11/09 -- why does this do nothing? public void addTypeToEnv(XTerm self, final Type t) throws SemanticException { } @@ -161,11 +162,15 @@ } XRoot thisVar = xc == null ? null : xc.thisVar(); if (thisVar == null) { - SemanticException e = new SemanticException("Cannot refer to this from this context."); + SemanticException e = new SemanticException("Cannot refer to |this| from the context " + + xc); if (true) throw new InternalCompilerError(e.getMessage()); throw e; } + // vj: Need to set the thisVar for the constraint. + if (c != null) + c.setThisVar(thisVar); return thisVar; } } Modified: trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Desugarer.java =================================================================== --- trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Desugarer.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.compiler.p3/src/polyglot/ext/x10/visit/Desugarer.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -558,7 +558,7 @@ args).methodInstance(mi).type(mi.returnType()); } X10Binary_c.Operator op = SettableAssign_c.binaryOp(n.operator()); - X10Call left = (X10Call) n.left(xnf); + X10Call left = (X10Call) n.left(xnf, this); MethodInstance ami = left.methodInstance(); List<Formal> parms = new ArrayList<Formal>(); Name xn = Name.make("x"); Added: trunk/x10.constraints/src/x10/constraint/ThisVar.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/ThisVar.java (rev 0) +++ trunk/x10.constraints/src/x10/constraint/ThisVar.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -0,0 +1,14 @@ +package x10.constraint; + +public interface ThisVar { + + /** + * We distinguish the variable "this" since the compiler needs to perform + * special actions for this. So each constraint keeps track of its this + * variable. This is typically set using setThisVar when a substitution + * is being applied. + * @return + */ + XVar thisVar(); + +} Modified: trunk/x10.constraints/src/x10/constraint/XConstraint.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XConstraint.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.constraints/src/x10/constraint/XConstraint.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -20,11 +20,15 @@ * @author vj * */ -public interface XConstraint extends java.io.Serializable { +public interface XConstraint extends java.io.Serializable, ThisVar { /** * Variable to use for self in the constraint. */ XRoot self(); + + + void setThisVar(XVar thisVar); + void addThisBinding(XTerm term) throws XFailure; /** * Is the consistent consistent? That is, does it have a solution? @@ -128,6 +132,7 @@ /** * Add constraint c into this, and return this. + * No change is made to this if c==null * * @param c * @return Modified: trunk/x10.constraints/src/x10/constraint/XConstraint_c.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XConstraint_c.java 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.constraints/src/x10/constraint/XConstraint_c.java 2009-08-13 06:26:05 UTC (rev 10967) @@ -31,6 +31,7 @@ /** Variable to use for self in the constraint. */ XRoot self; + XVar thisVar; // Maps XTerms to nodes. protected HashMap<XTerm, XPromise> roots; @@ -51,6 +52,9 @@ return self; } + public XVar thisVar() { + return thisVar; + } boolean consistent = true; boolean valid = true; @@ -71,10 +75,16 @@ /** * Copy this constraint logically; that is, create a new constraint * that contains the same equalities (if any) as the current one. + * vj: 08/12/09 + * Copying also the consistency, and validity status, and thisVar and self. */ public XConstraint_c copy() { XConstraint_c c = new XConstraint_c(); try { + c.thisVar = thisVar(); + c.self = self(); + c.consistent = consistent; + c.valid = valid; return copyInto(c); } catch (XFailure f) { @@ -95,7 +105,7 @@ return c; } - /** Add in a constraint, unifying this.self and c.self */ + /** Add in a constraint, substituting this.self for c.self */ public XConstraint addIn(XConstraint c) throws XFailure { if (c != null) { List<XTerm> result = c.constraints(); @@ -105,9 +115,20 @@ addTerm(t.subst(self(), c.self())); } } + // vj: What about thisVar for c? Should that be added? + // thisVar = getThisVar(this, c); return this; } + public static XVar getThisVar(XConstraint t1, XConstraint t2) throws XFailure { + XVar thisVar = t1 == null ? null : t1.thisVar(); + if (thisVar == null) + return t2==null ? null : t2.thisVar(); + if (t2 != null && ! thisVar.equals( t2.thisVar())) + throw new XFailure("Inconsistent this vars " + thisVar + " and " + + t2.thisVar()); + return thisVar; + } public XVar bindingForVar(XVar v) { try { XPromise p = lookup(v); @@ -121,7 +142,7 @@ return null; } - public XConstraint removeVarBindings(XVar v) { + /* public XConstraint removeVarBindings(XVar v) { try { XConstraint c = new XConstraint_c(); for (XTerm t : constraints()) { @@ -141,7 +162,7 @@ return this; } } - +*/ public List<XFormula> atoms() { List<XFormula> r = new LinkedList<XFormula>(); for (XTerm t : roots.keySet()) { @@ -444,10 +465,7 @@ } return result; } - static final boolean D = false; - static void debug(String s) { - System.out.println(s); - } + private boolean entails(List<XTerm> conjuncts, XRoot self, final XConstraint sigma) throws XFailure { @@ -947,6 +965,17 @@ addBinding(self(), var); } + public void addThisBinding(XTerm term) throws XFailure { + addBinding(thisVar(), term); + } + + public void setThisVar(XVar var) { + if (var == null) return; + if (thisVar != null && ! thisVar.equals(var)) + System.err.println("Thisvar for " + this + " was " + thisVar + " (#" + thisVar.hashCode() + + ") being now set to " + var + " (#" + var.hashCode()); + thisVar = var; + } // FIXME: need to convert f(g(x)) into \exists y. f(y) && g(x) = y when f and g both atoms // This is needed for Nelson-Oppen to work correctly. // Each atom should be a root. Modified: trunk/x10.runtime.17/src-x10/x10/array/BaseArray.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/array/BaseArray.x10 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.runtime.17/src-x10/x10/array/BaseArray.x10 2009-08-13 06:26:05 UTC (rev 10967) @@ -198,7 +198,7 @@ results(p) = at (ps(p)) { var result: T = unit; val a = (this | here) as Array[T](rank); - for (pt:Point(rank) in a) + for (pt:Point(rank) in a.region) result = op(result, a(pt)); return result; }; Modified: trunk/x10.runtime.17/src-x10/x10/array/BaseDist.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/array/BaseDist.x10 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.runtime.17/src-x10/x10/array/BaseDist.x10 2009-08-13 06:26:05 UTC (rev 10967) @@ -202,7 +202,7 @@ // overall region var overall: Region(rank) = Region.makeEmpty(rank); - for (r:Region(rank) in rs) + for (r in rs) overall = overall.union(r) as Region(rank); return new BaseDist(overall, ps, rs); Modified: trunk/x10.runtime.17/src-x10/x10/array/BaseRegion.x10 =================================================================== --- trunk/x10.runtime.17/src-x10/x10/array/BaseRegion.x10 2009-08-13 05:33:59 UTC (rev 10966) +++ trunk/x10.runtime.17/src-x10/x10/array/BaseRegion.x10 2009-08-13 06:26:05 UTC (rev 10967) @@ -74,7 +74,7 @@ public static def makeLowerTriangular1(rowMin: int, colMin: int, size: int): Region(2) = PolyRegion.makeLowerTriangular2(rowMin, colMin, size); - public static def make1(regions: Rail[Region]): RectRegion(regions.length) { // XTENLANG-4 + public static def make1(regions: Rail[Region/*(1)*/]): RectRegion(regions.length) { // XTENLANG-4 var r: Region = regions(0); for (var i: int = 1; i<regions.length; i++) r = r.product(regions(i)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2009-08-13 14:18:58
|
Revision: 10972 http://x10.svn.sourceforge.net/x10/?rev=10972&view=rev Author: dgrove-oss Date: 2009-08-13 14:18:48 +0000 (Thu, 13 Aug 2009) Log Message: ----------- Remove the .17 suffix from x10.runtime and x10.common Modified Paths: -------------- trunk/SafeX10/.classpath trunk/x10.common/.project trunk/x10.common/META-INF/MANIFEST.MF trunk/x10.common/build.xml trunk/x10.common/exportPlugin.xml trunk/x10.compiler.p3/META-INF/MANIFEST.MF trunk/x10.compiler.p3/build.xml trunk/x10.cppbackend.17/.launchConfigs/x10cpp.launch trunk/x10.cppbackend.17/META-INF/MANIFEST.MF trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java trunk/x10.dist/.launchConfigs/x10.launch trunk/x10.dist/.launchConfigs/x10c.launch trunk/x10.dist/bin/x10c++ trunk/x10.dist/build.xml trunk/x10.dist/releng/exportRelease.sh trunk/x10.runtime/.project trunk/x10.runtime/META-INF/MANIFEST.MF trunk/x10.runtime/build.xml trunk/x10.runtime/exportPlugin.xml trunk/x10.tests/bin/buildScript trunk/x10.tests/bin/buildScript++ trunk/x10.tests/bin/buildScriptCT trunk/x10.tests/bin/buildScriptCT++ trunk/x10.tests/bin/driverScript trunk/x10.tests/bin/driverScript++ trunk/x10.tests/bin/driverScriptCT trunk/x10.tests/bin/driverScriptCT++ trunk/x10.tests/bin/preCompileScript trunk/x10.tests/bin/preCompileScriptCT trunk/x10.tests/bin/xtestScript++ trunk/x10.tests/bin/xtestScriptCT++ Added Paths: ----------- trunk/x10.common/ trunk/x10.runtime/ Removed Paths: ------------- trunk/x10.common.17/ trunk/x10.runtime.17/ Modified: trunk/SafeX10/.classpath =================================================================== --- trunk/SafeX10/.classpath 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/SafeX10/.classpath 2009-08-13 14:18:48 UTC (rev 10972) @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> - <classpathentry kind="lib" path="C:/eclipse332ForX1017/eclipse/plugins/x10.runtime.17_1.7.3.1.jar"/> + <classpathentry kind="lib" path="C:/eclipse332ForX1017/eclipse/plugins/x10.runtime_1.7.3.1.jar"/> <classpathentry kind="lib" path="C:/eclipse332ForX1017/eclipse/plugins/x10.constraints_1.7.3.1.jar"/> - <classpathentry kind="lib" path="C:/eclipse332ForX1017/eclipse/plugins/x10.common.17_1.7.3.1.jar"/> + <classpathentry kind="lib" path="C:/eclipse332ForX1017/eclipse/plugins/x10.common_1.7.3.1.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/Java50"/> <classpathentry kind="output" path="bin"/> </classpath> Modified: trunk/x10.common/.project =================================================================== --- trunk/x10.common.17/.project 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.common/.project 2009-08-13 14:18:48 UTC (rev 10972) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <projectDescription> - <name>x10.common.17</name> + <name>x10.common</name> <comment></comment> <projects> </projects> Modified: trunk/x10.common/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.common.17/META-INF/MANIFEST.MF 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.common/META-INF/MANIFEST.MF 2009-08-13 14:18:48 UTC (rev 10972) @@ -1,6 +1,6 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Common -Bundle-SymbolicName: x10.common.17 +Bundle-SymbolicName: x10.common Bundle-Version: 1.7.4.0 Export-Package: x10.config Modified: trunk/x10.common/build.xml =================================================================== --- trunk/x10.common.17/build.xml 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.common/build.xml 2009-08-13 14:18:48 UTC (rev 10972) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE project [<!ENTITY buildfile SYSTEM "file:./build-user.xml">]> -<project name="x10.common.17" default="build" basedir="."> +<project name="x10.common" default="build" basedir="."> &buildfile; <property name="x10.home" value="${basedir}/.."/> <property name="x10.dist.location" value="${x10.home}/x10.dist"/> Modified: trunk/x10.common/exportPlugin.xml =================================================================== --- trunk/x10.common.17/exportPlugin.xml 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.common/exportPlugin.xml 2009-08-13 14:18:48 UTC (rev 10972) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<project name="x10.common.17" default="build.update.jar" basedir="."> +<project name="x10.common" default="build.update.jar" basedir="."> <import file="../org.eclipse.imp.x10dt.feature/buildCommon.xml"/> <import file="../org.eclipse.imp.x10dt.update/buildPluginCommon.xml"/> Modified: trunk/x10.compiler.p3/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.compiler.p3/META-INF/MANIFEST.MF 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.compiler.p3/META-INF/MANIFEST.MF 2009-08-13 14:18:48 UTC (rev 10972) @@ -4,7 +4,7 @@ Bundle-SymbolicName: x10.compiler.p3 Bundle-Version: 1.7.4.0 Bundle-Localization: plugin -Require-Bundle: x10.common.17, +Require-Bundle: x10.common, x10.constraints, lpg.runtime, polyglot3 Modified: trunk/x10.compiler.p3/build.xml =================================================================== --- trunk/x10.compiler.p3/build.xml 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.compiler.p3/build.xml 2009-08-13 14:18:48 UTC (rev 10972) @@ -9,7 +9,7 @@ <!--<property name="lpg.executable.location" location="${x10.home}/lpg.generator.${platform}_${os.arch}/lpgexe"/>--> <property name="x10.runtime.location" value="${x10.home}/x10.runtime.x10"/> <property name="x10.constraints.location" location="${x10.home}/x10.constraints"/> - <property name="x10.common.location" location="${x10.home}/x10.common.17"/> + <property name="x10.common.location" location="${x10.home}/x10.common"/> <property name="build" location="${basedir}/classes"/> <property name="src" location="${basedir}/src"/> <property name="lib" location="${x10.dist.location}/lib"/> Modified: trunk/x10.cppbackend.17/.launchConfigs/x10cpp.launch =================================================================== --- trunk/x10.cppbackend.17/.launchConfigs/x10cpp.launch 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.cppbackend.17/.launchConfigs/x10cpp.launch 2009-08-13 14:18:48 UTC (rev 10972) @@ -8,10 +8,10 @@ <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="lpg.runtime.java" type="1"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.compiler.p3" type="1"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.constraints" type="1"/> "/> -<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.common.17" type="1"/> "/> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.common" type="1"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="polyglot3" type="1"/> "/> </listAttribute> -<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-ext x10cpp ${resource_loc} -sourcepath ${project_loc:x10.runtime.17}/src-x10 -noserial -assert -d out -disable CheckNativeAnnotations -commandlineonly ${project_loc:x10.tests}/examples/x10lib/harness/x10Test.x10"/> +<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-ext x10cpp ${resource_loc} -sourcepath ${project_loc:x10.runtime}/src-x10 -noserial -assert -d out -disable CheckNativeAnnotations -commandlineonly ${project_loc:x10.tests}/examples/x10lib/harness/x10Test.x10"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="x10.cppbackend.17"/> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea"/> <listAttribute key="org.eclipse.debug.ui.favoriteGroups"> @@ -20,7 +20,7 @@ </listAttribute> <mapAttribute key="org.eclipse.debug.core.environmentVariables"> <mapEntry key="X10LIB" value="${project_loc:x10.cppbackend.17}/../pgas/common/work"/> -<mapEntry key="X10LANG" value="${project_loc:x10.runtime.17}/src-cpp"/> +<mapEntry key="X10LANG" value="${project_loc:x10.runtime}/src-cpp"/> </mapAttribute> <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${container_loc}"/> <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> Modified: trunk/x10.cppbackend.17/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.cppbackend.17/META-INF/MANIFEST.MF 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.cppbackend.17/META-INF/MANIFEST.MF 2009-08-13 14:18:48 UTC (rev 10972) @@ -16,7 +16,7 @@ polyglot.ext.x10cuda.visit, x10c.util Require-Bundle: polyglot3, - x10.common.17, + x10.common, x10.compiler.p3, x10.constraints Bundle-ActivationPolicy: lazy Modified: trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java =================================================================== --- trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/visit/X10CPPTranslator.java 2009-08-13 14:18:48 UTC (rev 10972) @@ -455,7 +455,7 @@ return (DelegateTargetFactory) this.tf; } - public static final String X10LANG = System.getenv("X10LANG")==null?"../../../x10.runtime.17/src-cpp":System.getenv("X10LANG").replace(File.separatorChar, '/'); + public static final String X10LANG = System.getenv("X10LANG")==null?"../../../x10.runtime/src-cpp":System.getenv("X10LANG").replace(File.separatorChar, '/'); public static final String MANIFEST = "libx10.mft"; public static final String[] MANIFEST_LOCATIONS = new String[] { X10LANG, Modified: trunk/x10.dist/.launchConfigs/x10.launch =================================================================== --- trunk/x10.dist/.launchConfigs/x10.launch 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.dist/.launchConfigs/x10.launch 2009-08-13 14:18:48 UTC (rev 10972) @@ -8,7 +8,7 @@ </listAttribute> <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> <stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/> -<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;javaProject name=&quot;x10.runtime.17&quot;/&gt;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;javaProject name=&quot;x10.constraints&quot;/&gt;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;folder nest=&quot;true&quot; path=&quot;/x10.common/examples/Constructs/AtEach&quot;/&gt;&#10;" typeId="org.eclipse.debug.core.containerType.folder"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;folder nest=&quot;true&quot; path=&quot;/x10.runtime/src&quot;/&gt;&#10;" typeId="org.eclipse.debug.core.containerType.folder"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;default/&gt;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/> +<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;javaProject name=&quot;x10.runtime&quot;/&gt;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;javaProject name=&quot;x10.constraints&quot;/&gt;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;folder nest=&quot;true&quot; path=&quot;/x10.common/examples/Constructs/AtEach&quot;/&gt;&#10;" typeId="org.eclipse.debug.core.containerType.folder"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;folder nest=&quot;true&quot; path=&quot;/x10.runtime/src&quot;/&gt;&#10;" typeId="org.eclipse.debug.core.containerType.folder"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;default/&gt;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/> <listAttribute key="org.eclipse.debug.ui.favoriteGroups"> <listEntry value="org.eclipse.debug.ui.launchGroup.run"/> <listEntry value="org.eclipse.debug.ui.launchGroup.debug"/> @@ -16,13 +16,13 @@ <listAttribute key="org.eclipse.jdt.launching.CLASSPATH"> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="x10" path="1" type="4"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.constraints" type="1"/> "/> -<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.runtime.17" type="1"/> "/> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.runtime" type="1"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="polyglot3" type="1"/> "/> </listAttribute> <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="x10.runtime.impl.java.Runtime"/> <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="${resource_name}"/> -<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="x10.runtime.17"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="x10.runtime"/> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea"/> <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${container_loc}"/> </launchConfiguration> Modified: trunk/x10.dist/.launchConfigs/x10c.launch =================================================================== --- trunk/x10.dist/.launchConfigs/x10c.launch 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.dist/.launchConfigs/x10c.launch 2009-08-13 14:18:48 UTC (rev 10972) @@ -14,7 +14,7 @@ <listAttribute key="org.eclipse.jdt.launching.CLASSPATH"> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="x10.compiler.p3" path="1" type="4"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.pde.core.requiredPlugins" javaProject="polyglot3" path="3" type="4"/> "/> -<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.runtime.17" type="1"/> "/> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.runtime" type="1"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.compiler.p3" type="1"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.constraints" type="1"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="lpg.runtime.java" type="1"/> "/> @@ -23,7 +23,7 @@ </listAttribute> <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="polyglot.main.Main"/> -<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-ext x10 "${resource_loc}" -sourcepath "${workspace_loc:x10.runtime.17/src-x10}" -sourcepath "${workspace_loc:x10.dist}/lib/x10.jar" -sourcepath "${workspace_loc:x10.tests}/examples/x10lib" -noserial -assert -post "javac -source 1.5" -d out -disable CheckNativeAnnotations"/> +<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-ext x10 "${resource_loc}" -sourcepath "${workspace_loc:x10.runtime/src-x10}" -sourcepath "${workspace_loc:x10.dist}/lib/x10.jar" -sourcepath "${workspace_loc:x10.tests}/examples/x10lib" -noserial -assert -post "javac -source 1.5" -d out -disable CheckNativeAnnotations"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="x10.compiler.p3"/> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea"/> <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${container_loc}"/> Modified: trunk/x10.dist/bin/x10c++ =================================================================== --- trunk/x10.dist/bin/x10c++ 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.dist/bin/x10c++ 2009-08-13 14:18:48 UTC (rev 10972) @@ -24,8 +24,8 @@ # Default to developer setup [ -z "$X10REL" ] && export X10REL="../x10.dist" [ -z "$X10LIB" ] && export X10LIB="$TOP/../pgas2/common/work" - [ -z "$X10LANG" ] && export X10LANG="$TOP/../x10.runtime.17/src-cpp" - [ -z "$X10GC" ] && export X10GC="$TOP/../x10.runtime.17/src-cpp/bdwgc/install" + [ -z "$X10LANG" ] && export X10LANG="$TOP/../x10.runtime/src-cpp" + [ -z "$X10GC" ] && export X10GC="$TOP/../x10.runtime/src-cpp/bdwgc/install" X10="$(cd "$TOP/$X10REL" && pwd)" fi Modified: trunk/x10.dist/build.xml =================================================================== --- trunk/x10.dist/build.xml 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.dist/build.xml 2009-08-13 14:18:48 UTC (rev 10972) @@ -20,14 +20,14 @@ <property name="polyglot.jar.url" value="${polyglot.url}/polyglot3_3.1.0.jar"/> <property name="x10.constraints.location" location="${x10.home}/x10.constraints"/> <property name="constraints.jar" value="x10constraints.jar"/> - <property name="x10.common.location" location="${x10.home}/x10.common.17"/> + <property name="x10.common.location" location="${x10.home}/x10.common"/> <property name="common.jar" value="x10common.jar"/> <property name="x10.compiler.location" location="${x10.home}/x10.compiler.p3"/> <property name="x10.cppbackend.location" location="${x10.home}/x10.cppbackend.17"/> <property name="compiler.jar" value="x10c.jar"/> <property name="cppbackend.jar" value="x10cpp.jar"/> <property name="config" value="standard.cfg"/> - <property name="x10.runtime.location" location="${x10.home}/x10.runtime.17"/> + <property name="x10.runtime.location" location="${x10.home}/x10.runtime"/> <property name="runtime.jar" value="x10.jar"/> <property name="x10.tests.location" location="${x10.home}/x10.tests"/> <path id="project.classpath"/> @@ -429,9 +429,9 @@ <zipfileset prefix="x10.dist" dir="${basedir}" excludes="releng/**,**/.*.swp,lib/**,etc/**" includes=".launchConfigs/*,.classpath,.project,README,INSTALL,build*,exportPlugin.xml,bin/*.in,bin/x10c++,lib/${polyglot.jar},lib/${lpg.jar},lib/${ecj.jar},samples/**"/> <zipfileset prefix="x10.compiler.p3" dir="${x10.compiler.location}" excludes="releng/**,**/.*.swp,classes/**"/> <zipfileset prefix="x10.cppbackend.17" dir="${x10.cppbackend.location}" excludes="releng/**,**/.*.swp,classes/**"/> - <zipfileset prefix="x10.runtime.17" dir="${x10.runtime.location}" excludes="releng/**,**/.*.swp,classes/**,src-cpp/gen/**"/> + <zipfileset prefix="x10.runtime" dir="${x10.runtime.location}" excludes="releng/**,**/.*.swp,classes/**,src-cpp/gen/**"/> <zipfileset prefix="x10.constraints" dir="${x10.constraints.location}" excludes="releng/**,**/.*.swp,classes/**"/> - <zipfileset prefix="x10.common.17" dir="${x10.common.location}" excludes="releng/**,**/.*.swp,classes/**"/> + <zipfileset prefix="x10.common" dir="${x10.common.location}" excludes="releng/**,**/.*.swp,classes/**"/> <zipfileset prefix="x10.tests" dir="${x10.tests.location}" excludes="releng/**,**/.*.swp,lib/**,etc/**" includes="build*,README,bin/*.in,bin/testScript*,bin/newpgrp,bin/listFailures,examples/README,**/*.x10,**/.ThisIsAnX10TestDirectory"/> </zip> </target> Modified: trunk/x10.dist/releng/exportRelease.sh =================================================================== --- trunk/x10.dist/releng/exportRelease.sh 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.dist/releng/exportRelease.sh 2009-08-13 14:18:48 UTC (rev 10972) @@ -71,12 +71,12 @@ echo echo getting distrib for i in \ - x10.common.17 \ + x10.common \ x10.compiler.p3 \ x10.constraints \ x10.cppbackend.17 \ x10.dist \ - x10.runtime.17 \ + x10.runtime \ x10.tests do svn $svn_command https://x10.svn.sourceforge.net/svnroot/x10/tags/$X10_TAG/$i Modified: trunk/x10.runtime/.project =================================================================== --- trunk/x10.runtime.17/.project 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.runtime/.project 2009-08-13 14:18:48 UTC (rev 10972) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <projectDescription> - <name>x10.runtime.17</name> + <name>x10.runtime</name> <comment></comment> <projects> </projects> Modified: trunk/x10.runtime/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.runtime.17/META-INF/MANIFEST.MF 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.runtime/META-INF/MANIFEST.MF 2009-08-13 14:18:48 UTC (rev 10972) @@ -1,10 +1,10 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: X10 runtime -Bundle-SymbolicName: x10.runtime.17 +Bundle-SymbolicName: x10.runtime Bundle-Version: 1.7.4.0 Eclipse-AutoStart: true Bundle-Vendor: rf...@wa... -Require-Bundle: x10.common.17, +Require-Bundle: x10.common, x10.constraints Modified: trunk/x10.runtime/build.xml =================================================================== --- trunk/x10.runtime.17/build.xml 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.runtime/build.xml 2009-08-13 14:18:48 UTC (rev 10972) @@ -5,7 +5,7 @@ <property name="x10.home" value="${basedir}/.."/> <property name="x10.dist.location" value="${x10.home}/x10.dist"/> <property name="x10.constraints.location" location="${x10.home}/x10.constraints"/> - <property name="x10.common.location" location="${x10.home}/x10.common.17"/> + <property name="x10.common.location" location="${x10.home}/x10.common"/> <property name="build" location="${basedir}/classes"/> <property name="src" location="${basedir}/src-java"/> <property name="inc" location="${x10.dist.location}/include"/> Modified: trunk/x10.runtime/exportPlugin.xml =================================================================== --- trunk/x10.runtime.17/exportPlugin.xml 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.runtime/exportPlugin.xml 2009-08-13 14:18:48 UTC (rev 10972) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<project name="x10.runtime.17" default="build.update.jar" basedir="."> +<project name="x10.runtime" default="build.update.jar" basedir="."> <import file="../org.eclipse.imp.x10dt.feature/buildCommon.xml"/> <import file="../org.eclipse.imp.x10dt.update/buildPluginCommon.xml"/> Modified: trunk/x10.tests/bin/buildScript =================================================================== --- trunk/x10.tests/bin/buildScript 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.tests/bin/buildScript 2009-08-13 14:18:48 UTC (rev 10972) @@ -125,11 +125,11 @@ POLYGLOT_HOME=$X10_HOME/polyglot svnUpdate $POLYGLOT_HOME $POLYGLOT_SVNROOT -X10_COMMON=$X10_HOME/x10.common.17 +X10_COMMON=$X10_HOME/x10.common svnUpdate $X10_COMMON $X10_SVNROOT X10_COMPILER=$X10_HOME/x10.compiler.p3 svnUpdate $X10_COMPILER $X10_SVNROOT -X10_RUNTIME=$X10_HOME/x10.runtime.17 +X10_RUNTIME=$X10_HOME/x10.runtime svnUpdate $X10_RUNTIME $X10_SVNROOT X10_CONSTRAINTS=$X10_HOME/x10.constraints svnUpdate $X10_CONSTRAINTS $X10_SVNROOT Modified: trunk/x10.tests/bin/buildScript++ =================================================================== --- trunk/x10.tests/bin/buildScript++ 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.tests/bin/buildScript++ 2009-08-13 14:18:48 UTC (rev 10972) @@ -129,11 +129,11 @@ POLYGLOT_HOME=$X10_HOME/polyglot svnUpdate $POLYGLOT_HOME $POLYGLOT_SVNROOT -X10_COMMON=$X10_HOME/x10.common.17 +X10_COMMON=$X10_HOME/x10.common svnUpdate $X10_COMMON $X10_SVNROOT X10_COMPILER=$X10_HOME/x10.compiler.p3 svnUpdate $X10_COMPILER $X10_SVNROOT -X10_RUNTIME=$X10_HOME/x10.runtime.17 +X10_RUNTIME=$X10_HOME/x10.runtime svnUpdate $X10_RUNTIME $X10_SVNROOT X10_CONSTRAINTS=$X10_HOME/x10.constraints svnUpdate $X10_CONSTRAINTS $X10_SVNROOT Modified: trunk/x10.tests/bin/buildScriptCT =================================================================== --- trunk/x10.tests/bin/buildScriptCT 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.tests/bin/buildScriptCT 2009-08-13 14:18:48 UTC (rev 10972) @@ -124,7 +124,7 @@ return $status fi - X10_COMMON=$X10_HOME/x10.common.17 + X10_COMMON=$X10_HOME/x10.common if [[ -d $X10_COMMON ]]; then rm -rf $X10_COMMON fi @@ -144,7 +144,7 @@ return $status fi - X10_RUNTIME=$X10_HOME/x10.runtime.17 + X10_RUNTIME=$X10_HOME/x10.runtime if [[ -d $X10_RUNTIME ]]; then rm -rf $X10_RUNTIME fi Modified: trunk/x10.tests/bin/buildScriptCT++ =================================================================== --- trunk/x10.tests/bin/buildScriptCT++ 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.tests/bin/buildScriptCT++ 2009-08-13 14:18:48 UTC (rev 10972) @@ -133,7 +133,7 @@ return $status fi - X10_COMMON=$X10_HOME/x10.common.17 + X10_COMMON=$X10_HOME/x10.common if [[ -d $X10_COMMON ]]; then rm -rf $X10_COMMON fi @@ -153,7 +153,7 @@ return $status fi - X10_RUNTIME=$X10_HOME/x10.runtime.17 + X10_RUNTIME=$X10_HOME/x10.runtime if [[ -d $X10_RUNTIME ]]; then rm -rf $X10_RUNTIME fi @@ -288,7 +288,7 @@ fi if [[ -n "$ENABLE_GC" && -z "$X10GC" ]]; then - export X10GC=${X10_HOME}/x10.runtime.17/src-cpp/bdwgc/install + export X10GC=${X10_HOME}/x10.runtime/src-cpp/bdwgc/install fi main Modified: trunk/x10.tests/bin/driverScript =================================================================== --- trunk/x10.tests/bin/driverScript 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.tests/bin/driverScript 2009-08-13 14:18:48 UTC (rev 10972) @@ -42,7 +42,7 @@ printf "\n##### Begin regression tests: `date` #####\n\n" cd $X10_HOME/x10.tests/examples -export EXTRA_CLASSPATH=$X10_HOME/x10.runtime.17/src-x10/classes +export EXTRA_CLASSPATH=$X10_HOME/x10.runtime/src-x10/classes export X10DIST=$X10_HOME/x10.dist #$X10_HOME/x10.tests/bin/xtestScript -clean -shiftLog -m 'vsa...@us... ny...@us... ig...@us... bd...@us... gr...@us... ta...@us... tib...@us... srk...@li...' $X10_HOME/x10.tests/bin/xtestScript -clean -shiftLog -m 'x10...@li...' Modified: trunk/x10.tests/bin/driverScript++ =================================================================== --- trunk/x10.tests/bin/driverScript++ 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.tests/bin/driverScript++ 2009-08-13 14:18:48 UTC (rev 10972) @@ -35,7 +35,7 @@ #$ABSDIR/xtestScript++ -logPath $LOGD -list 'Misc/*.x10'; #$ABSDIR/xtestScript++ -logPath $LOGD -list 'Benchmarks/*.x10'; #$ABSDIR/xtestScript++ -logPath $LOGD; -export X10LANG=$X10_HOME/x10.runtime.17/src-cpp +export X10LANG=$X10_HOME/x10.runtime/src-cpp ( \ cd $X10_HOME/x10.tests/examples; \ $ABSDIR/xtestScript++ -logPath $LOGD -mailAddr srk...@li... -mailList 'ig...@us... vsa...@us... gr...@us...'; \ Modified: trunk/x10.tests/bin/driverScriptCT =================================================================== --- trunk/x10.tests/bin/driverScriptCT 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.tests/bin/driverScriptCT 2009-08-13 14:18:48 UTC (rev 10972) @@ -246,8 +246,8 @@ ##### cat feed - test (cases) compilation & execution __cat_feed_stage=TEST -#export EXTRA_CLASSPATH=$X10_HOME/x10.runtime.17/src-x10/classes -export EXTRA_CLASSPATH=$X10_HOME/x10.runtime.17/classes/gen +#export EXTRA_CLASSPATH=$X10_HOME/x10.runtime/src-x10/classes +export EXTRA_CLASSPATH=$X10_HOME/x10.runtime/classes/gen if [[ "${__cat_backend}" == x10c ]]; then __cat_extra_classpath=$EXTRA_CLASSPATH else Modified: trunk/x10.tests/bin/driverScriptCT++ =================================================================== --- trunk/x10.tests/bin/driverScriptCT++ 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.tests/bin/driverScriptCT++ 2009-08-13 14:18:48 UTC (rev 10972) @@ -143,12 +143,12 @@ X10LANG=$X10LANG if [[ -z "$X10LANG" ]]; then - export X10LANG=${X10_HOME}/x10.runtime.17/src-cpp + export X10LANG=${X10_HOME}/x10.runtime/src-cpp fi X10GC=$X10GC if [[ -n "$ENABLE_GC" && -z "$X10GC" ]]; then - export X10GC=${X10_HOME}/x10.runtime.17/src-cpp/bdwgc/install + export X10GC=${X10_HOME}/x10.runtime/src-cpp/bdwgc/install fi LOGD=$LOGD @@ -289,8 +289,8 @@ ##### cat feed - test (cases) compilation & execution __cat_feed_stage=TEST -#export EXTRA_CLASSPATH=$X10_HOME/x10.runtime.17/src-x10/classes -export EXTRA_CLASSPATH=$X10_HOME/x10.runtime.17/classes/gen +#export EXTRA_CLASSPATH=$X10_HOME/x10.runtime/src-x10/classes +export EXTRA_CLASSPATH=$X10_HOME/x10.runtime/classes/gen if [[ "${__cat_backend}" == x10c ]]; then __cat_extra_classpath=$EXTRA_CLASSPATH else Modified: trunk/x10.tests/bin/preCompileScript =================================================================== --- trunk/x10.tests/bin/preCompileScript 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.tests/bin/preCompileScript 2009-08-13 14:18:48 UTC (rev 10972) @@ -14,7 +14,7 @@ X10_HOME=$(cd $MYDIR/../..; pwd) fi -X10_RUNTIME=$X10_HOME/x10.runtime.17 +X10_RUNTIME=$X10_HOME/x10.runtime if [[ ! -d $X10_RUNTIME ]]; then printf "[$prog: err]: checkout $X10_RUNTIME and rerun this script!\n" exit 1 Modified: trunk/x10.tests/bin/preCompileScriptCT =================================================================== --- trunk/x10.tests/bin/preCompileScriptCT 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.tests/bin/preCompileScriptCT 2009-08-13 14:18:48 UTC (rev 10972) @@ -14,9 +14,9 @@ export X10_HOME=$(cd $MYDIR/../..; pwd) fi -SRC_X10=$X10_HOME/x10.runtime.17/src-x10 +SRC_X10=$X10_HOME/x10.runtime/src-x10 if [[ ! -d $SRC_X10 ]]; then - printf "[$prog: err]: checkout x10.runtime.17 and rerun this script!\n" + printf "[$prog: err]: checkout x10.runtime and rerun this script!\n" exit 1 fi Modified: trunk/x10.tests/bin/xtestScript++ =================================================================== --- trunk/x10.tests/bin/xtestScript++ 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.tests/bin/xtestScript++ 2009-08-13 14:18:48 UTC (rev 10972) @@ -508,7 +508,7 @@ X10LANG=$X10LANG if [[ -z "$X10LANG" ]]; then - X10LANG=$X10_HOME/x10.runtime.17/src-cpp + X10LANG=$X10_HOME/x10.runtime/src-cpp fi if [[ ! (-f $X10LANG/x10rt17.h || -f $X10LANG/include/x10rt17.h) ]]; then printf "\n[$prog: err]: unable to locate x10rt header files!\n" Modified: trunk/x10.tests/bin/xtestScriptCT++ =================================================================== --- trunk/x10.tests/bin/xtestScriptCT++ 2009-08-13 10:50:24 UTC (rev 10971) +++ trunk/x10.tests/bin/xtestScriptCT++ 2009-08-13 14:18:48 UTC (rev 10972) @@ -601,7 +601,7 @@ X10LANG=$X10LANG if [[ -z "$X10LANG" ]]; then - X10LANG=$X10_HOME/x10.runtime.17/src-cpp + X10LANG=$X10_HOME/x10.runtime/src-cpp fi if [[ ! (-f $X10LANG/x10rt17.h || -f $X10LANG/include/x10rt17.h) ]]; then printf "\n[$prog: err]: unable to locate x10rt header files!\n" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2009-08-13 14:47:22
|
Revision: 10973 http://x10.svn.sourceforge.net/x10/?rev=10973&view=rev Author: dgrove-oss Date: 2009-08-13 14:47:14 +0000 (Thu, 13 Aug 2009) Log Message: ----------- Drop the .p3 suffix from x10.compiler.p3 Modified Paths: -------------- trunk/x10.compiler/.project trunk/x10.compiler/META-INF/MANIFEST.MF trunk/x10.compiler/exportPlugin.xml trunk/x10.compiler/src/x10/parser/X10Parser.java trunk/x10.compiler/src/x10/parser/X10Parserprs.java trunk/x10.compiler/src/x10/parser/X10Parsersym.java trunk/x10.cppbackend.17/.launchConfigs/x10cpp.launch trunk/x10.cppbackend.17/META-INF/MANIFEST.MF trunk/x10.dist/.launchConfigs/x10c.launch trunk/x10.dist/bin/x10c.in trunk/x10.dist/build.xml trunk/x10.dist/releng/exportRelease.sh trunk/x10.tests/bin/buildScript trunk/x10.tests/bin/buildScript++ trunk/x10.tests/bin/buildScriptCT trunk/x10.tests/bin/buildScriptCT++ Added Paths: ----------- trunk/x10.compiler/ Removed Paths: ------------- trunk/x10.compiler.p3/ Modified: trunk/x10.compiler/.project =================================================================== --- trunk/x10.compiler.p3/.project 2009-08-13 14:18:48 UTC (rev 10972) +++ trunk/x10.compiler/.project 2009-08-13 14:47:14 UTC (rev 10973) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <projectDescription> - <name>x10.compiler.p3</name> + <name>x10.compiler</name> <comment></comment> <projects> </projects> Modified: trunk/x10.compiler/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.compiler.p3/META-INF/MANIFEST.MF 2009-08-13 14:18:48 UTC (rev 10972) +++ trunk/x10.compiler/META-INF/MANIFEST.MF 2009-08-13 14:47:14 UTC (rev 10973) @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: X10 compiler -Bundle-SymbolicName: x10.compiler.p3 +Bundle-SymbolicName: x10.compiler Bundle-Version: 1.7.4.0 Bundle-Localization: plugin Require-Bundle: x10.common, Modified: trunk/x10.compiler/exportPlugin.xml =================================================================== --- trunk/x10.compiler.p3/exportPlugin.xml 2009-08-13 14:18:48 UTC (rev 10972) +++ trunk/x10.compiler/exportPlugin.xml 2009-08-13 14:47:14 UTC (rev 10973) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<project name="x10.compiler.p3" default="build.update.jar" basedir="."> +<project name="x10.compiler" default="build.update.jar" basedir="."> <import file="../org.eclipse.imp.x10dt.feature/buildCommon.xml"/> <import file="../org.eclipse.imp.x10dt.update/buildPluginCommon.xml"/> Modified: trunk/x10.compiler/src/x10/parser/X10Parser.java =================================================================== --- trunk/x10.compiler.p3/src/x10/parser/X10Parser.java 2009-08-13 14:18:48 UTC (rev 10972) +++ trunk/x10.compiler/src/x10/parser/X10Parser.java 2009-08-13 14:47:14 UTC (rev 10973) @@ -1,5 +1,5 @@ -//#line 18 "C:/eclipsews/v7/x10.compiler.p3/src/x10/parser/x10.g" +//#line 18 "C:/eclipsews/v7/x10.compiler/src/x10/parser/x10.g" // // Licensed Material // (C) Copyright IBM Corp, 2006 @@ -9,7 +9,7 @@ import lpg.runtime.*; -//#line 28 "C:/eclipsews/v7/x10.compiler.p3/src/x10/parser/x10.g" +//#line 28 "C:/eclipsews/v7/x10.compiler/src/x10/parser/x10.g" import java.util.Arrays; import java.util.ArrayList; import java.util.Collections; @@ -287,7 +287,7 @@ // - //#line 320 "C:/eclipsews/v7/x10.compiler.p3/src/x10/parser/x10.g" + //#line 320 "C:/eclipsews/v7/x10.compiler/src/x10/parser/x10.g" private ErrorQueue eq; private X10TypeSystem ts; private X10NodeFactory nf; @@ -863,7 +863,7 @@ // case 1: { //#line 8 "C:/eclipsews/v7/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 6 "C:/eclipsews/v7/x10.compiler.p3/src/x10/parser/MissingId.gi" + //#line 6 "C:/eclipsews/v7/x10.compiler/src/x10/parser/MissingId.gi" ParsedName TypeName = (ParsedName) getRhsSym(1); //#line 8 "C:/eclipsews/v7/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, @@ -879,7 +879,7 @@ // case 2: { //#line 18 "C:/eclipsews/v7/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 16 "C:/eclipsews/v7/x10.compiler.p3/src/x10/parser/MissingId.gi" + //#line 16 "C:/eclipsews/v7/x10.compiler/src/x10/parser/MissingId.gi" ParsedName PackageName = (ParsedName) getRhsSym(1); //#line 18 "C:/eclipsews/v7/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, @@ -895,7 +895,7 @@ // case 3: { //#line 28 "C:/eclipsews/v7/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 26 "C:/eclipsews/v7/x10.compiler.p3/src/x10/parser/MissingId.gi" + //#line 26 "C:/eclipsews/v7/x10.compiler/src/x10/parser/MissingId.gi" ParsedName AmbiguousName = (ParsedName) getRhsSym(1); //#line 28 "C:/eclipsews/v7/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, @@ -911,7 +911,7 @@ // case 4: { //#line 38 "C:/eclipsews/v7/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 36 "C:/eclipsews/v7/x10.compiler.p3/src/x10/parser/MissingId.gi" + //#line 36 "C:/eclipsews/v7/x10.compiler/src/x10/parser/MissingId.gi" ParsedName AmbiguousName = (ParsedName) getRhsSym(1); //#line 38 "C:/eclipsews/v7/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, @@ -927,7 +927,7 @@ // case 5: { //#line 48 "C:/eclipsews/v7/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 46 "C:/eclipsews/v7/x10.compiler.p3/src/x10/parser/MissingId.gi" + //#line 46 "C:/eclipsews/v7/x10.compiler/src/x10/parser/MissingId.gi" ParsedName PackageOrTypeName = (ParsedName) getRhsSym(1); //#line 48 "C:/eclipsews/v7/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, @@ -943,7 +943,7 @@ // case 6: { //#line 58 "C:/eclipsews/v7/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 56 "C:/eclipsews/v7/x10.compiler.p3/src/x10/parser/MissingId.gi" + //#line 56 "C:/eclipsews/v7/x10.compiler/src/x10/parser/MissingId.gi" ParsedName AmbiguousName = (ParsedName) getRhsSym(1); //#line 58 "C:/eclipsews/v7/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ParsedName(nf, @@ -959,7 +959,7 @@ // case 7: { //#line 68 "C:/eclipsews/v7/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 66 "C:/eclipsews/v7/x10.compiler.p3/src/x10/parser/MissingId.gi" + //#line 66 "C:/eclipsews/v7/x10.compiler/src/x10/parser/MissingId.gi" Expr Primary = (Expr) getRhsSym(1); //#line 68 "C:/eclipsews/v7/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Field(pos(), Primary, @@ -984,9 +984,9 @@ // case 9: { //#line 80 "C:/eclipsews/v7/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 78 "C:/eclipsews/v7/x10.compiler.p3/src/x10/parser/MissingId.gi" + //#line 78 "C:/eclipsews/v7/x10.compiler/src/x10/parser/MissingId.gi" ParsedName ClassName = (ParsedName) getRhsSym(1); - //#line 78 "C:/eclipsews/v7/x10.compiler.p3/src/x10/parser/MissingId.gi" + //#line 78 "C:/eclipsews/v7/x10.compiler/src/x10/parser/MissingId.gi" IToken sup = (IToken) getRhsIToken(3); //#line 80 "C:/eclipsews/v7/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Field(pos(getRightSpan()), nf.Super(pos(getRhsFirstTokenIndex(3)), ClassName.toType()), Modified: trunk/x10.compiler/src/x10/parser/X10Parserprs.java =================================================================== --- trunk/x10.compiler.p3/src/x10/parser/X10Parserprs.java 2009-08-13 14:18:48 UTC (rev 10972) +++ trunk/x10.compiler/src/x10/parser/X10Parserprs.java 2009-08-13 14:47:14 UTC (rev 10973) @@ -1,5 +1,5 @@ -//#line 18 "C:/eclipsews/v7/x10.compiler.p3/src/x10/parser/x10.g" +//#line 18 "C:/eclipsews/v7/x10.compiler/src/x10/parser/x10.g" // // Licensed Material // (C) Copyright IBM Corp, 2006 Modified: trunk/x10.compiler/src/x10/parser/X10Parsersym.java =================================================================== --- trunk/x10.compiler.p3/src/x10/parser/X10Parsersym.java 2009-08-13 14:18:48 UTC (rev 10972) +++ trunk/x10.compiler/src/x10/parser/X10Parsersym.java 2009-08-13 14:47:14 UTC (rev 10973) @@ -1,5 +1,5 @@ -//#line 18 "C:/eclipsews/v7/x10.compiler.p3/src/x10/parser/x10.g" +//#line 18 "C:/eclipsews/v7/x10.compiler/src/x10/parser/x10.g" // // Licensed Material // (C) Copyright IBM Corp, 2006 Modified: trunk/x10.cppbackend.17/.launchConfigs/x10cpp.launch =================================================================== --- trunk/x10.cppbackend.17/.launchConfigs/x10cpp.launch 2009-08-13 14:18:48 UTC (rev 10972) +++ trunk/x10.cppbackend.17/.launchConfigs/x10cpp.launch 2009-08-13 14:47:14 UTC (rev 10973) @@ -6,7 +6,7 @@ <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="x10.backend" path="1" type="4"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.cppbackend.17" type="1"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="lpg.runtime.java" type="1"/> "/> -<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.compiler.p3" type="1"/> "/> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.compiler" type="1"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.constraints" type="1"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.common" type="1"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="polyglot3" type="1"/> "/> Modified: trunk/x10.cppbackend.17/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.cppbackend.17/META-INF/MANIFEST.MF 2009-08-13 14:18:48 UTC (rev 10972) +++ trunk/x10.cppbackend.17/META-INF/MANIFEST.MF 2009-08-13 14:47:14 UTC (rev 10973) @@ -17,6 +17,6 @@ x10c.util Require-Bundle: polyglot3, x10.common, - x10.compiler.p3, + x10.compiler, x10.constraints Bundle-ActivationPolicy: lazy Modified: trunk/x10.dist/.launchConfigs/x10c.launch =================================================================== --- trunk/x10.dist/.launchConfigs/x10c.launch 2009-08-13 14:18:48 UTC (rev 10972) +++ trunk/x10.dist/.launchConfigs/x10c.launch 2009-08-13 14:47:14 UTC (rev 10973) @@ -12,19 +12,19 @@ <listEntry value="org.eclipse.debug.ui.launchGroup.debug"/> </listAttribute> <listAttribute key="org.eclipse.jdt.launching.CLASSPATH"> -<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="x10.compiler.p3" path="1" type="4"/> "/> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="x10.compiler" path="1" type="4"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.pde.core.requiredPlugins" javaProject="polyglot3" path="3" type="4"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.runtime" type="1"/> "/> -<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.compiler.p3" type="1"/> "/> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.compiler" type="1"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.constraints" type="1"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="lpg.runtime.java" type="1"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="polyglot3" type="1"/> "/> -<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento project="x10.compiler.p3"/> </runtimeClasspathEntry> "/> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento project="x10.compiler"/> </runtimeClasspathEntry> "/> </listAttribute> <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="polyglot.main.Main"/> <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-ext x10 "${resource_loc}" -sourcepath "${workspace_loc:x10.runtime/src-x10}" -sourcepath "${workspace_loc:x10.dist}/lib/x10.jar" -sourcepath "${workspace_loc:x10.tests}/examples/x10lib" -noserial -assert -post "javac -source 1.5" -d out -disable CheckNativeAnnotations"/> -<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="x10.compiler.p3"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="x10.compiler"/> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea"/> <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${container_loc}"/> </launchConfiguration> Modified: trunk/x10.dist/bin/x10c.in =================================================================== --- trunk/x10.dist/bin/x10c.in 2009-08-13 14:18:48 UTC (rev 10972) +++ trunk/x10.dist/bin/x10c.in 2009-08-13 14:47:14 UTC (rev 10973) @@ -84,7 +84,7 @@ # HACK!!! HACK!!! HACK!!! ^^^ classpath="${CP_OVERRIDE}" -[ -n "$dev" ] && classpath="${classpath}${TOP}${FILE_SEP}..${FILE_SEP}x10.compiler.p3${FILE_SEP}classes${PATH_SEP}${TOP}${FILE_SEP}..${FILE_SEP}x10.runtime.x10${FILE_SEP}classes${PATH_SEP}${TOP}${FILE_SEP}..${FILE_SEP}polyglot3-dev${FILE_SEP}bin${PATH_SEP}${TOP}${FILE_SEP}classes${PATH_SEP}" +[ -n "$dev" ] && classpath="${classpath}${TOP}${FILE_SEP}..${FILE_SEP}x10.compiler${FILE_SEP}classes${PATH_SEP}${TOP}${FILE_SEP}..${FILE_SEP}x10.runtime.x10${FILE_SEP}classes${PATH_SEP}${TOP}${FILE_SEP}..${FILE_SEP}polyglot3-dev${FILE_SEP}bin${PATH_SEP}${TOP}${FILE_SEP}classes${PATH_SEP}" classpath="${classpath}${LIB_DIR}${FILE_SEP}x10c.jar${PATH_SEP}${LIB_DIR}${FILE_SEP}x10.jar${PATH_SEP}${LIB_DIR}${FILE_SEP}${POLYGLOT_JAR}${PATH_SEP}${LIB_DIR}${FILE_SEP}${LPG_JAR}${ext_cp}${extra_cp}" # include x10.jar in sourcepath Modified: trunk/x10.dist/build.xml =================================================================== --- trunk/x10.dist/build.xml 2009-08-13 14:18:48 UTC (rev 10972) +++ trunk/x10.dist/build.xml 2009-08-13 14:47:14 UTC (rev 10973) @@ -22,7 +22,7 @@ <property name="constraints.jar" value="x10constraints.jar"/> <property name="x10.common.location" location="${x10.home}/x10.common"/> <property name="common.jar" value="x10common.jar"/> - <property name="x10.compiler.location" location="${x10.home}/x10.compiler.p3"/> + <property name="x10.compiler.location" location="${x10.home}/x10.compiler"/> <property name="x10.cppbackend.location" location="${x10.home}/x10.cppbackend.17"/> <property name="compiler.jar" value="x10c.jar"/> <property name="cppbackend.jar" value="x10cpp.jar"/> @@ -427,7 +427,7 @@ <zipfileset prefix="" dir="${basedir}" includes="epl-v10.html,RELEASE.NOTES,BUILD"/> <zipfileset prefix="" dir="${x10.tests.location}" includes="TESTING"/> <zipfileset prefix="x10.dist" dir="${basedir}" excludes="releng/**,**/.*.swp,lib/**,etc/**" includes=".launchConfigs/*,.classpath,.project,README,INSTALL,build*,exportPlugin.xml,bin/*.in,bin/x10c++,lib/${polyglot.jar},lib/${lpg.jar},lib/${ecj.jar},samples/**"/> - <zipfileset prefix="x10.compiler.p3" dir="${x10.compiler.location}" excludes="releng/**,**/.*.swp,classes/**"/> + <zipfileset prefix="x10.compiler" dir="${x10.compiler.location}" excludes="releng/**,**/.*.swp,classes/**"/> <zipfileset prefix="x10.cppbackend.17" dir="${x10.cppbackend.location}" excludes="releng/**,**/.*.swp,classes/**"/> <zipfileset prefix="x10.runtime" dir="${x10.runtime.location}" excludes="releng/**,**/.*.swp,classes/**,src-cpp/gen/**"/> <zipfileset prefix="x10.constraints" dir="${x10.constraints.location}" excludes="releng/**,**/.*.swp,classes/**"/> Modified: trunk/x10.dist/releng/exportRelease.sh =================================================================== --- trunk/x10.dist/releng/exportRelease.sh 2009-08-13 14:18:48 UTC (rev 10972) +++ trunk/x10.dist/releng/exportRelease.sh 2009-08-13 14:47:14 UTC (rev 10973) @@ -72,7 +72,7 @@ echo getting distrib for i in \ x10.common \ - x10.compiler.p3 \ + x10.compiler \ x10.constraints \ x10.cppbackend.17 \ x10.dist \ Modified: trunk/x10.tests/bin/buildScript =================================================================== --- trunk/x10.tests/bin/buildScript 2009-08-13 14:18:48 UTC (rev 10972) +++ trunk/x10.tests/bin/buildScript 2009-08-13 14:47:14 UTC (rev 10973) @@ -127,7 +127,7 @@ svnUpdate $POLYGLOT_HOME $POLYGLOT_SVNROOT X10_COMMON=$X10_HOME/x10.common svnUpdate $X10_COMMON $X10_SVNROOT -X10_COMPILER=$X10_HOME/x10.compiler.p3 +X10_COMPILER=$X10_HOME/x10.compiler svnUpdate $X10_COMPILER $X10_SVNROOT X10_RUNTIME=$X10_HOME/x10.runtime svnUpdate $X10_RUNTIME $X10_SVNROOT Modified: trunk/x10.tests/bin/buildScript++ =================================================================== --- trunk/x10.tests/bin/buildScript++ 2009-08-13 14:18:48 UTC (rev 10972) +++ trunk/x10.tests/bin/buildScript++ 2009-08-13 14:47:14 UTC (rev 10973) @@ -131,7 +131,7 @@ svnUpdate $POLYGLOT_HOME $POLYGLOT_SVNROOT X10_COMMON=$X10_HOME/x10.common svnUpdate $X10_COMMON $X10_SVNROOT -X10_COMPILER=$X10_HOME/x10.compiler.p3 +X10_COMPILER=$X10_HOME/x10.compiler svnUpdate $X10_COMPILER $X10_SVNROOT X10_RUNTIME=$X10_HOME/x10.runtime svnUpdate $X10_RUNTIME $X10_SVNROOT Modified: trunk/x10.tests/bin/buildScriptCT =================================================================== --- trunk/x10.tests/bin/buildScriptCT 2009-08-13 14:18:48 UTC (rev 10972) +++ trunk/x10.tests/bin/buildScriptCT 2009-08-13 14:47:14 UTC (rev 10973) @@ -134,7 +134,7 @@ return $status fi - X10_COMPILER=$X10_HOME/x10.compiler.p3 + X10_COMPILER=$X10_HOME/x10.compiler if [[ -d $X10_COMPILER ]]; then rm -rf $X10_COMPILER fi Modified: trunk/x10.tests/bin/buildScriptCT++ =================================================================== --- trunk/x10.tests/bin/buildScriptCT++ 2009-08-13 14:18:48 UTC (rev 10972) +++ trunk/x10.tests/bin/buildScriptCT++ 2009-08-13 14:47:14 UTC (rev 10973) @@ -143,7 +143,7 @@ return $status fi - X10_COMPILER=$X10_HOME/x10.compiler.p3 + X10_COMPILER=$X10_HOME/x10.compiler if [[ -d $X10_COMPILER ]]; then rm -rf $X10_COMPILER fi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2009-08-13 15:29:55
|
Revision: 10974 http://x10.svn.sourceforge.net/x10/?rev=10974&view=rev Author: dgrove-oss Date: 2009-08-13 15:29:43 +0000 (Thu, 13 Aug 2009) Log Message: ----------- Merge the the x10.cppbackend.17 project into x10.compiler. Modified Paths: -------------- trunk/x10.compiler/build.xml trunk/x10.dist/bin/x10c++ trunk/x10.dist/build.xml trunk/x10.dist/releng/exportRelease.sh trunk/x10.runtime/src-cpp/Makefile trunk/x10.tests/bin/buildScript++ trunk/x10.tests/bin/buildScriptCT++ Added Paths: ----------- trunk/x10.compiler/data/MainMP.xcd trunk/x10.compiler/src/polyglot/ext/x10cpp/ trunk/x10.compiler/src/polyglot/ext/x10cuda/ trunk/x10.compiler/src/x10c/ trunk/x10.dist/.launchConfigs/x10cpp.launch Removed Paths: ------------- trunk/x10.cppbackend.17/.launchConfigs/x10cpp.launch trunk/x10.cppbackend.17/data/Main.xcd trunk/x10.cppbackend.17/data/MainMP.xcd trunk/x10.cppbackend.17/src/polyglot/ext/x10cpp/ trunk/x10.cppbackend.17/src/polyglot/ext/x10cuda/ trunk/x10.cppbackend.17/src/x10c/ Modified: trunk/x10.compiler/build.xml =================================================================== --- trunk/x10.compiler/build.xml 2009-08-13 14:47:14 UTC (rev 10973) +++ trunk/x10.compiler/build.xml 2009-08-13 15:29:43 UTC (rev 10974) @@ -66,7 +66,7 @@ </target> <target name="jar" depends="build"> <jar jarfile="${build}/${jar}"> - <fileset dir="${build}" includes="org/**,polyglot/ext/x10/**,x10/parser/**,x10/emitter/**,x10/utils/**,data/**" excludes="${jar}"/> + <fileset dir="${build}" includes="org/**,polyglot/ext/x10/**,polyglot/ext/x10cpp/**,x10/parser/**,x10/emitter/**,x10/utils/**,x10c/**,data/**" excludes="${jar}"/> <fileset dir="${x10.constraints.location}/classes" includes="x10/constraint/**" excludes="x10/constraint/test/**"/> <fileset dir="${x10.common.location}/classes" includes="x10/**"/> </jar> Copied: trunk/x10.compiler/data/MainMP.xcd (from rev 10973, trunk/x10.cppbackend.17/data/MainMP.xcd) =================================================================== --- trunk/x10.compiler/data/MainMP.xcd (rev 0) +++ trunk/x10.compiler/data/MainMP.xcd 2009-08-13 15:29:43 UTC (rev 10974) @@ -0,0 +1,9 @@ +// SYNOPSIS: #0.main(...) + +##include <x10/runtime/Runtime.h> +##include <x10aux/bootstrap.h> +extern "C" { int main(int ac, char **av) { return x10aux::template_main<x10::runtime::Runtime,#0 >(ac,av); } } + + +// the original app-main method + Deleted: trunk/x10.cppbackend.17/.launchConfigs/x10cpp.launch =================================================================== --- trunk/x10.cppbackend.17/.launchConfigs/x10cpp.launch 2009-08-13 14:47:14 UTC (rev 10973) +++ trunk/x10.cppbackend.17/.launchConfigs/x10cpp.launch 2009-08-13 15:29:43 UTC (rev 10974) @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication"> -<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/> -<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="polyglot.ext.x10cpp.main.Main"/> -<listAttribute key="org.eclipse.jdt.launching.CLASSPATH"> -<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="x10.backend" path="1" type="4"/> "/> -<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.cppbackend.17" type="1"/> "/> -<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="lpg.runtime.java" type="1"/> "/> -<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.compiler" type="1"/> "/> -<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.constraints" type="1"/> "/> -<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.common" type="1"/> "/> -<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="polyglot3" type="1"/> "/> -</listAttribute> -<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-ext x10cpp ${resource_loc} -sourcepath ${project_loc:x10.runtime}/src-x10 -noserial -assert -d out -disable CheckNativeAnnotations -commandlineonly ${project_loc:x10.tests}/examples/x10lib/harness/x10Test.x10"/> -<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="x10.cppbackend.17"/> -<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea"/> -<listAttribute key="org.eclipse.debug.ui.favoriteGroups"> -<listEntry value="org.eclipse.debug.ui.launchGroup.run"/> -<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/> -</listAttribute> -<mapAttribute key="org.eclipse.debug.core.environmentVariables"> -<mapEntry key="X10LIB" value="${project_loc:x10.cppbackend.17}/../pgas/common/work"/> -<mapEntry key="X10LANG" value="${project_loc:x10.runtime}/src-cpp"/> -</mapAttribute> -<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${container_loc}"/> -<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> -</launchConfiguration> Deleted: trunk/x10.cppbackend.17/data/Main.xcd =================================================================== --- trunk/x10.cppbackend.17/data/Main.xcd 2009-08-13 14:47:14 UTC (rev 10973) +++ trunk/x10.cppbackend.17/data/Main.xcd 2009-08-13 15:29:43 UTC (rev 10974) @@ -1,26 +0,0 @@ -// SYNOPSIS: #0.main(...) - -extern "C" { - int main(int ac, char **av) { - ref<Rail<x10aux::ref<String> > > args = x10aux::convert_args(ac, av); - try { - x10::runtime::Runtime::start( - new (x10aux::alloc<VoidFun>(sizeof(BootStrapClosure))) - x10aux::BootStrapClosure(#0::main,args) ); - } catch(int exitCode) { - x10aux::exitCode = exitCode; - } catch(x10aux::__ref& e) { - fprintf(stderr, "%d: ", (int)__here__); - //fprintf(stderr, "Caught %p\n", ((const x10aux::ref<Exception>&)e)._val); - ((const x10aux::ref<Exception>&)e)->printStackTrace(System::x10__out); - x10aux::exitCode = 1; - } catch(...) { - fprintf(stderr, "%d: Caught exception\n", (int)__here__); - x10aux::exitCode = 1; - } - x10aux::free_args(args); - return x10aux::exitCode; - } -} -// the original app-main method - Deleted: trunk/x10.cppbackend.17/data/MainMP.xcd =================================================================== --- trunk/x10.cppbackend.17/data/MainMP.xcd 2009-08-13 14:47:14 UTC (rev 10973) +++ trunk/x10.cppbackend.17/data/MainMP.xcd 2009-08-13 15:29:43 UTC (rev 10974) @@ -1,9 +0,0 @@ -// SYNOPSIS: #0.main(...) - -##include <x10/runtime/Runtime.h> -##include <x10aux/bootstrap.h> -extern "C" { int main(int ac, char **av) { return x10aux::template_main<x10::runtime::Runtime,#0 >(ac,av); } } - - -// the original app-main method - Copied: trunk/x10.dist/.launchConfigs/x10cpp.launch (from rev 10973, trunk/x10.cppbackend.17/.launchConfigs/x10cpp.launch) =================================================================== --- trunk/x10.dist/.launchConfigs/x10cpp.launch (rev 0) +++ trunk/x10.dist/.launchConfigs/x10cpp.launch 2009-08-13 15:29:43 UTC (rev 10974) @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication"> +<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/> +<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="polyglot.ext.x10cpp.main.Main"/> +<listAttribute key="org.eclipse.jdt.launching.CLASSPATH"> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="x10.backend" path="1" type="4"/> "/> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="lpg.runtime.java" type="1"/> "/> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.compiler" type="1"/> "/> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.constraints" type="1"/> "/> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="x10.common" type="1"/> "/> +<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="polyglot3" type="1"/> "/> +</listAttribute> +<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-ext x10cpp ${resource_loc} -sourcepath ${project_loc:x10.runtime}/src-x10 -noserial -assert -d out -disable CheckNativeAnnotations -commandlineonly ${project_loc:x10.tests}/examples/x10lib/harness/x10Test.x10"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="x10.compiler"/> +<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea"/> +<listAttribute key="org.eclipse.debug.ui.favoriteGroups"> +<listEntry value="org.eclipse.debug.ui.launchGroup.run"/> +<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/> +</listAttribute> +<mapAttribute key="org.eclipse.debug.core.environmentVariables"> +<mapEntry key="X10LIB" value="${project_loc:x10.compiler}/../pgas/common/work"/> +<mapEntry key="X10LANG" value="${project_loc:x10.runtime}/src-cpp"/> +</mapAttribute> +<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${container_loc}"/> +<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> +</launchConfiguration> Modified: trunk/x10.dist/bin/x10c++ =================================================================== --- trunk/x10.dist/bin/x10c++ 2009-08-13 14:47:14 UTC (rev 10973) +++ trunk/x10.dist/bin/x10c++ 2009-08-13 15:29:43 UTC (rev 10974) @@ -30,7 +30,7 @@ fi -export CP_OVERRIDE="${TOP}${FILE_SEP}lib${FILE_SEP}x10cpp.jar${PATH_SEP}${TOP}${FILE_SEP}classes${PATH_SEP}" +export CP_OVERRIDE="${TOP}${FILE_SEP}lib${FILE_SEP}x10c.jar${PATH_SEP}${TOP}${FILE_SEP}classes${PATH_SEP}" export DEXT="x10cpp" export MAIN="polyglot.ext.x10cpp.main.Main" Modified: trunk/x10.dist/build.xml =================================================================== --- trunk/x10.dist/build.xml 2009-08-13 14:47:14 UTC (rev 10973) +++ trunk/x10.dist/build.xml 2009-08-13 15:29:43 UTC (rev 10974) @@ -23,9 +23,7 @@ <property name="x10.common.location" location="${x10.home}/x10.common"/> <property name="common.jar" value="x10common.jar"/> <property name="x10.compiler.location" location="${x10.home}/x10.compiler"/> - <property name="x10.cppbackend.location" location="${x10.home}/x10.cppbackend.17"/> <property name="compiler.jar" value="x10c.jar"/> - <property name="cppbackend.jar" value="x10cpp.jar"/> <property name="config" value="standard.cfg"/> <property name="x10.runtime.location" location="${x10.home}/x10.runtime"/> <property name="runtime.jar" value="x10.jar"/> @@ -72,11 +70,10 @@ <ant antfile="${x10.common.location}/build.xml" target="clean" inheritAll="false" dir="${x10.common.location}"/> <ant antfile="${x10.runtime.location}/build.xml" target="clean" inheritAll="false" dir="${x10.runtime.location}"/> <ant antfile="${x10.compiler.location}/build.xml" target="clean" inheritAll="false" dir="${x10.compiler.location}"/> - <ant antfile="${x10.cppbackend.location}/build.xml" target="clean" inheritAll="false" dir="${x10.cppbackend.location}"/> </target> <target name="dist-java" depends="init,build,common-jar,constraints-jar,compiler-jar,runtime-java"/> - <target name="dist-cpp" depends="dist-java,cppbackend-jar,runtime-cpp"/> + <target name="dist-cpp" depends="dist-java,runtime-cpp"/> <target name="dist" depends="dist-java,dist-cpp"/> <target name="lpg-jar" depends="init,lpg-local-jar" unless="local.lpg.jar"> @@ -171,14 +168,6 @@ </copy> </target> - <target name="cppbackend-jar" depends="init,compiler-jar"> - <ant antfile="${x10.cppbackend.location}/build.xml" target="jar" inheritAll="false" dir="${x10.cppbackend.location}"/> - <mkdir dir="${lib}"/> - <copy todir="${lib}"> - <fileset dir="${x10.cppbackend.location}/${builddir}" includes="${cppbackend.jar}"/> - </copy> - </target> - <target name="bin" description="configure bin directory" depends="bin-deps" @@ -428,7 +417,6 @@ <zipfileset prefix="" dir="${x10.tests.location}" includes="TESTING"/> <zipfileset prefix="x10.dist" dir="${basedir}" excludes="releng/**,**/.*.swp,lib/**,etc/**" includes=".launchConfigs/*,.classpath,.project,README,INSTALL,build*,exportPlugin.xml,bin/*.in,bin/x10c++,lib/${polyglot.jar},lib/${lpg.jar},lib/${ecj.jar},samples/**"/> <zipfileset prefix="x10.compiler" dir="${x10.compiler.location}" excludes="releng/**,**/.*.swp,classes/**"/> - <zipfileset prefix="x10.cppbackend.17" dir="${x10.cppbackend.location}" excludes="releng/**,**/.*.swp,classes/**"/> <zipfileset prefix="x10.runtime" dir="${x10.runtime.location}" excludes="releng/**,**/.*.swp,classes/**,src-cpp/gen/**"/> <zipfileset prefix="x10.constraints" dir="${x10.constraints.location}" excludes="releng/**,**/.*.swp,classes/**"/> <zipfileset prefix="x10.common" dir="${x10.common.location}" excludes="releng/**,**/.*.swp,classes/**"/> Modified: trunk/x10.dist/releng/exportRelease.sh =================================================================== --- trunk/x10.dist/releng/exportRelease.sh 2009-08-13 14:47:14 UTC (rev 10973) +++ trunk/x10.dist/releng/exportRelease.sh 2009-08-13 15:29:43 UTC (rev 10974) @@ -74,7 +74,6 @@ x10.common \ x10.compiler \ x10.constraints \ - x10.cppbackend.17 \ x10.dist \ x10.runtime \ x10.tests Modified: trunk/x10.runtime/src-cpp/Makefile =================================================================== --- trunk/x10.runtime/src-cpp/Makefile 2009-08-13 14:47:14 UTC (rev 10973) +++ trunk/x10.runtime/src-cpp/Makefile 2009-08-13 15:29:43 UTC (rev 10974) @@ -134,7 +134,7 @@ # this simply means there will be more symbols in the archive than there should # be. This is harmless and equivalent to the old behaviour of this Makefile, # i.e. a make clean is needed. -gen/all-cpp-generated: $(XRXFILES) $(INSTDIR)/lib/x10cpp.jar +gen/all-cpp-generated: $(XRXFILES) $(INSTDIR)/lib/x10c.jar @echo "Regenerating XRX cc/h/inc files" mkdir -p gen @#prune .svn dirs (they probably don't contain *.x10 files so this is just an optimisation) Modified: trunk/x10.tests/bin/buildScript++ =================================================================== --- trunk/x10.tests/bin/buildScript++ 2009-08-13 14:47:14 UTC (rev 10973) +++ trunk/x10.tests/bin/buildScript++ 2009-08-13 15:29:43 UTC (rev 10974) @@ -141,8 +141,7 @@ svnUpdate $X10_DIST $X10_SVNROOT X10_TESTS=$X10_HOME/x10.tests svnUpdate $X10_TESTS $X10_SVNROOT -X10_CPP=$X10_HOME/x10.cppbackend.17 -svnUpdate $X10_CPP $X10_SVNROOT +svnUpdate $X10_SVNROOT buildX10Module $POLYGLOT_HOME polyglot @@ -152,7 +151,6 @@ buildX10Module $X10_DIST x10j buildX10Module $X10_COMPILER x10 buildX10Module $X10_TESTS x10 -buildX10Module $X10_CPP x10 X10LIB=$X10LIB if [[ -z "$X10LIB" ]]; then Modified: trunk/x10.tests/bin/buildScriptCT++ =================================================================== --- trunk/x10.tests/bin/buildScriptCT++ 2009-08-13 14:47:14 UTC (rev 10973) +++ trunk/x10.tests/bin/buildScriptCT++ 2009-08-13 15:29:43 UTC (rev 10974) @@ -200,16 +200,6 @@ return $status fi - X10_CPP=$X10_HOME/x10.cppbackend.17 - if [[ -d $X10_CPP ]]; then - rm -rf $X10_CPP - fi - svnUpdate $X10_CPP $X10_SVNROOT - status=$? - if (( $status != 0 )); then - return $status - fi - # build modules in the listed order -- some builds may be redundant buildX10Module $POLYGLOT_HOME polyglot status=$? @@ -245,12 +235,6 @@ return $status fi - buildX10Module $X10_CPP x10 - status=$? - if (( $status != 0 )); then - return $status - fi - if [[ -n "$X10GC" ]]; then export INCLUDE_DIRS=-I${X10GC}/include fi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2009-08-13 16:22:42
|
Revision: 10976 http://x10.svn.sourceforge.net/x10/?rev=10976&view=rev Author: dgrove-oss Date: 2009-08-13 16:22:31 +0000 (Thu, 13 Aug 2009) Log Message: ----------- Remove polyglot.ext package prefix Modified Paths: -------------- trunk/x10.compiler/META-INF/MANIFEST.MF trunk/x10.compiler/build.xml trunk/x10.compiler/src/x10/ast/AddFlags.java trunk/x10.compiler/src/x10/ast/AmbDepTypeNode.java trunk/x10.compiler/src/x10/ast/AmbDepTypeNode_c.java trunk/x10.compiler/src/x10/ast/AmbMacroTypeNode.java trunk/x10.compiler/src/x10/ast/AmbMacroTypeNode_c.java trunk/x10.compiler/src/x10/ast/AnnotationNode.java trunk/x10.compiler/src/x10/ast/AnnotationNode_c.java trunk/x10.compiler/src/x10/ast/AssignPropertyBody.java trunk/x10.compiler/src/x10/ast/AssignPropertyBody_c.java trunk/x10.compiler/src/x10/ast/AssignPropertyCall.java trunk/x10.compiler/src/x10/ast/AssignPropertyCall_c.java trunk/x10.compiler/src/x10/ast/Async.java trunk/x10.compiler/src/x10/ast/Async_c.java trunk/x10.compiler/src/x10/ast/AtEach.java trunk/x10.compiler/src/x10/ast/AtEach_c.java trunk/x10.compiler/src/x10/ast/AtExpr.java trunk/x10.compiler/src/x10/ast/AtExpr_c.java trunk/x10.compiler/src/x10/ast/AtStmt.java trunk/x10.compiler/src/x10/ast/AtStmt_c.java trunk/x10.compiler/src/x10/ast/Atomic.java trunk/x10.compiler/src/x10/ast/Atomic_c.java trunk/x10.compiler/src/x10/ast/Await.java trunk/x10.compiler/src/x10/ast/Await_c.java trunk/x10.compiler/src/x10/ast/Clocked.java trunk/x10.compiler/src/x10/ast/Closure.java trunk/x10.compiler/src/x10/ast/ClosureCall.java trunk/x10.compiler/src/x10/ast/ClosureCall_c.java trunk/x10.compiler/src/x10/ast/Closure_c.java trunk/x10.compiler/src/x10/ast/ConstantDistMaker.java trunk/x10.compiler/src/x10/ast/ConstantDistMaker_c.java trunk/x10.compiler/src/x10/ast/Contains.java trunk/x10.compiler/src/x10/ast/Contains_c.java trunk/x10.compiler/src/x10/ast/DepParameterExpr.java trunk/x10.compiler/src/x10/ast/DepParameterExpr_c.java trunk/x10.compiler/src/x10/ast/Finish.java trunk/x10.compiler/src/x10/ast/Finish_c.java trunk/x10.compiler/src/x10/ast/ForEach.java trunk/x10.compiler/src/x10/ast/ForEach_c.java trunk/x10.compiler/src/x10/ast/ForLoop.java trunk/x10.compiler/src/x10/ast/ForLoop_c.java trunk/x10.compiler/src/x10/ast/FunctionTypeNode.java trunk/x10.compiler/src/x10/ast/FunctionTypeNode_c.java trunk/x10.compiler/src/x10/ast/Future.java trunk/x10.compiler/src/x10/ast/Future_c.java trunk/x10.compiler/src/x10/ast/Here.java trunk/x10.compiler/src/x10/ast/Here_c.java trunk/x10.compiler/src/x10/ast/LocalTypeDef.java trunk/x10.compiler/src/x10/ast/LocalTypeDef_c.java trunk/x10.compiler/src/x10/ast/Next.java trunk/x10.compiler/src/x10/ast/Next_c.java trunk/x10.compiler/src/x10/ast/Now.java trunk/x10.compiler/src/x10/ast/Now_c.java trunk/x10.compiler/src/x10/ast/ParExpr.java trunk/x10.compiler/src/x10/ast/ParExpr_c.java trunk/x10.compiler/src/x10/ast/PlaceCast.java trunk/x10.compiler/src/x10/ast/PlaceCast_c.java trunk/x10.compiler/src/x10/ast/Point.java trunk/x10.compiler/src/x10/ast/PropertyDecl.java trunk/x10.compiler/src/x10/ast/PropertyDecl_c.java trunk/x10.compiler/src/x10/ast/Range.java trunk/x10.compiler/src/x10/ast/Range_c.java trunk/x10.compiler/src/x10/ast/Region.java trunk/x10.compiler/src/x10/ast/RegionMaker.java trunk/x10.compiler/src/x10/ast/RegionMaker_c.java trunk/x10.compiler/src/x10/ast/Region_c.java trunk/x10.compiler/src/x10/ast/RemoteActivityInvocation.java trunk/x10.compiler/src/x10/ast/SemanticError.java trunk/x10.compiler/src/x10/ast/Settable.java trunk/x10.compiler/src/x10/ast/SettableAssign.java trunk/x10.compiler/src/x10/ast/SettableAssign_c.java trunk/x10.compiler/src/x10/ast/StmtSeq.java trunk/x10.compiler/src/x10/ast/StmtSeq_c.java trunk/x10.compiler/src/x10/ast/SubtypeTest.java trunk/x10.compiler/src/x10/ast/SubtypeTest_c.java trunk/x10.compiler/src/x10/ast/Tuple.java trunk/x10.compiler/src/x10/ast/Tuple_c.java trunk/x10.compiler/src/x10/ast/TypeAssign.java trunk/x10.compiler/src/x10/ast/TypeCheckExprGoal.java trunk/x10.compiler/src/x10/ast/TypeCheckReturnTypeGoal.java trunk/x10.compiler/src/x10/ast/TypeDecl.java trunk/x10.compiler/src/x10/ast/TypeDecl_c.java trunk/x10.compiler/src/x10/ast/TypeParamNode.java trunk/x10.compiler/src/x10/ast/TypeParamNode_c.java trunk/x10.compiler/src/x10/ast/UnknownTypeNode.java trunk/x10.compiler/src/x10/ast/UnknownTypeNode_c.java trunk/x10.compiler/src/x10/ast/When.java trunk/x10.compiler/src/x10/ast/When_c.java trunk/x10.compiler/src/x10/ast/X10AmbAssign_c.java trunk/x10.compiler/src/x10/ast/X10AmbQualifierNode.java trunk/x10.compiler/src/x10/ast/X10AmbQualifierNode_c.java trunk/x10.compiler/src/x10/ast/X10AmbTypeNode.java trunk/x10.compiler/src/x10/ast/X10AmbTypeNode_c.java trunk/x10.compiler/src/x10/ast/X10Binary.java trunk/x10.compiler/src/x10/ast/X10Binary_c.java trunk/x10.compiler/src/x10/ast/X10BooleanLit_c.java trunk/x10.compiler/src/x10/ast/X10Boxed_c.java trunk/x10.compiler/src/x10/ast/X10Call.java trunk/x10.compiler/src/x10/ast/X10Call_c.java trunk/x10.compiler/src/x10/ast/X10CanonicalTypeNode.java trunk/x10.compiler/src/x10/ast/X10CanonicalTypeNode_c.java trunk/x10.compiler/src/x10/ast/X10Cast.java trunk/x10.compiler/src/x10/ast/X10CastInfo.java trunk/x10.compiler/src/x10/ast/X10Cast_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.java trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java trunk/x10.compiler/src/x10/ast/X10ClockedLoop.java trunk/x10.compiler/src/x10/ast/X10ClockedLoop_c.java trunk/x10.compiler/src/x10/ast/X10Conditional.java trunk/x10.compiler/src/x10/ast/X10Conditional_c.java trunk/x10.compiler/src/x10/ast/X10ConstructorCall.java trunk/x10.compiler/src/x10/ast/X10ConstructorCall_c.java trunk/x10.compiler/src/x10/ast/X10ConstructorDecl.java trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java trunk/x10.compiler/src/x10/ast/X10DelFactory_c.java trunk/x10.compiler/src/x10/ast/X10DepCastInfo.java trunk/x10.compiler/src/x10/ast/X10Disamb_c.java trunk/x10.compiler/src/x10/ast/X10Do_c.java trunk/x10.compiler/src/x10/ast/X10ExtFactory_c.java trunk/x10.compiler/src/x10/ast/X10FieldAssign_c.java trunk/x10.compiler/src/x10/ast/X10FieldDecl.java trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java trunk/x10.compiler/src/x10/ast/X10Field_c.java trunk/x10.compiler/src/x10/ast/X10FloatLit_c.java trunk/x10.compiler/src/x10/ast/X10Formal.java trunk/x10.compiler/src/x10/ast/X10Formal_c.java trunk/x10.compiler/src/x10/ast/X10If_c.java trunk/x10.compiler/src/x10/ast/X10Initializer_c.java trunk/x10.compiler/src/x10/ast/X10Instanceof.java trunk/x10.compiler/src/x10/ast/X10Instanceof_c.java trunk/x10.compiler/src/x10/ast/X10IntLit_c.java trunk/x10.compiler/src/x10/ast/X10LocalAssign_c.java trunk/x10.compiler/src/x10/ast/X10LocalDecl_c.java trunk/x10.compiler/src/x10/ast/X10Local_c.java trunk/x10.compiler/src/x10/ast/X10Loop.java trunk/x10.compiler/src/x10/ast/X10Loop_c.java trunk/x10.compiler/src/x10/ast/X10MLSourceFile.java trunk/x10.compiler/src/x10/ast/X10MLSourceFile_c.java trunk/x10.compiler/src/x10/ast/X10MethodDecl.java trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java trunk/x10.compiler/src/x10/ast/X10New.java trunk/x10.compiler/src/x10/ast/X10New_c.java trunk/x10.compiler/src/x10/ast/X10NodeFactory.java trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java trunk/x10.compiler/src/x10/ast/X10ProcedureCall.java trunk/x10.compiler/src/x10/ast/X10Return_c.java trunk/x10.compiler/src/x10/ast/X10SourceFile_c.java trunk/x10.compiler/src/x10/ast/X10Special.java trunk/x10.compiler/src/x10/ast/X10Special_c.java trunk/x10.compiler/src/x10/ast/X10StringLit_c.java trunk/x10.compiler/src/x10/ast/X10Unary_c.java trunk/x10.compiler/src/x10/ast/X10VarDecl.java trunk/x10.compiler/src/x10/ast/X10While_c.java trunk/x10.compiler/src/x10/emitter/Emitter.java trunk/x10.compiler/src/x10/emitter/Expander.java trunk/x10.compiler/src/x10/emitter/Inline.java trunk/x10.compiler/src/x10/emitter/Join.java trunk/x10.compiler/src/x10/emitter/Loop.java trunk/x10.compiler/src/x10/emitter/RuntimeTypeExpander.java trunk/x10.compiler/src/x10/emitter/Template.java trunk/x10.compiler/src/x10/emitter/TypeExpander.java trunk/x10.compiler/src/x10/extension/X10ClassBodyExt_c.java trunk/x10.compiler/src/x10/extension/X10Del.java trunk/x10.compiler/src/x10/extension/X10Del_c.java trunk/x10.compiler/src/x10/extension/X10Ext.java trunk/x10.compiler/src/x10/extension/X10Ext_c.java trunk/x10.compiler/src/x10/parser/X10ParsedName.java trunk/x10.compiler/src/x10/parser/X10Parser.java trunk/x10.compiler/src/x10/parser/X10VarDeclarator.java trunk/x10.compiler/src/x10/parser/x10.g trunk/x10.compiler/src/x10/plugin/CompilerPlugin.java trunk/x10.compiler/src/x10/plugin/LoadJobPlugins.java trunk/x10.compiler/src/x10/plugin/LoadPlugins.java trunk/x10.compiler/src/x10/plugin/RegisterPlugins.java trunk/x10.compiler/src/x10/query/QueryEngine.java trunk/x10.compiler/src/x10/types/AnnotatedType.java trunk/x10.compiler/src/x10/types/AnnotatedType_c.java trunk/x10.compiler/src/x10/types/ClosureDef.java trunk/x10.compiler/src/x10/types/ClosureDef_c.java trunk/x10.compiler/src/x10/types/ClosureInstance.java trunk/x10.compiler/src/x10/types/ClosureInstance_c.java trunk/x10.compiler/src/x10/types/ClosureType.java trunk/x10.compiler/src/x10/types/ClosureType_c.java trunk/x10.compiler/src/x10/types/ConstrainedType.java trunk/x10.compiler/src/x10/types/ConstrainedType_c.java trunk/x10.compiler/src/x10/types/MacroType.java trunk/x10.compiler/src/x10/types/MacroType_c.java trunk/x10.compiler/src/x10/types/ParameterType.java trunk/x10.compiler/src/x10/types/ParameterType_c.java trunk/x10.compiler/src/x10/types/ParametrizedType.java trunk/x10.compiler/src/x10/types/ParametrizedType_c.java trunk/x10.compiler/src/x10/types/Subst.java trunk/x10.compiler/src/x10/types/SubtypeConstraint.java trunk/x10.compiler/src/x10/types/SubtypeConstraint_c.java trunk/x10.compiler/src/x10/types/TypeConstraint.java trunk/x10.compiler/src/x10/types/TypeConstraint_c.java trunk/x10.compiler/src/x10/types/TypeDef.java trunk/x10.compiler/src/x10/types/TypeDefAsMacroTypeTransform.java trunk/x10.compiler/src/x10/types/TypeDef_c.java trunk/x10.compiler/src/x10/types/TypeParamSubst.java trunk/x10.compiler/src/x10/types/X10ArrayType.java trunk/x10.compiler/src/x10/types/X10ArrayType_c.java trunk/x10.compiler/src/x10/types/X10ArraysMixin.java trunk/x10.compiler/src/x10/types/X10ClassDef.java trunk/x10.compiler/src/x10/types/X10ClassDef_c.java trunk/x10.compiler/src/x10/types/X10ClassType.java trunk/x10.compiler/src/x10/types/X10ConstructorDef.java trunk/x10.compiler/src/x10/types/X10ConstructorDef_c.java trunk/x10.compiler/src/x10/types/X10ConstructorInstance.java trunk/x10.compiler/src/x10/types/X10ConstructorInstance_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/X10Def.java trunk/x10.compiler/src/x10/types/X10FieldDef.java trunk/x10.compiler/src/x10/types/X10FieldDef_c.java trunk/x10.compiler/src/x10/types/X10FieldInstance.java trunk/x10.compiler/src/x10/types/X10FieldInstance_c.java trunk/x10.compiler/src/x10/types/X10Flags.java trunk/x10.compiler/src/x10/types/X10InitializerDef.java trunk/x10.compiler/src/x10/types/X10InitializerDef_c.java trunk/x10.compiler/src/x10/types/X10LocalDef.java trunk/x10.compiler/src/x10/types/X10LocalDef_c.java trunk/x10.compiler/src/x10/types/X10LocalInstance.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.java trunk/x10.compiler/src/x10/types/X10MethodDef_c.java trunk/x10.compiler/src/x10/types/X10MethodInstance.java trunk/x10.compiler/src/x10/types/X10MethodInstance_c.java trunk/x10.compiler/src/x10/types/X10NamedType.java trunk/x10.compiler/src/x10/types/X10NullType.java trunk/x10.compiler/src/x10/types/X10NullType_c.java trunk/x10.compiler/src/x10/types/X10ParsedClassType.java trunk/x10.compiler/src/x10/types/X10ParsedClassType_c.java trunk/x10.compiler/src/x10/types/X10PrimitiveType.java trunk/x10.compiler/src/x10/types/X10PrimitiveType_c.java trunk/x10.compiler/src/x10/types/X10ProcedureDef.java trunk/x10.compiler/src/x10/types/X10ProcedureInstance.java trunk/x10.compiler/src/x10/types/X10SourceClassResolver.java trunk/x10.compiler/src/x10/types/X10ThisVar.java trunk/x10.compiler/src/x10/types/X10Type.java trunk/x10.compiler/src/x10/types/X10TypeEnv.java trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java trunk/x10.compiler/src/x10/types/X10TypeMixin.java trunk/x10.compiler/src/x10/types/X10TypeObject.java trunk/x10.compiler/src/x10/types/X10TypeObjectMixin.java trunk/x10.compiler/src/x10/types/X10TypeSystem.java trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.compiler/src/x10/types/X10UnknownType.java trunk/x10.compiler/src/x10/types/X10UnknownType_c.java trunk/x10.compiler/src/x10/types/X10Use.java trunk/x10.compiler/src/x10/types/X10XLocal_c.java trunk/x10.compiler/src/x10/types/XTypeTranslator.java trunk/x10.compiler/src/x10/utils/Synthesizer.java trunk/x10.compiler/src/x10/visit/AnnotationChecker.java trunk/x10.compiler/src/x10/visit/AssignPropertyChecker.java trunk/x10.compiler/src/x10/visit/AsyncElimination.java trunk/x10.compiler/src/x10/visit/AtomicElimination.java trunk/x10.compiler/src/x10/visit/CastRewriter.java trunk/x10.compiler/src/x10/visit/CheckNativeAnnotationsVisitor.java trunk/x10.compiler/src/x10/visit/ConstantPropagator.java trunk/x10.compiler/src/x10/visit/Desugarer.java trunk/x10.compiler/src/x10/visit/ExprFlattener.java trunk/x10.compiler/src/x10/visit/FieldInitializerMover.java trunk/x10.compiler/src/x10/visit/Inliner.java trunk/x10.compiler/src/x10/visit/RewriteAtomicMethodVisitor.java trunk/x10.compiler/src/x10/visit/RewriteExternVisitor.java trunk/x10.compiler/src/x10/visit/StaticNestedClassRemover.java trunk/x10.compiler/src/x10/visit/X10Boxer.java trunk/x10.compiler/src/x10/visit/X10Caster.java trunk/x10.compiler/src/x10/visit/X10DelegatingVisitor.java trunk/x10.compiler/src/x10/visit/X10ImplicitDeclarationExpander.java trunk/x10.compiler/src/x10/visit/X10InitChecker.java trunk/x10.compiler/src/x10/visit/X10InitImportsVisitor.java trunk/x10.compiler/src/x10/visit/X10InnerClassRemover.java trunk/x10.compiler/src/x10/visit/X10LocalClassRemover.java trunk/x10.compiler/src/x10/visit/X10MLVerifier.java trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.compiler/src/x10/visit/X10Translator.java trunk/x10.compiler/src/x10c/util/WriterStreams.java trunk/x10.compiler/src/x10cpp/ast/X10CPPDelFactory_c.java trunk/x10.compiler/src/x10cpp/ast/X10CPPExtFactory_c.java trunk/x10.compiler/src/x10cpp/debug/ClosureVariableMap.java trunk/x10.compiler/src/x10cpp/debug/LineNumberMap.java trunk/x10.compiler/src/x10cpp/debug/StringTable.java trunk/x10.compiler/src/x10cpp/extension/X10ClassBodyExt_c.java trunk/x10.compiler/src/x10cpp/main/Main.java trunk/x10.compiler/src/x10cpp/types/X10CPPContext_c.java trunk/x10.compiler/src/x10cpp/types/X10CPPSourceClassResolver.java trunk/x10.compiler/src/x10cpp/types/X10CPPTypeSystem_c.java trunk/x10.compiler/src/x10cpp/visit/ASTQuery.java trunk/x10.compiler/src/x10cpp/visit/Emitter.java trunk/x10.compiler/src/x10cpp/visit/ITable.java trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.compiler/src/x10cpp/visit/SPMDcppCodeGenerator.java.aside trunk/x10.compiler/src/x10cpp/visit/SharedVarsMethods.java trunk/x10.compiler/src/x10cpp/visit/X10CPPTranslator.java trunk/x10.compiler/src/x10cpp/visit/X10SearchVisitor.java trunk/x10.compiler/src/x10cpp/visit/XCDProcessor.java trunk/x10.compiler/src/x10cuda/ast/X10CUDADelFactory_c.java trunk/x10.compiler/src/x10cuda/types/SharedMem.java trunk/x10.compiler/src/x10cuda/types/X10CUDAContext_c.java trunk/x10.compiler/src/x10cuda/types/X10CUDATypeSystem_c.java trunk/x10.compiler/src/x10cuda/visit/CUDACodeGenerator.java trunk/x10.compiler/stuff/polyglot/ext/x10/dom/DomGenerator.java trunk/x10.compiler/stuff/polyglot/ext/x10/dom/DomParser.java trunk/x10.compiler/stuff/polyglot/ext/x10/dom/DomReader.java trunk/x10.compiler/stuff/polyglot/ext/x10/dom/ExternalizerPlugin.java trunk/x10.compiler/stuff/polyglot/ext/x10/dom/X10Dom.java trunk/x10.compiler/stuff/polyglot/ext/x10/dom/X10MLClassInitializer.java trunk/x10.compiler/stuff/polyglot/ext/x10/dom/XMLReader.java trunk/x10.compiler/stuff/polyglot/ext/x10/dom/XMLWriter.java trunk/x10.compiler/stuff/polyglot/ext/x10/plugin/SimpleOnePassPlugin.java trunk/x10.compiler/stuff/polyglot/ext/x10/plugin/SimplePlugin.java trunk/x10.compiler/stuff/polyglot/ext/x10/plugin/SimpleTypeAnnotationPlugin.java trunk/x10.compiler/stuff/polyglot/ext/x10/plugin/SimpleVisitorPlugin.java trunk/x10.compiler/stuff/polyglot/ext/x10/visit/PropagateAnnotationsVisitor.java trunk/x10.compiler/stuff/polyglot/ext/x10/visit/PropagateDependentAnnotationsVisitor.java trunk/x10.dist/.launchConfigs/x10c.launch trunk/x10.dist/.launchConfigs/x10cpp.launch trunk/x10.dist/bin/x10c++ trunk/x10.dist/bin/x10c.in Added Paths: ----------- trunk/x10.compiler/src/x10/Configuration.java trunk/x10.compiler/src/x10/ExtensionInfo.java trunk/x10.compiler/src/x10/RuntimeConstants.java trunk/x10.compiler/src/x10/Topics.java trunk/x10.compiler/src/x10/Version.java trunk/x10.compiler/src/x10/X10CompilerOptions.java trunk/x10.compiler/src/x10/ast/ trunk/x10.compiler/src/x10/dom/ trunk/x10.compiler/src/x10/extension/ trunk/x10.compiler/src/x10/package.html trunk/x10.compiler/src/x10/plugin/ trunk/x10.compiler/src/x10/query/ trunk/x10.compiler/src/x10/types/ trunk/x10.compiler/src/x10/visit/ trunk/x10.compiler/src/x10cpp/ trunk/x10.compiler/src/x10cpp/Configuration.java trunk/x10.compiler/src/x10cpp/ExtensionInfo.java trunk/x10.compiler/src/x10cpp/Version.java trunk/x10.compiler/src/x10cpp/X10CPPCompilerOptions.java trunk/x10.compiler/src/x10cpp/ast/ trunk/x10.compiler/src/x10cpp/debug/ trunk/x10.compiler/src/x10cpp/extension/ trunk/x10.compiler/src/x10cpp/fixme-todo.txt trunk/x10.compiler/src/x10cpp/main/ trunk/x10.compiler/src/x10cpp/types/ trunk/x10.compiler/src/x10cpp/visit/ trunk/x10.compiler/src/x10cuda/ trunk/x10.compiler/src/x10cuda/ExtensionInfo.java trunk/x10.compiler/src/x10cuda/ast/ trunk/x10.compiler/src/x10cuda/types/ trunk/x10.compiler/src/x10cuda/visit/ Removed Paths: ------------- trunk/x10.compiler/src/polyglot/ext/x10/Configuration.java trunk/x10.compiler/src/polyglot/ext/x10/ExtensionInfo.java trunk/x10.compiler/src/polyglot/ext/x10/RuntimeConstants.java trunk/x10.compiler/src/polyglot/ext/x10/Topics.java trunk/x10.compiler/src/polyglot/ext/x10/Version.java trunk/x10.compiler/src/polyglot/ext/x10/X10CompilerOptions.java trunk/x10.compiler/src/polyglot/ext/x10/ast/ trunk/x10.compiler/src/polyglot/ext/x10/dom/ trunk/x10.compiler/src/polyglot/ext/x10/extension/ trunk/x10.compiler/src/polyglot/ext/x10/package.html trunk/x10.compiler/src/polyglot/ext/x10/plugin/ trunk/x10.compiler/src/polyglot/ext/x10/query/ trunk/x10.compiler/src/polyglot/ext/x10/types/ trunk/x10.compiler/src/polyglot/ext/x10/visit/ trunk/x10.compiler/src/polyglot/ext/x10cpp/Configuration.java trunk/x10.compiler/src/polyglot/ext/x10cpp/ExtensionInfo.java trunk/x10.compiler/src/polyglot/ext/x10cpp/Version.java trunk/x10.compiler/src/polyglot/ext/x10cpp/X10CPPCompilerOptions.java trunk/x10.compiler/src/polyglot/ext/x10cpp/ast/ trunk/x10.compiler/src/polyglot/ext/x10cpp/debug/ trunk/x10.compiler/src/polyglot/ext/x10cpp/extension/ trunk/x10.compiler/src/polyglot/ext/x10cpp/fixme-todo.txt trunk/x10.compiler/src/polyglot/ext/x10cpp/main/ trunk/x10.compiler/src/polyglot/ext/x10cpp/types/ trunk/x10.compiler/src/polyglot/ext/x10cpp/visit/ trunk/x10.compiler/src/polyglot/ext/x10cuda/ExtensionInfo.java trunk/x10.compiler/src/polyglot/ext/x10cuda/ast/ trunk/x10.compiler/src/polyglot/ext/x10cuda/types/ trunk/x10.compiler/src/polyglot/ext/x10cuda/visit/ Modified: trunk/x10.compiler/META-INF/MANIFEST.MF =================================================================== --- trunk/x10.compiler/META-INF/MANIFEST.MF 2009-08-13 15:32:21 UTC (rev 10975) +++ trunk/x10.compiler/META-INF/MANIFEST.MF 2009-08-13 16:22:31 UTC (rev 10976) @@ -8,11 +8,11 @@ x10.constraints, lpg.runtime, polyglot3 -Export-Package: polyglot.ext.x10, - polyglot.ext.x10.ast, - polyglot.ext.x10.extension, - polyglot.ext.x10.types, - polyglot.ext.x10.visit, +Export-Package: x10, + x10.ast, + x10.emitter, + x10.extension, x10.parser, - x10.emitter + x10.types, + x10.visit Bundle-Vendor: rf...@wa... Modified: trunk/x10.compiler/build.xml =================================================================== --- trunk/x10.compiler/build.xml 2009-08-13 15:32:21 UTC (rev 10975) +++ trunk/x10.compiler/build.xml 2009-08-13 16:22:31 UTC (rev 10976) @@ -66,7 +66,7 @@ </target> <target name="jar" depends="build"> <jar jarfile="${build}/${jar}"> - <fileset dir="${build}" includes="org/**,polyglot/ext/x10/**,polyglot/ext/x10cpp/**,x10/parser/**,x10/emitter/**,x10/utils/**,x10c/**,data/**" excludes="${jar}"/> + <fileset dir="${build}" includes="org/**,x10/**,x10cpp/**,x10c/**,data/**" excludes="${jar}"/> <fileset dir="${x10.constraints.location}/classes" includes="x10/constraint/**" excludes="x10/constraint/test/**"/> <fileset dir="${x10.common.location}/classes" includes="x10/**"/> </jar> @@ -83,7 +83,7 @@ </target> <target name="build" depends="init,prereq-jars"> <echo message="${ant.project.name}: ${ant.file}"/> - <javac destdir="${build}" source="1.5" target="1.5" debug="on" includes="polyglot/**,x10/**" excludes="polyglot/ext/x10/dom/**,polyglot/ext/x10/plugin/**,polyglot/ext/x10/visit/Propagate*AnnotationsVisitor.java"> + <javac destdir="${build}" source="1.5" target="1.5" debug="on" includes="x10/**,x10c/**,x10cpp/**," excludes="polyglot/ext/x10/dom/**,polyglot/ext/x10/plugin/**,polyglot/ext/x10/visit/Propagate*AnnotationsVisitor.java"> <src path="${src}"/> <classpath refid="project.classpath"/> </javac> Deleted: trunk/x10.compiler/src/polyglot/ext/x10/Configuration.java =================================================================== --- trunk/x10.compiler/src/polyglot/ext/x10/Configuration.java 2009-08-13 15:32:21 UTC (rev 10975) +++ trunk/x10.compiler/src/polyglot/ext/x10/Configuration.java 2009-08-13 16:22:31 UTC (rev 10976) @@ -1,106 +0,0 @@ -// Licensed Materials - Property of IBM -// (C) Copyright IBM Corporation 2004-2008. All Rights Reserved. -// Note to U.S. Government Users Restricted Rights: Use, duplication or -// disclosure restricted by GSA ADP Schedule Contract with IBM Corp. -// -// --------------------------------------------------------------------------- - -/* - * Created on Sep 28, 2004 - */ -package polyglot.ext.x10; - -import x10.config.ConfigurationError; -import x10.config.OptionError; - -/** - * This class provides the configuration for the X10 compiler. - * The configuration is a set of values that can be used to - * configure the compiler, for example in order to tune performance - * of the generated code. - * - * @see x10.config.Configuration - * - * @author Christian Grothoff - * @author Igor Peshansky - * - * @author barikr: added LOOP_OPTIMIZATIONS 26th Aug 2006 - */ -public final class Configuration extends x10.config.Configuration { - - /** - * The error received when attempting to load the configuration from - * the specified resource, or null if successful. - */ - public static final ConfigurationError LOAD_ERROR; - - public static String COMPILER_FRAGMENT_DATA_DIRECTORY = "data/"; - private static final String COMPILER_FRAGMENT_DATA_DIRECTORY_desc = "Advanced functionality: Directory for compiler templates"; - - public static boolean OPTIMIZE = false; - private static final String OPTIMIZE_desc = "Generate optimized code"; - - public static boolean DEBUG = true; - private static final String DEBUG_desc = "Generate debug information"; - - public static boolean BAD_PLACE_RUNTIME_CHECK = true; - private static final String BAD_PLACE_RUNTIME_CHECK_desc = "Generate runtime place checks"; - - public static boolean LOOP_OPTIMIZATIONS = true; - private static final String LOOP_OPTIMIZATIONS_desc = "Generate specialized Java version of for-loop X10 code"; - - public static boolean ARRAY_OPTIMIZATIONS = true; - private static final String ARRAY_OPTIMIZATIONS_desc = "Generate allocation of specialized Java array classes"; - - public static boolean INLINE_OPTIMIZATIONS = false; - private static final String INLINE_OPTIMIZATIONS_desc = "Perform inlining optimizations"; - - public static String PLUGINS = ""; - private static final String PLUGINS_desc = "Comma-separated list of compiler plugins to run."; - - public static String PLUGIN_COMPILER = ""; - private static final String PLUGIN_COMPILER_desc = "Javac-like compiler to use to compile plugins"; - - public static String XML_PROCESSOR = ""; - private static final String XML_PROCESSOR_desc = "External program to transform ASTs externalized as XML"; - - public static boolean EXTERNALIZE_ASTS = false; - private static final String EXTERNALIZE_ASTS_desc = "Externalize ASTs to XML"; - - public static String MANIFEST = null; - private static final String MANIFEST_desc = "The path to the pre-built library manifest file"; - - /** - * Parses one argument from the command line. This allows the user - * to specify options also on the command line (in addition to the - * configuration file and the defaults). - * - * @param arg the current argument, e.g., -STATISTICS_DISABLE=all - * @throws OptionError if the argument is not recognized - * @throws ConfigurationError if there was a problem processing the argument - */ - public static void parseArgument(String arg) throws OptionError, ConfigurationError { - parseArgument(Configuration.class, arg); - } - - /** - * Return an array of (option,description) pairs. - */ - public static String[][] options() { - return options(Configuration.class); - } - - static { - String cfg = getConfigurationResource(); - ConfigurationError loadError = null; - try { - readConfiguration(Configuration.class, cfg); - } catch (ConfigurationError err) { - System.err.println("Failed to read configuration file " + cfg + ": " + err); - System.err.println("Using defaults"); - loadError = err; - } - LOAD_ERROR = loadError; - } -} - Deleted: trunk/x10.compiler/src/polyglot/ext/x10/ExtensionInfo.java =================================================================== --- trunk/x10.compiler/src/polyglot/ext/x10/ExtensionInfo.java 2009-08-13 15:32:21 UTC (rev 10975) +++ trunk/x10.compiler/src/polyglot/ext/x10/ExtensionInfo.java 2009-08-13 16:22:31 UTC (rev 10976) @@ -1,506 +0,0 @@ -// Licensed Materials - Property of IBM -// (C) Copyright IBM Corporation 2004-2008. All Rights Reserved. -// Note to U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. -// -// --------------------------------------------------------------------------- - - -package polyglot.ext.x10; - - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.io.Reader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; - -import polyglot.ast.NodeFactory; -import polyglot.ext.x10.ast.X10NodeFactory_c; -import polyglot.ext.x10.plugin.CompilerPlugin; -import polyglot.ext.x10.plugin.LoadJobPlugins; -import polyglot.ext.x10.plugin.LoadPlugins; -import polyglot.ext.x10.plugin.RegisterPlugins; -import polyglot.ext.x10.query.QueryEngine; -import polyglot.ext.x10.types.X10SourceClassResolver; -import polyglot.ext.x10.types.X10TypeSystem; -import polyglot.ext.x10.types.X10TypeSystem_c; -import polyglot.ext.x10.visit.AssignPropertyChecker; -import polyglot.ext.x10.visit.CastRewriter; -import polyglot.ext.x10.visit.CheckNativeAnnotationsVisitor; -import polyglot.ext.x10.visit.Desugarer; -import polyglot.ext.x10.visit.ExprFlattener; -import polyglot.ext.x10.visit.FieldInitializerMover; -import polyglot.ext.x10.visit.Inliner; -import polyglot.ext.x10.visit.RewriteAtomicMethodVisitor; -import polyglot.ext.x10.visit.RewriteExternVisitor; -import polyglot.ext.x10.visit.StaticNestedClassRemover; -import polyglot.ext.x10.visit.X10Boxer; -import polyglot.ext.x10.visit.X10Caster; -import polyglot.ext.x10.visit.X10ImplicitDeclarationExpander; -import polyglot.ext.x10.visit.X10InitChecker; -import polyglot.ext.x10.visit.X10InnerClassRemover; -import polyglot.ext.x10.visit.X10MLVerifier; -import polyglot.ext.x10.visit.X10Translator; -import polyglot.frontend.AbstractGoal_c; -import polyglot.frontend.AllBarrierGoal; -import polyglot.frontend.BarrierGoal; -import polyglot.frontend.Compiler; -import polyglot.frontend.FileResource; -import polyglot.frontend.FileSource; -import polyglot.frontend.Globals; -import polyglot.frontend.Goal; -import polyglot.frontend.JLScheduler; -import polyglot.frontend.Job; -import polyglot.frontend.OutputGoal; -import polyglot.frontend.Parser; -import polyglot.frontend.Scheduler; -import polyglot.frontend.SourceGoal_c; -import polyglot.frontend.TargetFactory; -import polyglot.frontend.VisitorGoal; -import polyglot.main.Options; -import polyglot.main.Report; -import polyglot.types.MemberClassResolver; -import polyglot.types.MethodDef; -import polyglot.types.QName; -import polyglot.types.SemanticException; -import polyglot.types.TopLevelResolver; -import polyglot.types.TypeSystem; -import polyglot.util.ErrorQueue; -import polyglot.util.InternalCompilerError; -import polyglot.visit.PruningVisitor; -import x10.parser.X10Lexer; -import x10.parser.X10Parser; - -/** - * Extension information for x10 extension. - */ -public class ExtensionInfo extends polyglot.frontend.ParserlessJLExtensionInfo { - static final boolean DEBUG_ = false; - static { - // force Topics to load - Topics t = new Topics(); - } - - protected Map<QName,CompilerPlugin> plugins; - - public static final String XML_FILE_EXTENSION = "x10ml"; - public static final String XML_FILE_DOT_EXTENSION = "." + XML_FILE_EXTENSION; - - public static String clock = "clock"; - - static { - Report.topics.add(clock); - } - - public polyglot.main.Version version() { - return new Version(); - } - public String[] fileExtensions() { - return new String[] { "x10", XML_FILE_EXTENSION }; - } -// public String defaultFileExtension() { -// return "x10"; -// } - - public String compilerName() { - return "x10c"; - } - - // - // Replace the Flex/Cup parser with a JikesPG parser - // - // public Parser parser(Reader reader, FileSource source, ErrorQueue eq) { - // Lexer lexer = new Lexer_c(reader, source.name(), eq); - // Grm grm = new Grm(lexer, ts, nf, eq); - // return new CupParser(grm, source, eq); - // } - // - - public Parser parser(Reader reader, FileSource source, ErrorQueue eq) { - // ### -// if (source.path().endsWith(XML_FILE_DOT_EXTENSION)) { -// return new DomParser(reader, (X10TypeSystem) ts, (X10NodeFactory) nf, source, eq); -// } - - try { - // - // X10Lexer may be invoked using one of two constructors. - // One constructor takes as argument a string representing - // a (fully-qualified) filename; the other constructor takes - // as arguments a (file) Reader and a string representing the - // name of the file in question. Invoking the first - // constructor is more efficient because a buffered File is created - // from that string and read with one (read) operation. However, - // we depend on Polyglot to provide us with a fully qualified - // name for the file. In Version 1.3.0, source.name() yielded a - // fully-qualied name. In 1.3.2, source.path() yields a fully- - // qualified name. If this assumption still holds then the - // first constructor will work. - // The advantage of using the Reader constructor is that it - // will always work, though not as efficiently. - // - // X10Lexer x10_lexer = new X10Lexer(reader, source.name()); - // - // FIXME: HACK! Unwrap the escaping unicode reader, because LPG will do its own decoding -// if (reader instanceof polyglot.lex.EscapedUnicodeReader) -// reader = ((polyglot.lex.EscapedUnicodeReader)reader).getSource(); - X10Lexer x10_lexer = - // Optimization: it's faster to read from a file - source instanceof FileSource && ((FileSource) source).resource().getClass() == FileResource.class ? - new X10Lexer(source.path()) : - new X10Lexer(reader, source.toString()); - X10Parser x10_parser = new X10Parser(x10_lexer.getILexStream(), ts, nf, source, eq); // Create the parser - x10_lexer.lexer(x10_parser.getIPrsStream()); - return x10_parser; // Parse the token stream to produce an AST - } catch (IOException e) { - e.printStackTrace(); - } - throw new IllegalStateException("Could not parse " + source.path()); - } - - protected HashSet<String> manifest = new HashSet<String>(); - public boolean manifestContains(String path) { - path = path.replace(File.separatorChar, '/'); - // FIXME: HACK! Try all prefixes - int s = 0; - while ((s = path.indexOf('/')) != -1) { - if (manifest.contains(path)) - return true; - path = path.substring(s+1); - } - if (manifest.contains(path)) - return true; - return false; - } - - protected void initTypeSystem() { - try { - TopLevelResolver r = new X10SourceClassResolver(compiler, this, getOptions().constructFullClasspath(), - getOptions().compile_command_line_only, - getOptions().ignore_mod_times); - // FIXME: [IP] HACK - if (Configuration.MANIFEST != null) { - try { - FileReader fr = new FileReader(Configuration.MANIFEST); - BufferedReader br = new BufferedReader(fr); - String file = ""; - while ((file = br.readLine()) != null) - if (file.endsWith(".x10") || file.endsWith(".jar")) // FIXME: hard-codes the source extension. - manifest.add(file); - } catch (IOException e) { } - } else { // TODO: read manifest from x10.jar - } - // Resolver to handle lookups of member classes. - if (true || TypeSystem.SERIALIZE_MEMBERS_WITH_CONTAINER) { - MemberClassResolver mcr = new MemberClassResolver(ts, r, true); - r = mcr; - } - - ts.initialize(r, this); - } - catch (SemanticException e) { - throw new InternalCompilerError( - "Unable to initialize type system: " + e.getMessage(), e); - } - } - - protected NodeFactory createNodeFactory() { - return new X10NodeFactory_c(this); - } - - protected TypeSystem createTypeSystem() { - return new X10TypeSystem_c(); - } - - public void initCompiler(Compiler compiler) { - super.initCompiler(compiler); - QueryEngine.init(this); - } - - // ================================= - // X10-specific goals and scheduling - // ================================= - protected Scheduler createScheduler() { - return new X10Scheduler(this); - } - - public static class X10Scheduler extends JLScheduler { - public X10Scheduler(ExtensionInfo extInfo) { - super(extInfo); - } - - public List<Goal> goals(Job job) { - List<Goal> goals = new ArrayList<Goal>(); - - goals.add(Parsed(job)); - goals.add(TypesInitialized(job)); - goals.add(ImportTableInitialized(job)); - - if (job.source() != null && job.source().path().endsWith(XML_FILE_DOT_EXTENSION)) { - goals.add(X10MLTypeChecked(job)); - } - - goals.add(CastRewritten(job)); - - // Do not include LoadPlugins in list. It would cause prereqs to be added -// goals.add(LoadPlugins()); - goals.add(PropagateAnnotations(job)); - goals.add(LoadJobPlugins(job)); - goals.add(RegisterPlugins(job)); - - goals.add(PreTypeCheck(job)); - goals.add(TypesInitializedForCommandLine()); - goals.add(TypeChecked(job)); - goals.add(ReassembleAST(job)); - - goals.add(X10Boxed(job)); - goals.add(X10Casted(job)); - goals.add(MoveFieldInitializers(job)); - goals.add(ConformanceChecked(job)); - - goals.add(X10RewriteExtern(job)); - goals.add(X10RewriteAtomicMethods(job)); - - // Data-flow analyses - goals.add(ReachabilityChecked(job)); - goals.add(ExceptionsChecked(job)); - goals.add(ExitPathsChecked(job)); - goals.add(InitializationsChecked(job)); - goals.add(ConstructorCallsChecked(job)); - goals.add(ForwardReferencesChecked(job)); - goals.add(PropertyAssignmentsChecked(job)); - goals.add(X10Expanded(job)); - - goals.add(Serialized(job)); -// goals.add(CodeGenBarrier()); - goals.add(CheckNativeAnnotations(job)); - goals.add(InnerClassRemover(job)); - goals.add(Desugarer(job)); - goals.add(Inlined(job)); - goals.add(CodeGenerated(job)); - goals.add(End(job)); - - // the barrier will handle prereqs on its own - CodeGenerated(job).addPrereq(CodeGenBarrier()); - - return goals; - } - - public Goal CodeGenBarrier() { - if (Globals.Options().compile_command_line_only) { - return new BarrierGoal("CodeGenBarrier", commandLineJobs()) { - @Override - public Goal prereqForJob(Job job) { - return Serialized(job); - } - }; - } - else { - return new AllBarrierGoal("CodeGenBarrier", this) { - @Override - public Goal prereqForJob(Job job) { - if (!scheduler.commandLineJobs().contains(job) && - ((ExtensionInfo) extInfo).manifestContains(job.source().path())) - { - return null; - } - return Serialized(job); - } - }; - } - } - - public Goal Serialized(Job job) { - Compiler compiler = job.extensionInfo().compiler(); - X10TypeSystem ts = (X10TypeSystem) job.extensionInfo().typeSystem(); - NodeFactory nf = job.extensionInfo().nodeFactory(); - TargetFactory tf = job.extensionInfo().targetFactory(); - return new SourceGoal_c("Serialized", job) { - public boolean runTask() { - return true; - } - }.intern(this); - } - - -// @Override -// public Goal ImportTableInitialized(Job job) { -// TypeSystem ts = job.extensionInfo().typeSystem(); -// NodeFactory nf = job.extensionInfo().nodeFactory(); -// Goal g = new VisitorGoal("ImportTableInitialized", job, new X10InitImportsVisitor(job, ts, nf)); -// Goal g2 = g.intern(this); -// if (g == g2) { -// g.addPrereq(TypesInitializedForCommandLine()); -// } -// return g2; -// } - - public Goal LoadPlugins() { - return new LoadPlugins((ExtensionInfo) extInfo).intern(this); - } - - public Goal LoadJobPlugins(Job job) { - return new LoadJobPlugins(job).intern(this); - } - - public Goal RegisterPlugins(Job job) { - Goal g = new RegisterPlugins(job); - Goal g2 = g.intern(this); - if (g == g2) { - g.addPrereq(LoadPlugins()); - } - return g2; - } - - public Goal PropagateAnnotations(Job job) { - // ### - return new VisitorGoal("PropagateAnnotations", job, new PruningVisitor()).intern(this); - } - - @Override - public Goal InitializationsChecked(Job job) { - TypeSystem ts = job.extensionInfo().typeSystem(); - NodeFactory nf = job.extensionInfo().nodeFactory(); - return new VisitorGoal("InitializationsChecked", job, new X10InitChecker(job, ts, nf)).intern(this); - } - - @Override - public Goal CodeGenerated(Job job) { - TypeSystem ts = extInfo.typeSystem(); - NodeFactory nf = extInfo.nodeFactory(); - return new OutputGoal(job, new X10Translator(job, ts, nf, extInfo.targetFactory())).intern(this); - } - - public Goal X10MLTypeChecked(Job job) { - TypeSystem ts = extInfo.typeSystem(); - NodeFactory nf = extInfo.nodeFactory(); - return new VisitorGoal("X10MLTypeChecked", job, new X10MLVerifier(job, ts, nf)).intern(this); - } - - public Goal X10Boxed(Job job) { - TypeSystem ts = extInfo.typeSystem(); - NodeFactory nf = extInfo.nodeFactory(); - return new VisitorGoal("X10Boxed", job, new X10Boxer(job, ts, nf)).intern(this); - } - - public Goal X10Casted(Job job) { - TypeSystem ts = extInfo.typeSystem(); - NodeFactory nf = extInfo.nodeFactory(); - return new VisitorGoal("X10Casted", job, new X10Caster(job, ts, nf)).intern(this); - } - - public Goal MoveFieldInitializers(Job job) { - TypeSystem ts = extInfo.typeSystem(); - NodeFactory nf = extInfo.nodeFactory(); - return new VisitorGoal("MoveFieldInitializers", job, new FieldInitializerMover(job, ts, nf)).intern(this); - } - - public Goal X10RewriteExtern(Job job) { - TypeSystem ts = extInfo.typeSystem(); - NodeFactory nf = extInfo.nodeFactory(); - return new VisitorGoal("X10RewriteExtern", job, new RewriteExternVisitor(job, ts, nf)).intern(this); - } - public Goal X10RewriteAtomicMethods(Job job) { - TypeSystem ts = extInfo.typeSystem(); - NodeFactory nf = extInfo.nodeFactory(); - return new VisitorGoal("X10RewriteAtomicMethods", job, new RewriteAtomicMethodVisitor(job, ts, nf)).intern(this); - } - - public Goal X10ExprFlattened(Job job) { - TypeSystem ts = extInfo.typeSystem(); - NodeFactory nf = extInfo.nodeFactory(); - return new VisitorGoal("X10ExprFlattened", job, new ExprFlattener(job, ts, nf)).intern(this); - } - - // after disambiguation, before type elaboration - public Goal CastRewritten(Job job) { - TypeSystem ts = extInfo.typeSystem(); - NodeFactory nf = extInfo.nodeFactory(); - return new VisitorGoal("CastRewritten", job, new CastRewriter(job, ts, nf)).intern(this); - } - - - public Goal PropertyAssignmentsChecked(Job job) { - TypeSystem ts = extInfo.typeSystem(); - NodeFactory nf = extInfo.nodeFactory(); - return new VisitorGoal("PropertyAssignmentsChecked", job, new AssignPropertyChecker(job, ts, nf)).intern(this); - } - - public Goal X10Expanded(Job job) { - TypeSystem ts = extInfo.typeSystem(); - NodeFactory nf = extInfo.nodeFactory(); - return new VisitorGoal("X10Expanded", job, new X10ImplicitDeclarationExpander(job, ts, nf)).intern(this); - } - - public Goal Inlined(Job job) { - TypeSystem ts = extInfo.typeSystem(); - NodeFactory nf = extInfo.nodeFactory(); - if (polyglot.ext.x10.Configuration.INLINE_OPTIMIZATIONS) { - return new VisitorGoal("Inlined", job, new Inliner(job, ts, nf)).intern(this); - } - else { - return new SourceGoal_c("Inlined", job) { - @Override - public boolean runTask() { - return true; - } - }.intern(this); - } - } - - public Goal CheckNativeAnnotations(Job job) { - TypeSystem ts = extInfo.typeSystem(); - NodeFactory nf = extInfo.nodeFactory(); - return new VisitorGoal("CheckNativeAnnotations", job, new CheckNativeAnnotationsVisitor(job, ts, nf, "java")).intern(this); - } - - public Goal Desugarer(Job job) { - TypeSystem ts = extInfo.typeSystem(); - NodeFactory nf = extInfo.nodeFactory(); - return new VisitorGoal("Desugarer", job, new Desugarer(job, ts, nf)).intern(this); - } - - public Goal InnerClassRemover(Job job) { - TypeSystem ts = extInfo.typeSystem(); - NodeFactory nf = extInfo.nodeFactory(); - return new VisitorGoal("InnerClassRemover", job, new X10InnerClassRemover(job, ts, nf)).intern(this); - } - public Goal StaticNestedClassRemover(Job job) { - TypeSystem ts = extInfo.typeSystem(); - NodeFactory nf = extInfo.nodeFactory(); - return new VisitorGoal("StaticNestedClassRemover", job, new StaticNestedClassRemover(job, ts, nf)).intern(this); - } - } - - protected Options createOptions() { - return new X10CompilerOptions(this); - } - - public Map<QName,CompilerPlugin> plugins() { - if (plugins == null) { - return Collections.emptyMap(); - } - return plugins; - } - - public void addPlugin(QName pluginName, CompilerPlugin plugin) { - if (plugins == null) { - plugins = new HashMap<QName,CompilerPlugin>(); - } - plugins.put(pluginName, plugin); - } - - public CompilerPlugin getPlugin(QName pluginName) { - if (plugins == null) { - return null; - } - - return plugins.get(pluginName); - } -} Deleted: trunk/x10.compiler/src/polyglot/ext/x10/RuntimeConstants.java =================================================================== --- trunk/x10.compiler/src/polyglot/ext/x10/RuntimeConstants.java 2009-08-13 15:32:21 UTC (rev 10975) +++ trunk/x10.compiler/src/polyglot/ext/x10/RuntimeConstants.java 2009-08-13 16:22:31 UTC (rev 10976) @@ -1,32 +0,0 @@ -// Licensed Materials - Property of IBM -// (C) Copyright IBM Corporation 2004-2008. All Rights Reserved. -// Note to U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. -// -// --------------------------------------------------------------------------- - -/* - * Created on Oct 2, 2004 - */ -package polyglot.ext.x10; - -/** - * Constants used in X10 compiler that refer to the X10 Runtime. - * - * @author Christian Grothoff - */ -public interface RuntimeConstants { - - /** - * Name of the method of an x10 Activity that contains the code that is - * to be executed for this activity. - */ - public static final String ACTIVITY_RUN = "run"; - - public static final String ACTIVITY_GET_RESULT = "getResult"; - - public static final String PLACE_RUN_ACTIVATION_ASYNC = "runAsync"; - - public static final String PLACE_RUN_ACTIVATION_FUTURE = "runFuture"; - - -} Deleted: trunk/x10.compiler/src/polyglot/ext/x10/Topics.java =================================================================== --- trunk/x10.compiler/src/polyglot/ext/x10/Topics.java 2009-08-13 15:32:21 UTC (rev 10975) +++ trunk/x10.compiler/src/polyglot/ext/x10/Topics.java 2009-08-13 16:22:31 UTC (rev 10976) @@ -1,21 +0,0 @@ -// Licensed Materials - Property of IBM -// (C) Copyright IBM Corporation 2004-2008. All Rights Reserved. -// Note to U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. -// -// --------------------------------------------------------------------------- - - -package polyglot.ext.x10; - -import polyglot.main.Report; - -/** - * Extension information for x10 extension. - */ -public class Topics { - public static final String x10 = "x10"; - - static { - Report.topics.add(x10); - } -} Deleted: trunk/x10.compiler/src/polyglot/ext/x10/Version.java =================================================================== --- trunk/x10.compiler/src/polyglot/ext/x10/Version.java 2009-08-13 15:32:21 UTC (rev 10975) +++ trunk/x10.compiler/src/polyglot/ext/x10/Version.java 2009-08-13 16:22:31 UTC (rev 10976) @@ -1,19 +0,0 @@ -// Licensed Materials - Property of IBM -// (C) Copyright IBM Corporation 2004-2008. All Rights Reserved. -// Note to U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. -// -// --------------------------------------------------------------------------- - - -package polyglot.ext.x10; - -/** - * Version information for x10 extension - */ -public class Version extends polyglot.main.Version { - public String name() { return "x10"; } - - public int major() { return 1; } - public int minor() { return 8; } - public int patch_level() { return 0; } -} Deleted: trunk/x10.compiler/src/polyglot/ext/x10/X10CompilerOptions.java =================================================================== --- trunk/x10.compiler/src/polyglot/ext/x10/X10CompilerOptions.java 2009-08-13 15:32:21 UTC (rev 10975) +++ trunk/x10.compiler/src/polyglot/ext/x10/X10CompilerOptions.java 2009-08-13 16:22:31 UTC (rev 10976) @@ -1,64 +0,0 @@ -// Licensed Materials - Property of IBM -// (C) Copyright IBM Corporation 2004-2008. All Rights Reserved. -// Note to U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. -// -// --------------------------------------------------------------------------- - - -/* - */ -package polyglot.ext.x10; - -import java.io.PrintStream; -import java.util.Set; -import polyglot.frontend.ExtensionInfo; -import polyglot.main.Main; -import polyglot.main.UsageError; -import x10.config.ConfigurationError; -import x10.config.OptionError; - -public class X10CompilerOptions extends polyglot.main.Options { - - public X10CompilerOptions(ExtensionInfo extension) { - super(extension); - } - - protected int parseCommand(String args[], int index, Set source) - throws UsageError, Main.TerminationException - { - int i = super.parseCommand(args, index, source); - if (i != index) return i; - - try { - Configuration.parseArgument(args[index]); - return ++index; - } - catch (OptionError e) { } - catch (ConfigurationError e) { } - return index; - } - - public int checkCommand(String args[], int index, Set source) - throws UsageError, Main.TerminationException, OptionError, ConfigurationError - { - int i = super.parseCommand(args, index, source); - if (i != index) return i; - - Configuration.parseArgument(args[index]); - return ++index; - } - - /** - * Print usage information - */ - public void usage(PrintStream out) { - super.usage(out); - String[][] options = Configuration.options(); - for (int i = 0; i < options.length; i++) { - String[] optinfo = options[i]; - String optflag = "-"+optinfo[0]+"="+optinfo[1]; - String optdesc = optinfo[2]+"(default = "+optinfo[3]+")"; - usageForFlag(out, optflag, optdesc); - } - } -} Deleted: trunk/x10.compiler/src/polyglot/ext/x10/package.html =================================================================== --- trunk/x10.compiler/src/polyglot/ext/x10/package.html 2009-08-13 15:32:21 UTC (rev 10975) +++ trunk/x10.compiler/src/polyglot/ext/x10/package.html 2009-08-13 16:22:31 UTC (rev 10976) @@ -1,5 +0,0 @@ -<body> -<p> -X10eton language extension. -</p> -</body> Deleted: trunk/x10.compiler/src/polyglot/ext/x10cpp/Configuration.java =================================================================== --- trunk/x10.compiler/src/polyglot/ext/x10cpp/Configuration.java 2009-08-13 15:32:21 UTC (rev 10975) +++ trunk/x10.compiler/src/polyglot/ext/x10cpp/Configuration.java 2009-08-13 16:22:31 UTC (rev 10976) @@ -1,79 +0,0 @@ -// Licensed Materials - Property of IBM -// (C) Copyright IBM Corporation 2004,2005,2006. All Rights Reserved. -// Note to U.S. Government Users Restricted Rights: Use, duplication or -// disclosure restricted by GSA ADP Schedule Contract with IBM Corp. -// -// --------------------------------------------------------------------------- - -/* - * Created on Sep 28, 2004 - */ -package polyglot.ext.x10cpp; - -import x10.config.ConfigurationError; -import x10.config.OptionError; - -/** - * This class provides the configuration for the X10 C++ compiler backend. - * The configuration is a set of values that can be used to - * configure the compiler, for example in order to tune performance - * of the generated code. - * - * @see x10.runtime.util.Configuration - * - * @author Christian Grothoff - * @author Igor Peshansky - */ -public final class Configuration extends x10.config.Configuration { - - /** - * The error received when attempting to load the configuration from - * the specified resource, or null if successful. - */ - public static final ConfigurationError LOAD_ERROR; - - public static String MAIN_CLASS = null; - private static final String MAIN_CLASS_desc = "The class whose main() will be invoked"; - - 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 - * configuration file and the defaults). - * - * @param arg the current argument, e.g., -STATISTICS_DISABLE=all - * @throws OptionError if the argument is not recognized - * @throws ConfigurationError if there was a problem processing the argument - */ - public static void parseArgument(String arg) - throws OptionError, ConfigurationError - { - parseArgument(Configuration.class, arg); - } - - /** - * Return an array of (option,description) pairs. - */ - public static String[][] options() { - return options(Configuration.class); - } - - static { - String cfg = getConfigurationResource(); - ConfigurationError loadError = null; - try { - readConfiguration(Configuration.class, cfg); - } catch (ConfigurationError err) { - System.err.println("Failed to read configuration file " + cfg + ": " + err); - System.err.println("Using defaults"); - loadError = err; - } - LOAD_ERROR = loadError; - } -} - Deleted: trunk/x10.compiler/src/polyglot/ext/x10cpp/ExtensionInfo.java =================================================================== --- trunk/x10.compiler/src/polyglot/ext/x10cpp/ExtensionInfo.java 2009-08-13 15:32:21 UTC (rev 10975) +++ trunk/x10.compiler/src/polyglot/ext/x10cpp/ExtensionInfo.java 2009-08-13 16:22:31 UTC (rev 10976) @@ -1,199 +0,0 @@ -// Licensed Materials - Property of IBM -// (C) Copyright IBM Corporation 2004,2005,2006. All Rights Reserved. -// Note to U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. -// -// --------------------------------------------------------------------------- - -package polyglot.ext.x10cpp; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.List; - -import polyglot.ast.NodeFactory; -import polyglot.ext.x10.Configuration; -import polyglot.ext.x10.ast.X10NodeFactory_c; -import polyglot.ext.x10.visit.CheckNativeAnnotationsVisitor; -import polyglot.ext.x10.visit.StaticNestedClassRemover; -import polyglot.ext.x10.visit.X10InnerClassRemover; -import polyglot.ext.x10cpp.ast.X10CPPDelFactory_c; -import polyglot.ext.x10cpp.ast.X10CPPExtFactory_c; -import polyglot.ext.x10cpp.types.X10CPPSourceClassResolver; -import polyglot.ext.x10cpp.types.X10CPPTypeSystem_c; -import polyglot.ext.x10cpp.visit.X10CPPTranslator; -import polyglot.frontend.AllBarrierGoal; -import polyglot.frontend.BarrierGoal; -import polyglot.frontend.Compiler; -import polyglot.frontend.Globals; -import polyglot.frontend.Goal; -import polyglot.frontend.Job; -import polyglot.frontend.OutputGoal; -import polyglot.frontend.Scheduler; -import polyglot.frontend.VisitorGoal; -import polyglot.main.Options; -import polyglot.main.Report; -import polyglot.types.MemberClassResolver; -import polyglot.types.SemanticException; -import polyglot.types.TopLevelResolver; -import polyglot.types.TypeSystem; -import polyglot.util.ErrorQueue; -import polyglot.visit.PostCompiled; -import polyglot.util.InternalCompilerError; - - -/** - * Extension information for x10 extension. - * @author vj -- Adapted from the Polyglot2 ExtensionsInfo for X10 1.5 - */ -public class ExtensionInfo extends polyglot.ext.x10.ExtensionInfo { - - - public String compilerName() { - return "x10c++"; - } - - public polyglot.main.Version version() { - return new Version(); - } - - protected NodeFactory createNodeFactory() { - return new X10NodeFactory_c(this, new X10CPPExtFactory_c(), new X10CPPDelFactory_c()) { }; - } - - protected TypeSystem createTypeSystem() { - return new X10CPPTypeSystem_c(); - } - - @Override - protected void initTypeSystem() { - // Inline from superclass, replacing SourceClassResolver - try { - if (Configuration.MANIFEST == null) { - String[] MANIFEST_LOCATIONS = X10CPPTranslator.MANIFEST_LOCATIONS; - for (int i = 0; i < MANIFEST_LOCATIONS.length; i++) { - File x10lang_m = new File(MANIFEST_LOCATIONS[i]+"/"+X10CPPTranslator.MANIFEST); - if (!x10lang_m.exists()) - continue; - Configuration.MANIFEST = x10lang_m.getPath(); - } - } ... [truncated message content] |
From: <vj...@us...> - 2009-08-14 03:50:45
|
Revision: 11001 http://x10.svn.sourceforge.net/x10/?rev=11001&view=rev Author: vj0 Date: 2009-08-14 02:47:54 +0000 (Fri, 14 Aug 2009) Log Message: ----------- Fixed regressions introduced by 10967. snapshot default Constructs.Array ArrayAccessEqualRank FAILURE Details snapshot default Constructs.Array ArrayAccessEqualRank2 FAILURE Details snapshot default Constructs.Array ArrayIndexWithPoint FAILURE Details snapshot default Constructs.Async ClockAsyncTest FAILURE Details snapshot default Constructs.AtEach AtEach FAILURE Details Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/X10Loop_c.java trunk/x10.tests/examples/Constructs/Array/ArrayIndexWithPoint.x10 Modified: trunk/x10.compiler/src/x10/ast/X10Loop_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Loop_c.java 2009-08-13 23:06:47 UTC (rev 11000) +++ trunk/x10.compiler/src/x10/ast/X10Loop_c.java 2009-08-14 02:47:54 UTC (rev 11001) @@ -181,9 +181,6 @@ } } - /*if (true) - return this;*/ - try { throw new SemanticException("Loop domain " + domainType + " is not a subtype of Iterable[" + formalType + "].", position()); } @@ -379,6 +376,7 @@ Type base = X10TypeMixin.baseType(domainType); XConstraint c = X10TypeMixin.xclause(domainType); + XVar selfValue = X10TypeMixin.selfVar(domainType); XVar selfVar = c != null ? c.self() : null; XRoot thisVar = base instanceof X10ClassType ? ((X10ClassType) base).x10Def().thisVar() @@ -386,8 +384,9 @@ if (thisVar != null && selfVar != null) try { - // Generate a new local variable - XVar var = c.genEQV(false); + + // Generate a new local variable if needed + XVar var = selfValue != null ? selfValue : c.genEQV(false); // And substitute it for this in indexType indexType = Subst.subst(indexType, var, thisVar); if (ts.isSubtype(indexType, ts.Point(),tcp.context())) { @@ -412,9 +411,10 @@ } // and add self=this in domainType, updating domainTypeRef. - domainType = X10TypeMixin.addBinding(domainType, var, selfVar); - assert domainType !=null : "help!!"; - domainTypeRef.update(domainType); + if (selfValue == null) { + domainType = X10TypeMixin.addBinding(domainType, var, selfVar); + domainTypeRef.update(domainType); + } } catch (SemanticException e) { } Modified: trunk/x10.tests/examples/Constructs/Array/ArrayIndexWithPoint.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayIndexWithPoint.x10 2009-08-13 23:06:47 UTC (rev 11000) +++ trunk/x10.tests/examples/Constructs/Array/ArrayIndexWithPoint.x10 2009-08-14 02:47:54 UTC (rev 11001) @@ -14,10 +14,10 @@ public class ArrayIndexWithPoint extends x10Test { - public def run(): boolean = { + public def run() { val e = 1..10; val ia = Array.make[int](e->here, (Point)=>0); - for (val p in ia.region) // should infer p:Point(region.rank). + for (p in ia.region) chk(ia(p)==0); return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spa...@us...> - 2009-08-14 23:09:38
|
Revision: 11033 http://x10.svn.sourceforge.net/x10/?rev=11033&view=rev Author: sparksparkspark Date: 2009-08-14 23:09:29 +0000 (Fri, 14 Aug 2009) Log Message: ----------- Add function to get size of a primitive from type system. Remove dead ArrayType class Add "cuda" native annotation, used only when compiling a kernel, falls back to "c++" if "cuda" not found Add x10cuda to build.xml Modified Paths: -------------- trunk/x10.compiler/build.xml trunk/x10.compiler/src/x10/types/X10TypeSystem.java trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.compiler/src/x10cpp/visit/ASTQuery.java trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.compiler/src/x10cpp/visit/SharedVarsMethods.java trunk/x10.compiler/src/x10cuda/types/SharedMem.java trunk/x10.compiler/src/x10cuda/visit/CUDACodeGenerator.java trunk/x10.runtime/src-x10/x10/lang/Float.x10 trunk/x10.runtime/src-x10/x10/lang/Rail.x10 trunk/x10.runtime/src-x10/x10/lang/ValRail.x10 Removed Paths: ------------- trunk/x10.compiler/src/x10/types/X10ArrayType.java trunk/x10.compiler/src/x10/types/X10ArrayType_c.java Modified: trunk/x10.compiler/build.xml =================================================================== --- trunk/x10.compiler/build.xml 2009-08-14 21:43:40 UTC (rev 11032) +++ trunk/x10.compiler/build.xml 2009-08-14 23:09:29 UTC (rev 11033) @@ -66,7 +66,7 @@ </target> <target name="jar" depends="build"> <jar jarfile="${build}/${jar}"> - <fileset dir="${build}" includes="org/**,x10/**,x10cpp/**,x10c/**,data/**" excludes="${jar}"/> + <fileset dir="${build}" includes="org/**,x10/**,x10cpp/**,x10c/**,x10cuda/**,data/**" excludes="${jar}"/> <fileset dir="${x10.constraints.location}/classes" includes="x10/constraint/**" excludes="x10/constraint/test/**"/> <fileset dir="${x10.common.location}/classes" includes="x10/**"/> </jar> @@ -83,7 +83,7 @@ </target> <target name="build" depends="init,prereq-jars"> <echo message="${ant.project.name}: ${ant.file}"/> - <javac destdir="${build}" source="1.5" target="1.5" debug="on" includes="x10/**,x10c/**,x10cpp/**," excludes="polyglot/ext/x10/dom/**,polyglot/ext/x10/plugin/**,polyglot/ext/x10/visit/Propagate*AnnotationsVisitor.java"> + <javac destdir="${build}" source="1.5" target="1.5" debug="on" includes="x10/**,x10c/**,x10cpp/**,x10cuda/**" excludes="polyglot/ext/x10/dom/**,polyglot/ext/x10/plugin/**,polyglot/ext/x10/visit/Propagate*AnnotationsVisitor.java"> <src path="${src}"/> <classpath refid="project.classpath"/> </javac> Deleted: trunk/x10.compiler/src/x10/types/X10ArrayType.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10ArrayType.java 2009-08-14 21:43:40 UTC (rev 11032) +++ trunk/x10.compiler/src/x10/types/X10ArrayType.java 2009-08-14 23:09:29 UTC (rev 11033) @@ -1,15 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ - -package x10.types; - -import polyglot.types.ArrayType; - -public interface X10ArrayType extends X10NamedType, ArrayType { - -} Deleted: trunk/x10.compiler/src/x10/types/X10ArrayType_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10ArrayType_c.java 2009-08-14 21:43:40 UTC (rev 11032) +++ trunk/x10.compiler/src/x10/types/X10ArrayType_c.java 2009-08-14 23:09:29 UTC (rev 11033) @@ -1,70 +0,0 @@ -/* - * - * (C) Copyright IBM Corporation 2006-2008. - * - * This file is part of X10 Language. - * - */ - -package x10.types; - -import polyglot.types.ArrayType_c; -import polyglot.types.Flags; -import polyglot.types.Named; -import polyglot.types.QName; -import polyglot.types.Ref; -import polyglot.types.Name; -import polyglot.types.Type; -import polyglot.types.TypeSystem; -import polyglot.util.Position; - -public class X10ArrayType_c extends ArrayType_c implements X10ArrayType { - public X10ArrayType_c(TypeSystem ts, Position pos, Ref<? extends Type> base) { - super(ts, pos, base); - } - - public boolean isGloballyAccessible() { - return false; - } - - public Name name() { return ((Named) base).name();} - public QName fullName() { return ((Named) base).fullName();} - - public boolean safe() { - return true; - } - - public String toString() { - StringBuffer sb = new StringBuffer(); - sb.append(super.toString()); - return sb.toString(); - } - // TODO: vj check if this can have any flags in reality. - // begin Flagged mixin - Flags flags; - public Flags flags() { return flags;} - - public X10Type setFlags(Flags f) { - X10Flags xf = (X10Flags) f; - X10ArrayType_c c = (X10ArrayType_c) this.copy(); - if (c.flags == null) - c.flags = X10Flags.toX10Flags(Flags.NONE); - c.flags = xf.isRooted() - ? (xf.isStruct() ? ((X10Flags) c.flags).Rooted().Struct() : ((X10Flags) c.flags).Rooted()) - : ((xf.isStruct()) ? ((X10Flags) c.flags).Struct() : c.flags); - return c; - } - public X10Type clearFlags(Flags f) { - X10ArrayType_c c = (X10ArrayType_c) this.copy(); - if (c.flags == null) - c.flags = X10Flags.toX10Flags(Flags.NONE); - c.flags = c.flags.clear(f); - return c; - } - public boolean isRooted() { return flags == null ? false : ((X10Flags) flags).isRooted(); } - public boolean isX10Struct() { return flags == null ? false : ((X10Flags) flags).isStruct(); } - - public boolean equalsNoFlag(X10Type t2) { - return this == t2; - } -} Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem.java 2009-08-14 21:43:40 UTC (rev 11032) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem.java 2009-08-14 23:09:29 UTC (rev 11033) @@ -345,5 +345,7 @@ boolean isSigned(Type l); boolean numericConversionValid(Type toType, Type fromType, Object constantValue, Context context); + + public Long size(Type t); } Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2009-08-14 21:43:40 UTC (rev 11032) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2009-08-14 23:09:29 UTC (rev 11033) @@ -2478,5 +2478,18 @@ X10Context xc = (X10Context) context; return env(context).isSubtypeWithValueInterfaces(t1, t2); } + + // Returns the number of bytes required to represent the type, or null if unknown (e.g. involves an address somehow) + public Long size(Type t) { + if (t.isFloat()) return 4l; + if (t.isDouble()) return 8l; + if (t.isChar()) return 2l; + if (t.isByte()) return 1l; + if (t.isShort()) return 2l; + if (t.isInt()) return 4l; + if (t.isLong()) return 8l; + // TODO: rails & valrails + return null; + } } Modified: trunk/x10.compiler/src/x10cpp/visit/ASTQuery.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/ASTQuery.java 2009-08-14 21:43:40 UTC (rev 11032) +++ trunk/x10.compiler/src/x10cpp/visit/ASTQuery.java 2009-08-14 23:09:29 UTC (rev 11033) @@ -1,6 +1,6 @@ package x10cpp.visit; -import static x10cpp.visit.SharedVarsMethods.NATIVE_STRING; +import static x10cpp.visit.SharedVarsMethods.CPP_NATIVE_STRING; import java.util.ArrayList; import java.util.Arrays; @@ -296,7 +296,7 @@ for (Type at : as) { assertNumberOfInitializers(at, 4); String lang = getPropertyInit(at, 0); - if (lang != null && lang.equals(NATIVE_STRING)) { + if (lang != null && lang.equals(CPP_NATIVE_STRING)) { return getPropertyInit(at, i); } } Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2009-08-14 21:43:40 UTC (rev 11032) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2009-08-14 23:09:29 UTC (rev 11033) @@ -26,7 +26,7 @@ import static x10cpp.visit.SharedVarsMethods.DESERIALIZE_METHOD; import static x10cpp.visit.SharedVarsMethods.INSTANCE_INIT; import static x10cpp.visit.SharedVarsMethods.MAKE; -import static x10cpp.visit.SharedVarsMethods.NATIVE_STRING; +import static x10cpp.visit.SharedVarsMethods.CPP_NATIVE_STRING; import static x10cpp.visit.SharedVarsMethods.SAVED_THIS; import static x10cpp.visit.SharedVarsMethods.SERIALIZATION_BUFFER; import static x10cpp.visit.SharedVarsMethods.SERIALIZATION_ID_FIELD; @@ -3491,20 +3491,26 @@ assert (false) : ("Function assign should have been desugared earlier"); } + // allow overriding in subclasses + // [DC] FIXME: ASTQuery.getCppRepParam still uses CPP_NATIVE_STRING directly + protected String[] getCurrentNativeStrings() { return new String[] {CPP_NATIVE_STRING}; } - private static String getCppImplForDef(X10Def o) { + private String getCppImplForDef(X10Def o) { X10TypeSystem xts = (X10TypeSystem) o.typeSystem(); try { - Type java = (Type) xts.systemResolver().find(QName.make("x10.compiler.Native")); - List<Type> as = o.annotationsMatching(java); - for (Type at : as) { - assertNumberOfInitializers(at, 2); - String lang = getPropertyInit(at, 0); - if (lang != null && lang.equals(NATIVE_STRING)) { - String lit = getPropertyInit(at, 1); - return lit; - } - } + Type annotation = (Type) xts.systemResolver().find(QName.make("x10.compiler.Native")); + String[] our_langs = getCurrentNativeStrings(); + for (String our_lang : our_langs) { + List<Type> as = o.annotationsMatching(annotation); + for (Type at : as) { + assertNumberOfInitializers(at, 2); + String lang = getPropertyInit(at, 0); + if (lang != null && lang.equals(our_lang)) { + String lit = getPropertyInit(at, 1); + return lit; + } + } + } } catch (SemanticException e) {} return null; Modified: trunk/x10.compiler/src/x10cpp/visit/SharedVarsMethods.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/SharedVarsMethods.java 2009-08-14 21:43:40 UTC (rev 11032) +++ trunk/x10.compiler/src/x10cpp/visit/SharedVarsMethods.java 2009-08-14 23:09:29 UTC (rev 11033) @@ -63,8 +63,8 @@ static final boolean refsAsPointers = false; static final String VOID = "void"; static final String VOID_PTR = "void*"; - static final String SAVED_THIS = "saved_this"; - static final String THIS = "this"; + public static final String SAVED_THIS = "saved_this"; + public static final String THIS = "this"; static final String INSTANCE_INIT = "_instance_init"; // instance field initialisers static final String CONSTRUCTOR = "_constructor"; static final String MAKE = "_make"; @@ -84,7 +84,8 @@ static final String VIM_MODELINE = "vim:tabstop=4:shiftwidth=4:expandtab"; - static final String NATIVE_STRING = "c++"; + public static final String CPP_NATIVE_STRING = "c++"; + public static final String CUDA_NATIVE_STRING = "cuda"; public static String chevrons(String type) { return "<" + type + (type.endsWith(">")?" ":"")+">"; Modified: trunk/x10.compiler/src/x10cuda/types/SharedMem.java =================================================================== --- trunk/x10.compiler/src/x10cuda/types/SharedMem.java 2009-08-14 21:43:40 UTC (rev 11032) +++ trunk/x10.compiler/src/x10cuda/types/SharedMem.java 2009-08-14 23:09:29 UTC (rev 11033) @@ -5,6 +5,8 @@ import polyglot.ast.Expr; import polyglot.ast.LocalDecl; import polyglot.types.Name; +import polyglot.types.Type; +import x10.types.X10TypeSystem; public class SharedMem { @@ -12,6 +14,13 @@ private abstract static class Decl { public final LocalDecl ast; + public long bytes() { + Type t = ast.type().type(); + X10TypeSystem xts = (X10TypeSystem) t.typeSystem(); + Long bytes = xts.size(t); + assert bytes != null : t; + return bytes.longValue(); + } public Decl (LocalDecl ast) { this.ast = ast; } } Modified: trunk/x10.compiler/src/x10cuda/visit/CUDACodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cuda/visit/CUDACodeGenerator.java 2009-08-14 21:43:40 UTC (rev 11032) +++ trunk/x10.compiler/src/x10cuda/visit/CUDACodeGenerator.java 2009-08-14 23:09:29 UTC (rev 11033) @@ -13,7 +13,10 @@ package x10cuda.visit; - +import static x10cpp.visit.SharedVarsMethods.CUDA_NATIVE_STRING; +import static x10cpp.visit.SharedVarsMethods.CPP_NATIVE_STRING; +import static x10cpp.visit.SharedVarsMethods.THIS; +import static x10cpp.visit.SharedVarsMethods.SAVED_THIS; import polyglot.ast.ArrayInit_c; import polyglot.ast.Assert_c; import polyglot.ast.Assign_c; @@ -123,6 +126,10 @@ super(sw,tr); } + protected String[] getCurrentNativeStrings() { + if (!generatingKernel()) return new String[] { CPP_NATIVE_STRING }; + return new String[] { CUDA_NATIVE_STRING, CPP_NATIVE_STRING }; + } private X10CUDAContext_c context() { return (X10CUDAContext_c) tr.context(); @@ -184,52 +191,58 @@ sw.write("/* block split-compiled to cuda as "+kernel_name+" */ "); ClassifiedStream out = cudaStream(); - // disable name-mangling which seems to be inconsistent across cuda versions + + // environment (passed into kernel via pointer) out.write("struct "+kernel_name+"_env {"); out.newline(4); out.begin(0); - emitter.printDeclarationList(out, context(), context().kernelParams()); - /* + //emitter.printDeclarationList(out, context(), context().kernelParams()); for (VarInstance var : context().kernelParams()) { Type t = var.type(); - String type = emitter.translateType(t, true); + String type = Emitter.translateType(t, true); if (isIntRail(t)) { - type = "x10_int **"; + type = "x10_int *"; } else if (isFloatRail(t)) { - type = "x10_float **"; + type = "x10_float *"; + } else { + type = type + " "; } String name = var.name().toString(); if (name.equals(THIS)) { name = SAVED_THIS; + } else { + name = Emitter.mangled_non_method_name(name); } - - else { - name = emitter.mangled_non_method_name(name); - } out.write(type + name + ";"); out.newline(); } - */ out.end(); out.newline(); - out.write("};"); out.newline(); out.forceNewline(); - out.write("extern \"C\" __global__ void "+kernel_name+"("+kernel_name+"_env *"+env+")"); out.newline(); + out.write("};"); out.newline(); - // decode buffer - //out.write(" var = *(*T)buf; buf += sizeof(T);") + out.forceNewline(); + // 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+") {"); out.newline(4); out.begin(0); + + // shm + out.write("// shm"); out.newline(); + /* + for (context().shm()) { + out.write(); + } + */ +/* + float *new_clusterv = (float*) dyn_shm; // [DIM*clusterc_odd] + int *new_counterv = (int*)&new_clusterv[DIM*clusterc_odd]; // [clusterc] +*/ + // body - //X10CUDAContext_c save_ctxt = context(); - - //TypeSystem ts = tr.typeSystem(); - //context(ts.emptyContext()); - //context((Context)save_ctxt.copy()); sw.pushCurrentStream(out); super.visit(b); sw.popCurrentStream(); - out.write(" // "+kernel_name); - //context(save_ctxt); - // end + out.end(); out.newline(); + out.write("} // "+kernel_name); out.forceNewline(); } Modified: trunk/x10.runtime/src-x10/x10/lang/Float.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Float.x10 2009-08-14 21:43:40 UTC (rev 11032) +++ trunk/x10.runtime/src-x10/x10/lang/Float.x10 2009-08-14 23:09:29 UTC (rev 11033) @@ -93,10 +93,12 @@ @Native("java", "java.lang.Float.MAX_VALUE") @Native("c++", "x10aux::float_utils::fromIntBits(0x7f7fffff)") + @Native("cuda", "FLT_MAX") public const MAX_VALUE: Float = Float.fromIntBits(0x7f7fffff); @Native("java", "java.lang.Float.MIN_VALUE") @Native("c++", "x10aux::float_utils::fromIntBits(0x00800000)") + @Native("cuda", "FLT_MIN") public const MIN_VALUE: Float = Float.fromIntBits(0x00800000); @Native("java", "java.lang.Float.toHexString(#0)") Modified: trunk/x10.runtime/src-x10/x10/lang/Rail.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Rail.x10 2009-08-14 21:43:40 UTC (rev 11032) +++ trunk/x10.runtime/src-x10/x10/lang/Rail.x10 2009-08-14 23:09:29 UTC (rev 11033) @@ -50,10 +50,12 @@ @Native("java", "#0.apply(#1)") @Native("c++", "(*#0)[#1]") + @Native("cuda", "(#0)[#1]") public native safe def apply(i: nat): T; @Native("java", "#0.set(#1, #2)") @Native("c++", "(*#0)[#2] = #1") + @Native("cuda", "(#0)[#2] = #1") public native safe def set(v: T, i: nat): T; @Native("java", "#0.iterator()") Modified: trunk/x10.runtime/src-x10/x10/lang/ValRail.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/ValRail.x10 2009-08-14 21:43:40 UTC (rev 11032) +++ trunk/x10.runtime/src-x10/x10/lang/ValRail.x10 2009-08-14 23:09:29 UTC (rev 11033) @@ -37,6 +37,7 @@ @Native("java", "#0.apply(#1)") @Native("c++", "(*#0)[#1]") + @Native("cuda", "(#0)[#1]") public native def apply(i: nat): T; @Native("java", "#0.iterator()") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2009-08-21 15:34:21
|
Revision: 11059 http://x10.svn.sourceforge.net/x10/?rev=11059&view=rev Author: dgrove-oss Date: 2009-08-21 15:34:13 +0000 (Fri, 21 Aug 2009) Log Message: ----------- Merge of placeLocal branch into the trunk. Modified Paths: -------------- trunk/x10.dist/samples/FRASimpleDist.x10 trunk/x10.dist/samples/KMeansDist.x10 trunk/x10.runtime/src-cpp/Makefile trunk/x10.runtime/src-cpp/x10aux/RTT.h trunk/x10.runtime/src-cpp/x10aux/bootstrap.h trunk/x10.runtime/src-cpp/x10rt17.h trunk/x10.runtime/src-x10/x10/array/DistArray.x10 Added Paths: ----------- trunk/x10.runtime/src-cpp/x10/runtime/PlaceLocalHandle.cc trunk/x10.runtime/src-cpp/x10/runtime/PlaceLocalHandle.h trunk/x10.runtime/src-cpp/x10aux/place_local.cc trunk/x10.runtime/src-cpp/x10aux/place_local.h trunk/x10.runtime/src-java/x10/runtime/impl/java/PlaceLocalHandle.java trunk/x10.runtime/src-x10/x10/runtime/PlaceLocalHandle.x10 trunk/x10.runtime/src-x10/x10/runtime/PlaceLocalStorage.x10 Removed Paths: ------------- trunk/x10.runtime/src-x10/x10/array/PlaceLocal.x10 Property Changed: ---------------- trunk/x10.common/ trunk/x10.compiler/ trunk/x10.dist/ trunk/x10.runtime/ trunk/x10.runtime/src-cpp/x10aux/network.cc trunk/x10.runtime/src-cpp/x10aux/network.h trunk/x10.tests/ Property changes on: trunk/x10.common ___________________________________________________________________ Modified: svn:mergeinfo - /branches/itable/x10.common.17:10541-10846 + /branches/itable/x10.common.17:10541-10846 /branches/placeLocal/x10.common:11035-11056 Property changes on: trunk/x10.compiler ___________________________________________________________________ Modified: svn:mergeinfo - /branches/itable/x10.compiler.p3:10541-10846 + /branches/itable/x10.compiler.p3:10541-10846 /branches/placeLocal/x10.compiler:11035-11056 Property changes on: trunk/x10.dist ___________________________________________________________________ Modified: svn:mergeinfo - /branches/itable/x10.dist:10541-10846 + /branches/itable/x10.dist:10541-10846 /branches/placeLocal/x10.dist:11035-11056 Modified: trunk/x10.dist/samples/FRASimpleDist.x10 =================================================================== --- trunk/x10.dist/samples/FRASimpleDist.x10 2009-08-21 15:30:33 UTC (rev 11058) +++ trunk/x10.dist/samples/FRASimpleDist.x10 2009-08-21 15:34:13 UTC (rev 11059) @@ -5,6 +5,8 @@ import x10.util.Timer; import x10.runtime.NativeRuntime; +import x10.runtime.PlaceLocalHandle; +import x10.runtime.PlaceLocalStorage; value LocalTable { @@ -56,9 +58,9 @@ } static def randomAccessUpdate( - num_updates: long, + num_updates: long, logLocalTableSize: long, - tables: ValRail[LocalTable] + tables: PlaceLocalHandle[LocalTable] ) { finish for (var p:int=0; p<Place.MAX_PLACES; p++) { val valp = p; @@ -67,9 +69,8 @@ for (var i:long=0; i<num_updates/Place.MAX_PLACES; i++) { val placeId = ((ran>>logLocalTableSize) & (Place.MAX_PLACES-1)) as int; val valran = ran; - val table = tables(placeId); async (Place.places(placeId)) { - table.update(valran); + tables.get().update(valran); } ran = (ran << 1) ^ (ran<0L ? POLY : 0L); } @@ -93,16 +94,8 @@ val num_updates = 4*tableSize; // create local tables - val varTables = Rail.makeVar[LocalTable](Place.MAX_PLACES); - finish for (var p:int=0; p<Place.MAX_PLACES; p++) { - val pp = p; - async (Place.places(p)) { - val t = new LocalTable(localTableSize); - async (Place.places(0)) - varTables(pp) = t; - } - } - val tables = Rail.makeVal[LocalTable](Place.MAX_PLACES, (x:Int) => varTables(x)); + val init:(Place)=>LocalTable = (p:Place) => new LocalTable(localTableSize); + val tables = PlaceLocalStorage.createDistributedObject(Dist.makeUnique(), init); // print some info println("Main table size = 2^" +logLocalTableSize + "*" + Place.MAX_PLACES+" = " + tableSize+ " words"); @@ -122,8 +115,8 @@ // repeat for testing. randomAccessUpdate(num_updates, logLocalTableSize, tables); for (var i:int=0; i<Place.MAX_PLACES; i++) { - val table = tables(i); async (Place.places(i)) { + val table = tables.get(); var err:int = 0; for (var j:int=0; j<table.a.length; j++) if (table.a(j) != j) err++; Modified: trunk/x10.dist/samples/KMeansDist.x10 =================================================================== --- trunk/x10.dist/samples/KMeansDist.x10 2009-08-21 15:30:33 UTC (rev 11058) +++ trunk/x10.dist/samples/KMeansDist.x10 2009-08-21 15:34:13 UTC (rev 11059) @@ -1,23 +1,25 @@ import x10.io.Console; import x10.util.Random; +import x10.runtime.PlaceLocalStorage; +import x10.runtime.PlaceLocalHandle; public class KMeansDist { static val DIM=2, CLUSTERS=4, POINTS=2000, ITERATIONS=50; static val points_region = [0,0]..[POINTS-1,DIM-1]; - static val clusters_region = [0,0]..[CLUSTERS-1,DIM-1]; - static val rnd = new Random(0); - - static val local_curr_clusters = Rail.makeVar[Float](CLUSTERS*DIM, (i:Int) => 0 as Float); - static val local_new_clusters = Rail.makeVar[Float](CLUSTERS*DIM, (i:Int) => 0 as Float); - static val local_cluster_counts = Rail.makeVar[Int](CLUSTERS, (i:Int) => 0); - public static def main (args : Rail[String]) { + val rnd = PlaceLocalStorage.createDistributedObject(Dist.makeUnique(), (p:Place) => new Random(0)); + val local_curr_clusters = PlaceLocalStorage.createDistributedObject(Dist.makeUnique(), + (p:Place) => Rail.makeVar[Float](CLUSTERS*DIM, (i:Int) => 0 as Float)); + val local_new_clusters = PlaceLocalStorage.createDistributedObject(Dist.makeUnique(), + (p:Place) => Rail.makeVar[Float](CLUSTERS*DIM, (i:Int) => 0 as Float)); + val local_cluster_counts = PlaceLocalStorage.createDistributedObject(Dist.makeUnique(), + (p:Place)=> Rail.makeVar[Int](CLUSTERS, (i:Int) => 0)); val points_dist = Dist.makeBlock(points_region, 0); - val points = Array.makeVal[Float](points_dist, (p:Point)=>rnd.nextFloat()); + val points = Array.makeVal[Float](points_dist, (p:Point)=>rnd.get().nextFloat()); val central_clusters = Rail.makeVar[Float](CLUSTERS*DIM, (i:Int) => { val p = Point.make([i/DIM, i%DIM]); @@ -34,18 +36,18 @@ val central_clusters_copy = Rail.makeVal(CLUSTERS*DIM, (i:Int) => central_clusters(i)); for (var j:Int=0 ; j<CLUSTERS ; ++j) { - local_cluster_counts(j) = 0; + local_cluster_counts.get()(j) = 0; } finish { // reset state for (d in points_dist.places()) async(d) { for (var j:Int=0 ; j<DIM*CLUSTERS ; ++j) { - local_curr_clusters(j) = central_clusters_copy(j); - local_new_clusters(j) = 0; + local_curr_clusters.get()(j) = central_clusters_copy(j); + local_new_clusters.get()(j) = 0; } for (var j:Int=0 ; j<CLUSTERS ; ++j) { - local_cluster_counts(j) = 0; + local_cluster_counts.get()(j) = 0; } } } @@ -60,7 +62,7 @@ for (var k:Int=0 ; k<CLUSTERS ; ++k) { var dist : Float = 0; for (var d:Int=0 ; d<DIM ; ++d) { - val tmp = points(Point.make(p,d)) - local_curr_clusters(k*DIM+d); + val tmp = points(Point.make(p,d)) - local_curr_clusters.get()(k*DIM+d); dist += tmp * tmp; } if (dist < closest_dist) { @@ -69,9 +71,9 @@ } } for (var d:Int=0 ; d<DIM ; ++d) { - local_new_clusters(closest*DIM+d) += points(Point.make(p,d)); + local_new_clusters.get()(closest*DIM+d) += points(Point.make(p,d)); } - local_cluster_counts(closest)++; + local_cluster_counts.get()(closest)++; } } } @@ -88,15 +90,15 @@ for (d in points_dist.places()) async(d) { // have to create valrails for serialisation val local_new_clusters_copy = - Rail.makeVal(CLUSTERS*DIM, (i:Int) => local_new_clusters(i)); + Rail.makeVal(CLUSTERS*DIM, (i:Int) => local_new_clusters.get()(i)); val local_cluster_counts_copy = - Rail.makeVal(CLUSTERS, (i:Int) => local_cluster_counts(i)); + Rail.makeVal(CLUSTERS, (i:Int) => local_cluster_counts.get()(i)); at (Place.FIRST_PLACE) atomic { for (var j:Int=0 ; j<DIM*CLUSTERS ; ++j) { - central_clusters(j) += local_new_clusters(j); + central_clusters(j) += local_new_clusters.get()(j); } for (var j:Int=0 ; j<CLUSTERS ; ++j) { - central_cluster_counts(j) += local_cluster_counts(j); + central_cluster_counts(j) += local_cluster_counts.get()(j); } } } Property changes on: trunk/x10.runtime ___________________________________________________________________ Modified: svn:mergeinfo - /branches/itable/x10.runtime.17:10541-10846 + /branches/itable/x10.runtime.17:10541-10846 /branches/placeLocal/x10.runtime:11035-11056 Modified: trunk/x10.runtime/src-cpp/Makefile =================================================================== --- trunk/x10.runtime/src-cpp/Makefile 2009-08-21 15:30:33 UTC (rev 11058) +++ trunk/x10.runtime/src-cpp/Makefile 2009-08-21 15:34:13 UTC (rev 11059) @@ -179,6 +179,7 @@ x10aux/long_utils.o \ x10aux/math_utils.o \ x10aux/network.o \ + x10aux/place_local.o \ x10aux/ref.o \ x10aux/reference_logger.o \ x10aux/RTT.o \ @@ -205,6 +206,7 @@ x10/lang/ValRail.o \ x10/runtime/Deque.o \ x10/runtime/Lock.o \ + x10/runtime/PlaceLocalHandle.o \ x10/runtime/Thread.o \ x10/tuningfork/ScalarType.o \ x10/util/GrowableRail.o \ Copied: trunk/x10.runtime/src-cpp/x10/runtime/PlaceLocalHandle.cc (from rev 11056, branches/placeLocal/x10.runtime/src-cpp/x10/runtime/PlaceLocalHandle.cc) =================================================================== --- trunk/x10.runtime/src-cpp/x10/runtime/PlaceLocalHandle.cc (rev 0) +++ trunk/x10.runtime/src-cpp/x10/runtime/PlaceLocalHandle.cc 2009-08-21 15:34:13 UTC (rev 11059) @@ -0,0 +1,27 @@ +#include <x10aux/config.h> +#include <x10aux/alloc.h> +#include <x10aux/RTT.h> + +#include <x10/lang/Ref.h> +#include <x10/runtime/PlaceLocalHandle.h> + +using namespace x10aux; +using namespace x10::lang; + +namespace x10 { + namespace runtime { + + x10aux::RuntimeType PlaceLocalHandle<void>::rtt; + + void + _initRTTHelper_PlaceLocalHandle(RuntimeType *location, const RuntimeType *rtt) { + const RuntimeType* parents[1] = { Value::getRTT()}; + const RuntimeType* params[1] = { rtt }; + RuntimeType::Variance variances[1] = { RuntimeType::invariant }; + const RuntimeType *canonical = x10aux::getRTT<PlaceLocalHandle<void> >(); + const char *name = alloc_printf("x10.runtime.PlaceLocalHandle[+%s]",rtt->name()); + location->init(canonical, name, 1, parents, 1, params, variances); + } + } +} + Copied: trunk/x10.runtime/src-cpp/x10/runtime/PlaceLocalHandle.h (from rev 11056, branches/placeLocal/x10.runtime/src-cpp/x10/runtime/PlaceLocalHandle.h) =================================================================== --- trunk/x10.runtime/src-cpp/x10/runtime/PlaceLocalHandle.h (rev 0) +++ trunk/x10.runtime/src-cpp/x10/runtime/PlaceLocalHandle.h 2009-08-21 15:34:13 UTC (rev 11059) @@ -0,0 +1,128 @@ +#ifndef X10_RUNTIME_PLACELOCALHANDLE_H +#define X10_RUNTIME_PLACELOCALHANDLE_H + +#include <x10rt17.h> + +#include <x10/lang/Value.h> +#include <x10/lang/String.h> + +namespace x10 { + namespace runtime { + + void _initRTTHelper_PlaceLocalHandle(x10aux::RuntimeType *location, const x10aux::RuntimeType *rtt); + + template <class T> class PlaceLocalHandle : public x10::lang::Value { + public: + RTT_H_DECLS_CLASS; + + T FMGL(localStorage); + x10_int FMGL(id); + bool FMGL(cached); + + static x10aux::ref<PlaceLocalHandle<T> > createHandle() { + x10_int id = x10aux::place_local::nextId(); + return (new (x10aux::alloc<PlaceLocalHandle<T> >())PlaceLocalHandle<T>())->_constructor(id); + } + + x10aux::ref<PlaceLocalHandle<T> > _constructor(x10_int id_) { + FMGL(id) = id_; + FMGL(cached) = false; + return this; + } + + virtual void set(T newVal) { + assert(!FMGL(cached)); + FMGL(localStorage) = newVal; + FMGL(cached) = true; + x10aux::place_local::registerHandle(FMGL(id), (void*)this); + } + + virtual T get() { + if (!FMGL(cached)) { + PlaceLocalHandle<T> *tmp = (PlaceLocalHandle<T> *)(x10aux::place_local::lookupHandle(FMGL(id))); + assert(NULL != tmp); // TODO: throw proper exception and/or implement lazy creation. + FMGL(localStorage) = tmp->FMGL(localStorage); + FMGL(cached) = true; + } + return FMGL(localStorage); + } + + virtual x10_int hashCode() { + return x10aux::hash_code(FMGL(id)); + } + + virtual x10aux::ref<x10::lang::String> toString() { + if (FMGL(cached)) { + return x10aux::to_string(FMGL(localStorage)); + } else { + assert(false); // TODO + } + } + + static const x10aux::serialization_id_t _serialization_id; + + static void _serialize(x10aux::ref<PlaceLocalHandle<T> > this_, + x10aux::serialization_buffer &buf, + x10aux::addr_map &m); + virtual x10aux::serialization_id_t _get_serialization_id() { return _serialization_id; }; + void _serialize_body(x10aux::serialization_buffer &buf, x10aux::addr_map &m); + template<class S> static x10aux::ref<S> _deserialize(x10aux::deserialization_buffer &buf); + }; + + + template <> class PlaceLocalHandle<void> : public x10::lang::Value { + public: + static x10aux::RuntimeType rtt; + static void _static_init() { } + static const x10aux::RuntimeType* getRTT() { return &rtt; } + }; + + template<class T> void PlaceLocalHandle<T>::_initRTT() { + rtt.canonical = &rtt; + x10::runtime::_initRTTHelper_PlaceLocalHandle(&rtt, x10aux::getRTT<T>()); + } + + template<class T> x10aux::RuntimeType PlaceLocalHandle<T>::rtt; + + template<class T> const x10aux::serialization_id_t PlaceLocalHandle<T>::_serialization_id = + x10aux::DeserializationDispatcher::addDeserializer(PlaceLocalHandle<T>::template _deserialize<Object>); + + + template <class T> void PlaceLocalHandle<T>::_serialize(x10aux::ref<PlaceLocalHandle<T> > this_, + x10aux::serialization_buffer &buf, + x10aux::addr_map &m) { + // TODO: This happens when an uninitialized place local handle is serialized as part of its + // containing object (when the this pointer of a constructor escapes). + // Arguably, this should be reported as a static type error by the compiler. + if (this_ == x10aux::null) { + buf.write((x10_int)-1,m); + } else { + this_->_serialize_body(buf, m); + } + } + + template <class T> void PlaceLocalHandle<T>::_serialize_body(x10aux::serialization_buffer &buf, x10aux::addr_map &m) { + // NOTE specialized semantics. Only id is serialized, cached and localStorage are place local! + buf.write(this->FMGL(id),m); + } + + template <class T> template<class S> x10aux::ref<S> PlaceLocalHandle<T>::_deserialize(x10aux::deserialization_buffer &buf) { + x10_int id = buf.read<x10_int>(); + if (id == -1) { + return NULL; + } + PlaceLocalHandle<T> *tmp = (PlaceLocalHandle<T> *)(x10aux::place_local::lookupHandle(id)); + if (NULL != tmp) { + // We already have a PlaceLocalHandle with this id registered here; just return it. + return x10aux::ref<S>(tmp); + } else { + // This is a handle that has never reached this place before. Create a non-registered one. + x10aux::ref<PlaceLocalHandle<T> > this_ = new (x10aux::alloc<PlaceLocalHandle<T> >()) PlaceLocalHandle<T>(); + this_->_constructor(id); + return this_; + } + } + } +} +#endif + Modified: trunk/x10.runtime/src-cpp/x10aux/RTT.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/RTT.h 2009-08-21 15:30:33 UTC (rev 11058) +++ trunk/x10.runtime/src-cpp/x10aux/RTT.h 2009-08-21 15:34:13 UTC (rev 11059) @@ -200,6 +200,7 @@ class remote_ref; template<> inline const char *typeName<remote_ref>() { return "remote_ref"; } template<> inline const char *typeName<void (*)()>() { return "void (*)()"; } + template<> inline const char *typeName<void*>() { return "void *"; } template<> inline const char *typeName<const void*>() { return "const void *"; } template<> inline const char *typeName<volatile void*>() { return "volatile void *"; } template<> inline const char *typeName<char>() { return "char"; } Modified: trunk/x10.runtime/src-cpp/x10aux/bootstrap.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/bootstrap.h 2009-08-21 15:30:33 UTC (rev 11058) +++ trunk/x10.runtime/src-cpp/x10aux/bootstrap.h 2009-08-21 15:34:13 UTC (rev 11059) @@ -10,6 +10,7 @@ #include <x10aux/config.h> #include <x10aux/alloc.h> +#include <x10aux/place_local.h> #include <x10aux/string_utils.h> #include <x10aux/system_utils.h> #include <x10aux/init_dispatcher.h> @@ -77,7 +78,8 @@ #ifdef X10_USE_BDWGC GC_INIT(); #endif - + x10aux::place_local::initialize(); + x10aux::ref<x10::lang::Rail<x10aux::ref<x10::lang::String> > > args = x10aux::convert_args(ac, av); Property changes on: trunk/x10.runtime/src-cpp/x10aux/network.cc ___________________________________________________________________ Modified: svn:mergeinfo - /branches/itable/x10.runtime.17/src-cpp/x10aux/pgas.cc:10541-10846 + /branches/itable/x10.runtime.17/src-cpp/x10aux/pgas.cc:10541-10846 /branches/placeLocal/x10.runtime/src-cpp/x10aux/network.cc:11035-11056 Property changes on: trunk/x10.runtime/src-cpp/x10aux/network.h ___________________________________________________________________ Modified: svn:mergeinfo - /branches/itable/x10.runtime.17/src-cpp/x10aux/pgas.h:10541-10846 + /branches/itable/x10.runtime.17/src-cpp/x10aux/pgas.h:10541-10846 /branches/placeLocal/x10.runtime/src-cpp/x10aux/network.h:11035-11056 Copied: trunk/x10.runtime/src-cpp/x10aux/place_local.cc (from rev 11056, branches/placeLocal/x10.runtime/src-cpp/x10aux/place_local.cc) =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/place_local.cc (rev 0) +++ trunk/x10.runtime/src-cpp/x10aux/place_local.cc 2009-08-21 15:34:13 UTC (rev 11059) @@ -0,0 +1,96 @@ +#include <assert.h> + +#include <x10aux/place_local.h> +#include <x10aux/basic_functions.h> +#include <x10/runtime/Lock.h> + +using namespace x10::lang; +using namespace x10::runtime; +using namespace x10aux; + +#define MAX_FAST_ID 255 +#define NUM_BUCKETS 100 + +x10_int place_local::_nextId; +place_local::Bucket **place_local::_buckets; +void **place_local::_fastHandles; +x10aux::ref<x10::runtime::Lock> place_local::_lock; + +void place_local::initialize() { + _lock = Lock::_make(); + _nextId = 0; + + _buckets = alloc<Bucket*>(NUM_BUCKETS*sizeof(Bucket*)); + memset(_buckets, 0, NUM_BUCKETS*sizeof(Bucket*)); + _fastHandles = alloc<void*>(MAX_FAST_ID+1); + memset(_fastHandles, 0, (MAX_FAST_ID+1)*sizeof(void*)); +} + +x10_int place_local::nextId() { + assert(here == 0); + _lock->lock(); + x10_int id = _nextId++; + _lock->unlock(); + return id; +} + +void* place_local::lookupHandle(x10_int id) { + if (id < MAX_FAST_ID) { + return _fastHandles[id]; + } else { + _lock->lock(); + int bucket = hash_code(id); + Bucket *cur = _buckets[bucket]; + while (cur != NULL) { + if (cur->_id == id) { + _lock->unlock(); + return cur->_handle; + } + cur = cur->_next; + } + _lock->unlock(); + return NULL; + } +} + +void place_local::registerHandle(x10_int id, void *data) { + assert(NULL == lookupHandle_(id)); + if (id < MAX_FAST_ID) { + _fastHandles[id] = data; + } else { + _lock->lock(); + int bucket = hash_code(id); + Bucket *newBucket = alloc<Bucket>(); + newBucket->_id = id; + newBucket->_handle = data; + newBucket->_next = _buckets[bucket]; + _buckets[bucket] = newBucket; + _lock->unlock(); + } +} + +void place_local::unregisterHandle(x10_int id) { + assert(NULL == lookupHandle_(id)); + if (id < MAX_FAST_ID) { + _fastHandles[id] = NULL; + } else { + _lock->lock(); + int bucket = hash_code(id); + Bucket **trailer = &(_buckets[bucket]); + Bucket *cur = _buckets[bucket]; + while (cur != NULL) { + if (cur->_id == id) { + // cut cur out of bucket chain by setting trailer to cur->next; + *trailer = cur->_next; + _lock->unlock(); + return; + } + trailer = &(cur->_next); + cur = cur->_next; + } + // hmm, wasn't registered in the first place + // probably an error... + _lock->unlock(); + assert(false); + } +} Copied: trunk/x10.runtime/src-cpp/x10aux/place_local.h (from rev 11056, branches/placeLocal/x10.runtime/src-cpp/x10aux/place_local.h) =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/place_local.h (rev 0) +++ trunk/x10.runtime/src-cpp/x10aux/place_local.h 2009-08-21 15:34:13 UTC (rev 11059) @@ -0,0 +1,40 @@ +#ifndef X10AUX_PLACELOCAL_H +#define X10AUX_PLACELOCAL_H + +#include <x10aux/config.h> +#include <x10aux/ref.h> + +namespace x10 { + namespace runtime { + class Lock; + } +} + +namespace x10aux { + + class place_local { + private: + class Bucket { + public: + x10_int _id; + void *_handle; + Bucket *_next; + }; + + static x10_int _nextId; + static Bucket **_buckets; + static void** _fastHandles; + static x10aux::ref<x10::runtime::Lock> _lock; + + public: + static void initialize(); + static x10_int nextId(); + static void* lookupHandle(x10_int id); + static void registerHandle(x10_int id, void *data); + static void unregisterHandle(x10_int id); + }; +} + +#endif + + Modified: trunk/x10.runtime/src-cpp/x10rt17.h =================================================================== --- trunk/x10.runtime/src-cpp/x10rt17.h 2009-08-21 15:30:33 UTC (rev 11058) +++ trunk/x10.runtime/src-cpp/x10rt17.h 2009-08-21 15:34:13 UTC (rev 11059) @@ -39,6 +39,8 @@ #include <x10aux/math_utils.h> #include <x10aux/system_utils.h> +#include <x10aux/place_local.h> + #include <x10aux/cuda/cuda_utils.h> #include <x10aux/cuda/bridge_buffer.h> #include <x10aux/cuda/ring_buffer.h> Copied: trunk/x10.runtime/src-java/x10/runtime/impl/java/PlaceLocalHandle.java (from rev 11056, branches/placeLocal/x10.runtime/src-java/x10/runtime/impl/java/PlaceLocalHandle.java) =================================================================== --- trunk/x10.runtime/src-java/x10/runtime/impl/java/PlaceLocalHandle.java (rev 0) +++ trunk/x10.runtime/src-java/x10/runtime/impl/java/PlaceLocalHandle.java 2009-08-21 15:34:13 UTC (rev 11059) @@ -0,0 +1,40 @@ +/* + * + * (C) Copyright IBM Corporation 2006-2008 + * + * This file is part of X10 Language. + * + */ +package x10.runtime.impl.java; + +import java.util.HashMap; +import x10.runtime.impl.java.Thread; +import x10.runtime.impl.java.Runtime; + +/** + * Implementation of PlaceLocalHandle service for Java-based runtime. + */ +public final class PlaceLocalHandle<T>{ + private final Object[] objects; + + private PlaceLocalHandle() { + objects = new Object[Runtime.MAX_PLACES]; + } + + public T get() { + int here = Thread.currentThread().location(); + Object data = objects[here]; + assert data != null : "At "+here+": get called on uninitialized local object"; + return (T)data; + } + + public void set(T data) { + int here = Thread.currentThread().location(); + assert objects[here] == null : "At "+here+" set called on already initialized local object"; + objects[here] = data; + } + + public static <T> PlaceLocalHandle<T> createHandle() { + return new PlaceLocalHandle<T>(); + } +} Modified: trunk/x10.runtime/src-x10/x10/array/DistArray.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/DistArray.x10 2009-08-21 15:30:33 UTC (rev 11058) +++ trunk/x10.runtime/src-x10/x10/array/DistArray.x10 2009-08-21 15:34:13 UTC (rev 11059) @@ -5,25 +5,34 @@ /** * This class represents an array with raw chunk in each place, - * initialized at its place. The chunk is stored in a PlaceLocal - * object. + * initialized at its place access via a PlaceLocalHandle. * * @author bdlucas */ -import x10.array.PlaceLocal; +import x10.runtime.PlaceLocalHandle; +import x10.runtime.PlaceLocalStorage; final value class DistArray[T] extends BaseArray[T] { - private val raws: PlaceLocal[Rail[T]]; - private val layouts: PlaceLocal[RectLayout]; + private static class LocalState[T] { + val layout:RectLayout; + val raw:Rail[T]; + + def this(l:RectLayout, r:Rail[T]) { + layout = l; + raw = r; + } + }; + private val localHandle:PlaceLocalHandle[LocalState[T]]; + final protected def raw(): Rail[T] { - return raws(); + return localHandle.get().raw; } final protected def layout(): RectLayout { - return layouts(); + return localHandle.get().layout; } // @@ -95,27 +104,22 @@ // def this(dist: Dist, val init: Box[(Point)=>T]): DistArray[T]{self.dist==dist} { - super(dist); - // compute per-place layout - val layoutInit = ()=> layout(dist.get(here)); - layouts = PlaceLocal.make[RectLayout](dist.places(), layoutInit); - - // compute per-place raw storage - val rawInit = ()=>{ - val layout = layouts(); - val n = layout.size(); - val raw = Rail.makeVar[T](n); - if (init!=null) { + val plsInit:(Place)=>LocalState[T] = (p:Place) => { + val region = dist.get(p); + val localLayout = layout(region); + val localRaw = Rail.makeVar[T](localLayout.size()); + if (init != null) { val f = at (init.location) { init as (Point) => T }; - for (p:Point in dist.get(here)) - raw(layout.offset(p)) = f(p); + for (pt:Point in region) { + localRaw(localLayout.offset(pt)) = f(pt); + } } - return raw; + return new LocalState[T](localLayout, localRaw); }; - raws = PlaceLocal.make[Rail[T]](dist.places(), rawInit); + localHandle = PlaceLocalStorage.createDistributedObject(dist, plsInit); } @@ -131,13 +135,11 @@ } def this(a: DistArray[T], d: Dist) { - super(d); - val ps = dist.places(); - layouts = PlaceLocal.make[RectLayout](ps, a.layouts); - raws = PlaceLocal.make[Rail[T]](ps, a.raws); - + localHandle = PlaceLocalStorage.createDistributedObject(dist, (p:Place) => { + return a.localHandle.get(); + }); } } Deleted: trunk/x10.runtime/src-x10/x10/array/PlaceLocal.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/PlaceLocal.x10 2009-08-21 15:30:33 UTC (rev 11058) +++ trunk/x10.runtime/src-x10/x10/array/PlaceLocal.x10 2009-08-21 15:34:13 UTC (rev 11059) @@ -1,58 +0,0 @@ -// (C) Copyright IBM Corporation 2006-2008. -// This file is part of X10 Language. - -package x10.array; // for now - -/** - * A simple implementation of place-local storage. This implementation - * uses a sparsely populated ValRail (one entry per Place.MAX_PLACES) - * to store the local data, and therefore it does not scale. - * - * A better implementation would use a HashMap keyed on the place - * instead of a rail to store the local data, but this must be a value - * (since it would store data for every place), so that would require - * a ValHashMap. This would still have the problem of storing local - * values everywhere, which is unlikely to be helpful. - * - * An even better implementation would use a per-place static HashMap - * keyed on a unique id for this PlaceLocal object to store only - * place-local data for that place (on the assumption that it is - * usually needed only in that place), but the language currently does - * not support static place-local. - * - * Ultimately in any case this will have a native implementation that - * supports very large numbers of places efficiently. Such an - * implementation may also provide, and use here, a special-case - * representation for Iterable[Place] to efficiently support very - * large numbers of places. - */ - -final value class PlaceLocal[T] implements ()=>T { - - - // would like Iterable[Place] but XTENLANG-164 prevents that - - static def make[T](places: ValRail/*Iterable*/[Place], init: ()=>T) - = new PlaceLocal[T](places, init); - - public def apply():T = local(here.id); - - // - // - // - - private val local: ValRail[T]; - - private def this(places: ValRail/*Iterable*/[Place], init: ()=>T) { - - // construct a sparsely populated rail - val rail = Rail.makeVar[T](Place.MAX_PLACES); - for (p:Place in places) { - rail(p.id) = at (p) init(); - } - - // make an immutable value copy - this.local = Rail.makeVal[T](rail.length, (i:Int) => rail(i)); - } - -} Copied: trunk/x10.runtime/src-x10/x10/runtime/PlaceLocalHandle.x10 (from rev 11056, branches/placeLocal/x10.runtime/src-x10/x10/runtime/PlaceLocalHandle.x10) =================================================================== --- trunk/x10.runtime/src-x10/x10/runtime/PlaceLocalHandle.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/runtime/PlaceLocalHandle.x10 2009-08-21 15:34:13 UTC (rev 11059) @@ -0,0 +1,58 @@ +/* + * + * (C) Copyright IBM Corporation 2006-2009. + * + * This file is part of X10 Language. + * + */ + +package x10.runtime; + +import x10.compiler.Native; +import x10.compiler.NativeRep; + +/** + * A PlaceLocalHandle is used in conjunction with the PlaceLocalStorage + * facility to create, name, manage, and destory the place-local storage of + * a distributed object. PlaceLocalHandles are created internally by the + * PlaceLocalStorage service; they cannot be directly created by application code.</p> + * + * The primary operation on a PlaceLocalHandle is to use it to access an object + * on the current place. If the current place is not part of the distribution + * over which the PlaceLocalHandle is defined, a BadPlaceException will be thrown.</p> + * + * A key concept for correct usage of PlaceLocalHandles is that in different places, + * the Handle will be mapped to distinct objects. For example (assuming >1 Place): + * <verbatim> + * val plh:PlaceLocalHandle[T] = .... + * val obj:T = plh.get(); + * at (here.next()) Console.out.println(plh.get() == obj); + * </verbatim> + * will print false.</p> + */ +@NativeRep("c++", "x10aux::ref<x10::runtime::PlaceLocalHandle<#1 > >", "x10::runtime::PlaceLocalHandle<#1 >", null) +@NativeRep("java", "x10.runtime.impl.java.PlaceLocalHandle<#1>", null, null) +public final value PlaceLocalHandle[T] { + + /** + * @return the object mapped to the handle at the current place + */ + @Native("c++", "(#0)->get()") + @Native("java", "#0.get()") + public native safe def get():T; + + @Native("c++", "(#0)->hashCode()") + @Native("java", "#0.hashCode()") + public native safe def hashCode():int; + + // Only to be used by create methods in PlaceLocalStorage + @Native("c++", "(#0)->set(#1)") + @Native("java", "#0.set(#1)") + native def set(newVal:T):void; + + // Only to be used by create methods in PlaceLocalStorage + @Native("c++", "x10::runtime::PlaceLocalHandle<#1 >::createHandle()") + @Native("java", "x10.runtime.impl.java.PlaceLocalHandle.createHandle()") + static native def createHandle[T]():PlaceLocalHandle[T]; + +} Copied: trunk/x10.runtime/src-x10/x10/runtime/PlaceLocalStorage.x10 (from rev 11056, branches/placeLocal/x10.runtime/src-x10/x10/runtime/PlaceLocalStorage.x10) =================================================================== --- trunk/x10.runtime/src-x10/x10/runtime/PlaceLocalStorage.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/runtime/PlaceLocalStorage.x10 2009-08-21 15:34:13 UTC (rev 11059) @@ -0,0 +1,34 @@ +/* + * + * (C) Copyright IBM Corporation 2006-2009. + * + * This file is part of X10 Language. + * + */ + +package x10.runtime; + +/** + * Runtime service routines to create, manage, and destory place-local storage. + */ +public final class PlaceLocalStorage { + + /** + * Create a distributed object with local state of type T + * at each place in the argument distribution. The local object will be initialized + * by evaluating init at each place. When this method returns, the local objects + * will be initialized and available via the returned PlaceLocalHandle instance + * at every place in the distribution. + * + * @param dist A distribution specifiying the places where local objects should be created. + * @param init the initialization closure used to create the local object. + * @return a PlaceLocalHandle that can be used to access the local objects. + */ + public static def createDistributedObject[T](dist:Dist, init:(Place)=>T):PlaceLocalHandle[T] { + val handle = at(Place.FIRST_PLACE) PlaceLocalHandle.createHandle[T](); + finish for (p in dist.places()) { + async (p) handle.set(init(here)); + } + return handle; + } +} \ No newline at end of file Property changes on: trunk/x10.tests ___________________________________________________________________ Modified: svn:mergeinfo - /branches/itable/x10.tests:10541-10849 + /branches/itable/x10.tests:10541-10849 /branches/placeLocal/x10.tests:11035-11056 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spa...@us...> - 2009-08-21 20:02:44
|
Revision: 11066 http://x10.svn.sourceforge.net/x10/?rev=11066&view=rev Author: sparksparkspark Date: 2009-08-21 20:02:32 +0000 (Fri, 21 Aug 2009) Log Message: ----------- Make exit code more salient Fix bug where leading / is stripped off absolute filenames Modified Paths: -------------- trunk/x10.dist/samples/KMeansSPMD.x10 trunk/x10.runtime/src-x10/x10/io/File.x10 Modified: trunk/x10.dist/samples/KMeansSPMD.x10 =================================================================== --- trunk/x10.dist/samples/KMeansSPMD.x10 2009-08-21 19:41:02 UTC (rev 11065) +++ trunk/x10.dist/samples/KMeansSPMD.x10 2009-08-21 20:02:32 UTC (rev 11066) @@ -190,6 +190,7 @@ } catch (e : IOException) { Console.ERR.println("We had a little problem:"); e.printStackTrace(Console.ERR); + System.exit(1); } } } Modified: trunk/x10.runtime/src-x10/x10/io/File.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/io/File.x10 2009-08-21 19:41:02 UTC (rev 11065) +++ trunk/x10.runtime/src-x10/x10/io/File.x10 2009-08-21 20:02:32 UTC (rev 11066) @@ -117,7 +117,7 @@ val i = fullName.lastIndexOf(SEPARATOR); if (i == 0) { parent = null; - name = fullName.substring(1, fullName.length()); + name = fullName.substring(0, fullName.length()); absolute = true; } else if (i >= 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2009-08-21 21:53:18
|
Revision: 11070 http://x10.svn.sourceforge.net/x10/?rev=11070&view=rev Author: dgrove-oss Date: 2009-08-21 21:53:00 +0000 (Fri, 21 Aug 2009) Log Message: ----------- Periodic normalization of svn properties. No actual changes to any file contents. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/AddFlags.java trunk/x10.compiler/src/x10/emitter/Emitter.java trunk/x10.compiler/src/x10/emitter/Expander.java trunk/x10.compiler/src/x10/emitter/Inline.java trunk/x10.compiler/src/x10/emitter/Join.java trunk/x10.compiler/src/x10/emitter/Loop.java trunk/x10.compiler/src/x10/emitter/RuntimeTypeExpander.java trunk/x10.compiler/src/x10/emitter/Template.java trunk/x10.compiler/src/x10/emitter/TypeExpander.java trunk/x10.compiler/src/x10/types/X10ThisVar.java trunk/x10.compiler/src/x10/visit/Optimizer.java trunk/x10.constraints/src/x10/constraint/ThisVar.java trunk/x10.runtime/src-x10/x10/runtime/RID.x10 trunk/x10.runtime/src-x10/x10/runtime/RemoteFinish.x10 trunk/x10.runtime/src-x10/x10/runtime/RootFinish.x10 trunk/x10.tests/examples/Benchmarks/Benchmark.cc trunk/x10.tests/examples/Benchmarks/Benchmark.java trunk/x10.tests/examples/Benchmarks/Benchmark.x10 trunk/x10.tests/examples/Benchmarks/ParUTSBin1.x10 trunk/x10.tests/examples/Benchmarks/Report.java trunk/x10.tests/examples/Benchmarks/SeqMatMultAdd1a.cc trunk/x10.tests/examples/Benchmarks/SeqMatMultAdd1a.java trunk/x10.tests/examples/Benchmarks/SeqMatMultAdd1a.x10 trunk/x10.tests/examples/Benchmarks/SeqMatMultAdd1b.x10 trunk/x10.tests/examples/Benchmarks/SeqMethodCall1.java trunk/x10.tests/examples/Benchmarks/SeqMethodCall1.x10 trunk/x10.tests/examples/Benchmarks/SeqPseudoArray1.java trunk/x10.tests/examples/Benchmarks/SeqPseudoArray1.x10 trunk/x10.tests/examples/Benchmarks/SeqPseudoArray2a.cc trunk/x10.tests/examples/Benchmarks/SeqPseudoArray2a.java trunk/x10.tests/examples/Benchmarks/SeqRail1.cc trunk/x10.tests/examples/Benchmarks/SeqRail1.x10 trunk/x10.tests/examples/Benchmarks/SeqRail2.cc trunk/x10.tests/examples/Benchmarks/SeqRail2.java trunk/x10.tests/examples/Benchmarks/SeqRandomAccess1.cc trunk/x10.tests/examples/Benchmarks/SeqRandomAccess1.java trunk/x10.tests/examples/Benchmarks/SeqStream1.cc trunk/x10.tests/examples/Benchmarks/SeqStream1.java trunk/x10.tests/examples/Benchmarks/SeqUTSBin1.cc trunk/x10.tests/examples/Benchmarks/SeqUTSBin1.java trunk/x10.tests/examples/Benchmarks/SeqUTSBin1.x10 trunk/x10.tests/examples/Benchmarks/SeqUTSGeo1.x10 trunk/x10.tests/examples/Benchmarks/UTSRand.java trunk/x10.tests/examples/Benchmarks/UTSRand.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/ArrayLift.x10 trunk/x10.tests/examples/Constructs/Array/ArrayReduce.x10 trunk/x10.tests/examples/Constructs/Array/ArrayScan.x10 trunk/x10.tests/examples/Constructs/Async/AsyncReturn_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckArray.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckStringBuilder.x10 trunk/x10.tests/examples/Issues/XTENLANG_345.x10 trunk/x10.tests/examples/Misc/ArraySum.x10 trunk/x10.tests/examples/Misc/DistUtil.x10 trunk/x10.tests/examples/Misc/FRA.x10 trunk/x10.tests/examples/Misc/FRASimple.x10 trunk/x10.tests/examples/Misc/FRASimpleDist.x10 trunk/x10.tests/examples/Misc/FRASimpleDistTest.x10 trunk/x10.tests/examples/Misc/FRATest.x10 trunk/x10.tests/examples/Misc/FS.x10 trunk/x10.tests/examples/Misc/FSSimple.x10 trunk/x10.tests/examples/Misc/FSSimpleDist.x10 trunk/x10.tests/examples/Misc/FSSimpleDistTest.x10 trunk/x10.tests/examples/Misc/FSSimpleTest.x10 trunk/x10.tests/examples/Misc/NQueensParTest.x10 trunk/x10.tests/examples/Misc/Stencil1D.x10 trunk/x10.tests/tests/Constructs/Rooted/RootedCall.x10 trunk/x10.tests/tests/Constructs/Rooted/RootedCall1_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Rooted/RootedCall2_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Rooted/RootedCall3_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Rooted/RootedCall4_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Rooted/RootedCall_MustFailCompile.x10 Property Changed: ---------------- trunk/x10.compiler/src/x10/ast/AddFlags.java trunk/x10.compiler/src/x10/emitter/Emitter.java trunk/x10.compiler/src/x10/emitter/Expander.java trunk/x10.compiler/src/x10/emitter/Inline.java trunk/x10.compiler/src/x10/emitter/Join.java trunk/x10.compiler/src/x10/emitter/Loop.java trunk/x10.compiler/src/x10/emitter/RuntimeTypeExpander.java trunk/x10.compiler/src/x10/emitter/Template.java trunk/x10.compiler/src/x10/emitter/TypeExpander.java trunk/x10.compiler/src/x10/types/X10ThisVar.java trunk/x10.compiler/src/x10/util/Synthesizer.java trunk/x10.compiler/src/x10/visit/Optimizer.java trunk/x10.compiler/src/x10cuda/types/SharedMem.java trunk/x10.constraints/src/x10/constraint/ThisVar.java trunk/x10.runtime/src-cpp/x10/runtime/PlaceLocalHandle.cc trunk/x10.runtime/src-cpp/x10/runtime/PlaceLocalHandle.h trunk/x10.runtime/src-cpp/x10aux/place_local.cc trunk/x10.runtime/src-cpp/x10aux/place_local.h trunk/x10.runtime/src-java/x10/runtime/impl/java/PlaceLocalHandle.java trunk/x10.runtime/src-x10/x10/runtime/Latch.x10 trunk/x10.runtime/src-x10/x10/runtime/PlaceLocalHandle.x10 trunk/x10.runtime/src-x10/x10/runtime/PlaceLocalStorage.x10 trunk/x10.runtime/src-x10/x10/runtime/RID.x10 trunk/x10.runtime/src-x10/x10/runtime/RemoteFinish.x10 trunk/x10.runtime/src-x10/x10/runtime/RootFinish.x10 trunk/x10.tests/data/GetProp.java trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/parallel/JGFCryptBenchSizeA.x10 trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/parallel/crypt/IDEATest.x10 trunk/x10.tests/examples/Applications/NewJavaGrande/crypt/parallel/crypt/JGFCryptBench.x10 trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/JGFSORBenchSizeA.x10 trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/sor/JGFSORBench.x10 trunk/x10.tests/examples/Applications/NewJavaGrande/sor/distributed/sor/SOR.x10 trunk/x10.tests/examples/Applications/NewJavaGrande/sor/parallel/sor/JGFSORBench.x10 trunk/x10.tests/examples/Applications/NewJavaGrande/sor/parallel/sor/SOR.x10 trunk/x10.tests/examples/Applications/NewJavaGrande/sor/serial/JGFSORBenchSizeA.x10 trunk/x10.tests/examples/Applications/NewJavaGrande/sor/serial/sor/JGFSORBench.x10 trunk/x10.tests/examples/Applications/NewJavaGrande/sor/serial/sor/SOR.x10 trunk/x10.tests/examples/Benchmarks/Benchmark.cc trunk/x10.tests/examples/Benchmarks/Benchmark.java trunk/x10.tests/examples/Benchmarks/Benchmark.x10 trunk/x10.tests/examples/Benchmarks/DistRandomAccess1.x10 trunk/x10.tests/examples/Benchmarks/DistStream1.x10 trunk/x10.tests/examples/Benchmarks/ParRandomAccess1.x10 trunk/x10.tests/examples/Benchmarks/ParStream1.x10 trunk/x10.tests/examples/Benchmarks/ParUTSBin1.x10 trunk/x10.tests/examples/Benchmarks/Report.java trunk/x10.tests/examples/Benchmarks/SeqArray2a.x10 trunk/x10.tests/examples/Benchmarks/SeqArray2b.x10 trunk/x10.tests/examples/Benchmarks/SeqMatMultAdd1a.cc trunk/x10.tests/examples/Benchmarks/SeqMatMultAdd1a.java trunk/x10.tests/examples/Benchmarks/SeqMatMultAdd1a.x10 trunk/x10.tests/examples/Benchmarks/SeqMatMultAdd1b.x10 trunk/x10.tests/examples/Benchmarks/SeqMethodCall1.java trunk/x10.tests/examples/Benchmarks/SeqMethodCall1.x10 trunk/x10.tests/examples/Benchmarks/SeqPseudoArray1.java trunk/x10.tests/examples/Benchmarks/SeqPseudoArray1.x10 trunk/x10.tests/examples/Benchmarks/SeqPseudoArray2a.cc trunk/x10.tests/examples/Benchmarks/SeqPseudoArray2a.java trunk/x10.tests/examples/Benchmarks/SeqPseudoArray2a.x10 trunk/x10.tests/examples/Benchmarks/SeqPseudoArray2b.x10 trunk/x10.tests/examples/Benchmarks/SeqRail1.cc trunk/x10.tests/examples/Benchmarks/SeqRail1.x10 trunk/x10.tests/examples/Benchmarks/SeqRail2.cc trunk/x10.tests/examples/Benchmarks/SeqRail2.java trunk/x10.tests/examples/Benchmarks/SeqRail2.x10 trunk/x10.tests/examples/Benchmarks/SeqRandomAccess1.cc trunk/x10.tests/examples/Benchmarks/SeqRandomAccess1.java trunk/x10.tests/examples/Benchmarks/SeqRandomAccess1.x10 trunk/x10.tests/examples/Benchmarks/SeqStream1.cc trunk/x10.tests/examples/Benchmarks/SeqStream1.java trunk/x10.tests/examples/Benchmarks/SeqStream1.x10 trunk/x10.tests/examples/Benchmarks/SeqUTSBin1.cc trunk/x10.tests/examples/Benchmarks/SeqUTSBin1.java trunk/x10.tests/examples/Benchmarks/SeqUTSBin1.x10 trunk/x10.tests/examples/Benchmarks/SeqUTSGeo1.x10 trunk/x10.tests/examples/Benchmarks/UTSRand.h trunk/x10.tests/examples/Benchmarks/UTSRand.java trunk/x10.tests/examples/Benchmarks/UTSRand.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/ArrayLift.x10 trunk/x10.tests/examples/Constructs/Array/ArrayReduce.x10 trunk/x10.tests/examples/Constructs/Array/ArrayScan.x10 trunk/x10.tests/examples/Constructs/Async/AsyncReturn_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/At/AtFieldAccess.x10 trunk/x10.tests/examples/Constructs/At/AtNext.x10 trunk/x10.tests/examples/Constructs/Boxing/AutoUnboxing_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Boxing/Boxing4.x10 trunk/x10.tests/examples/Constructs/Clock/ClockTest8.x10 trunk/x10.tests/examples/Constructs/Generics/GenericMethodEquals.x10 trunk/x10.tests/examples/Constructs/Inheritance/InheritedInterfaceMethod.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckArray.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckGenericClass.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckInRail.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckInnerClass.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckRail.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckReverse.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckStaticClass.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckStringBuilder.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckValueClass.x10 trunk/x10.tests/examples/Constructs/Types/PrimitiveHasLocation_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Types/PrimitiveLiteralHasLocation_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Unsigned/Unsigned1.x10 trunk/x10.tests/examples/Constructs/Unsigned/Unsigned2.x10 trunk/x10.tests/examples/Constructs/Unsigned/Unsigned3.x10 trunk/x10.tests/examples/Constructs/Unsigned/Unsigned4_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Unsigned/Unsigned5.x10 trunk/x10.tests/examples/Constructs/Unsigned/Unsigned6.x10 trunk/x10.tests/examples/Constructs/Unsigned/Unsigned7_MustFailCompile.x10 trunk/x10.tests/examples/Issues/XTENLANG_138.x10 trunk/x10.tests/examples/Issues/XTENLANG_147.x10 trunk/x10.tests/examples/Issues/XTENLANG_158.x10 trunk/x10.tests/examples/Issues/XTENLANG_162.x10 trunk/x10.tests/examples/Issues/XTENLANG_164.x10 trunk/x10.tests/examples/Issues/XTENLANG_165.x10 trunk/x10.tests/examples/Issues/XTENLANG_177.x10 trunk/x10.tests/examples/Issues/XTENLANG_191.x10 trunk/x10.tests/examples/Issues/XTENLANG_192.x10 trunk/x10.tests/examples/Issues/XTENLANG_193.x10 trunk/x10.tests/examples/Issues/XTENLANG_194.x10 trunk/x10.tests/examples/Issues/XTENLANG_195.x10 trunk/x10.tests/examples/Issues/XTENLANG_196.x10 trunk/x10.tests/examples/Issues/XTENLANG_198.x10 trunk/x10.tests/examples/Issues/XTENLANG_201.x10 trunk/x10.tests/examples/Issues/XTENLANG_202.x10 trunk/x10.tests/examples/Issues/XTENLANG_203.x10 trunk/x10.tests/examples/Issues/XTENLANG_208.x10 trunk/x10.tests/examples/Issues/XTENLANG_209.x10 trunk/x10.tests/examples/Issues/XTENLANG_210.x10 trunk/x10.tests/examples/Issues/XTENLANG_211.x10 trunk/x10.tests/examples/Issues/XTENLANG_215.x10 trunk/x10.tests/examples/Issues/XTENLANG_217.x10 trunk/x10.tests/examples/Issues/XTENLANG_219.x10 trunk/x10.tests/examples/Issues/XTENLANG_225.x10 trunk/x10.tests/examples/Issues/XTENLANG_237.x10 trunk/x10.tests/examples/Issues/XTENLANG_238.x10 trunk/x10.tests/examples/Issues/XTENLANG_239.x10 trunk/x10.tests/examples/Issues/XTENLANG_240.x10 trunk/x10.tests/examples/Issues/XTENLANG_241.x10 trunk/x10.tests/examples/Issues/XTENLANG_242.x10 trunk/x10.tests/examples/Issues/XTENLANG_243.x10 trunk/x10.tests/examples/Issues/XTENLANG_244.x10 trunk/x10.tests/examples/Issues/XTENLANG_248.x10 trunk/x10.tests/examples/Issues/XTENLANG_257.x10 trunk/x10.tests/examples/Issues/XTENLANG_258.x10 trunk/x10.tests/examples/Issues/XTENLANG_259.x10 trunk/x10.tests/examples/Issues/XTENLANG_260.x10 trunk/x10.tests/examples/Issues/XTENLANG_262.x10 trunk/x10.tests/examples/Issues/XTENLANG_264.x10 trunk/x10.tests/examples/Issues/XTENLANG_265.x10 trunk/x10.tests/examples/Issues/XTENLANG_298.x10 trunk/x10.tests/examples/Issues/XTENLANG_303.x10 trunk/x10.tests/examples/Issues/XTENLANG_305.x10 trunk/x10.tests/examples/Issues/XTENLANG_307.x10 trunk/x10.tests/examples/Issues/XTENLANG_311.x10 trunk/x10.tests/examples/Issues/XTENLANG_322.x10 trunk/x10.tests/examples/Issues/XTENLANG_335.x10 trunk/x10.tests/examples/Issues/XTENLANG_345.x10 trunk/x10.tests/examples/Issues/XTENLANG_367.x10 trunk/x10.tests/examples/Issues/XTENLANG_423.x10 trunk/x10.tests/examples/Issues/XTENLANG_443.x10 trunk/x10.tests/examples/Issues/XTENLANG_455.x10 trunk/x10.tests/examples/Issues/XTENLANG_472.x10 trunk/x10.tests/examples/Issues/XTENLANG_473.x10 trunk/x10.tests/examples/Issues/XTENLANG_477.x10 trunk/x10.tests/examples/Misc/ArraySum.x10 trunk/x10.tests/examples/Misc/DistUtil.x10 trunk/x10.tests/examples/Misc/FRA.x10 trunk/x10.tests/examples/Misc/FRASimple.x10 trunk/x10.tests/examples/Misc/FRASimpleDist.x10 trunk/x10.tests/examples/Misc/FRASimpleDistTest.x10 trunk/x10.tests/examples/Misc/FRATest.x10 trunk/x10.tests/examples/Misc/FS.x10 trunk/x10.tests/examples/Misc/FSSimple.x10 trunk/x10.tests/examples/Misc/FSSimpleDist.x10 trunk/x10.tests/examples/Misc/FSSimpleDistTest.x10 trunk/x10.tests/examples/Misc/FSSimpleTest.x10 trunk/x10.tests/examples/Misc/NQueensPar.x10 trunk/x10.tests/examples/Misc/NQueensParTest.x10 trunk/x10.tests/examples/Misc/SevereError.x10 trunk/x10.tests/examples/Misc/Stencil1D.x10 trunk/x10.tests/examples/x10lib/jgfutil/BoxedDouble.x10 trunk/x10.tests/examples/x10lib/jgfutil/JGFInstrumentor.x10 trunk/x10.tests/examples/x10lib/jgfutil/JGFSection1.x10 trunk/x10.tests/examples/x10lib/jgfutil/JGFSection2.x10 trunk/x10.tests/examples/x10lib/jgfutil/JGFSection3.x10 trunk/x10.tests/examples/x10lib/jgfutil/JGFTimer.x10 trunk/x10.tests/tests/Constructs/Rooted/RootedCall.x10 trunk/x10.tests/tests/Constructs/Rooted/RootedCall1_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Rooted/RootedCall2_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Rooted/RootedCall3_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Rooted/RootedCall4_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Rooted/RootedCall_MustFailCompile.x10 Modified: trunk/x10.compiler/src/x10/ast/AddFlags.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AddFlags.java 2009-08-21 21:47:15 UTC (rev 11069) +++ trunk/x10.compiler/src/x10/ast/AddFlags.java 2009-08-21 21:53:00 UTC (rev 11070) @@ -1,8 +1,8 @@ -package x10.ast; - -import polyglot.types.Flags; - -public interface AddFlags { - - void addFlags(Flags f); -} +package x10.ast; + +import polyglot.types.Flags; + +public interface AddFlags { + + void addFlags(Flags f); +} Property changes on: trunk/x10.compiler/src/x10/ast/AddFlags.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: trunk/x10.compiler/src/x10/emitter/Emitter.java =================================================================== --- trunk/x10.compiler/src/x10/emitter/Emitter.java 2009-08-21 21:47:15 UTC (rev 11069) +++ trunk/x10.compiler/src/x10/emitter/Emitter.java 2009-08-21 21:53:00 UTC (rev 11070) @@ -1,1745 +1,1745 @@ -package x10.emitter; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.Set; - -import polyglot.ast.Binary; -import polyglot.ast.Call; -import polyglot.ast.Cast; -import polyglot.ast.CharLit; -import polyglot.ast.Expr; -import polyglot.ast.Field; -import polyglot.ast.Formal; -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; -import polyglot.ast.StringLit; -import polyglot.ast.TypeNode; -import polyglot.ast.Unary; -import polyglot.types.ClassDef; -import polyglot.types.ClassType; -import polyglot.types.Context; -import polyglot.types.Def; -import polyglot.types.Flags; -import polyglot.types.MemberInstance; -import polyglot.types.MethodDef; -import polyglot.types.MethodInstance; -import polyglot.types.Name; -import polyglot.types.NoClassException; -import polyglot.types.QName; -import polyglot.types.Ref; -import polyglot.types.SemanticException; -import polyglot.types.Type; -import polyglot.types.TypeSystem; -import polyglot.types.Types; -import polyglot.util.CodeWriter; -import polyglot.util.CollectionUtil; -import polyglot.util.InternalCompilerError; -import polyglot.util.Position; -import polyglot.util.StringUtil; -import polyglot.visit.Translator; -import x10.Configuration; -import x10.ast.Clocked; -import x10.ast.ClosureCall; -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; -import x10.constraint.XConstraint; -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.XName; -import x10.constraint.XNameWrapper; -import x10.constraint.XNot_c; -import x10.constraint.XTerm; -import x10.constraint.XTerms; -import x10.extension.X10Ext; -import x10.query.QueryEngine; -import x10.types.ClosureType; -import x10.types.MacroType; -import x10.types.ParameterType; -import x10.types.X10ClassDef; -import x10.types.X10ClassType; -import x10.types.X10Context; -import x10.types.X10Def; -import x10.types.X10Flags; -import x10.types.X10MethodInstance; -import x10.types.X10TypeMixin; -import x10.types.X10TypeSystem; -import x10.types.XTypeTranslator.XTypeLit_c; -import x10.visit.X10PrettyPrinterVisitor; -import x10.visit.X10Translator; -import x10.visit.X10PrettyPrinterVisitor.CircularList; - -public class Emitter { - - CodeWriter w; - Translator tr; - X10PrettyPrinterVisitor ppv; - - public Emitter(CodeWriter w, Translator tr) { - this.w=w; - this.tr=tr; - } - - public String mangle(QName name) { - String mangle = name.toString().replace(".", "$"); - return mangle; - } - public static String mangleIdentifier(String n) { - // Workaround an assertion failure in Name.make. - if (! StringUtil.isNameShort(n)) - return n; - return mangleIdentifier(Name.make(n)).toString(); - } - public static Name mangleIdentifier(Name n) { - Map<Name,Name> map = new HashMap<Name,Name>(); - map.put(X10Cast_c.operator_as, Name.make("$convert")); - map.put(X10Cast_c.implicit_operator_as, Name.make("$implicit_convert")); - map.put(Name.make("set"), Name.make("set")); - map.put(Name.make("apply"), Name.make("apply")); - map.put(Name.make("operator+"), Name.make("$plus")); - map.put(Name.make("operator-"), Name.make("$minus")); - map.put(Name.make("operator*"), Name.make("$times")); - map.put(Name.make("operator/"), Name.make("$over")); - map.put(Name.make("operator%"), Name.make("$percent")); - map.put(Name.make("operator<"), Name.make("$lt")); - map.put(Name.make("operator>"), Name.make("$gt")); - map.put(Name.make("operator<="), Name.make("$le")); - map.put(Name.make("operator>="), Name.make("$ge")); - map.put(Name.make("operator<<"), Name.make("$left")); - map.put(Name.make("operator>>"), Name.make("$right")); - map.put(Name.make("operator>>>"), Name.make("$unsigned_right")); - map.put(Name.make("operator&"), Name.make("$ampersand")); - map.put(Name.make("operator|"), Name.make("$bar")); - map.put(Name.make("operator^"), Name.make("$caret")); - map.put(Name.make("operator~"), Name.make("$tilde")); - map.put(Name.make("operator&&"), Name.make("$and")); - map.put(Name.make("operator||"), Name.make("$or")); - map.put(Name.make("operator!"), Name.make("$not")); - map.put(Name.make("operator=="), Name.make("$equalsequals")); - map.put(Name.make("operator!="), Name.make("$ne")); - map.put(Name.make("inverse_operator+"), Name.make("$inv_plus")); - map.put(Name.make("inverse_operator-"), Name.make("$inv_minus")); - map.put(Name.make("inverse_operator*"), Name.make("$inv_times")); - map.put(Name.make("inverse_operator/"), Name.make("$inv_over")); - map.put(Name.make("inverse_operator%"), Name.make("$inv_percent")); - map.put(Name.make("inverse_operator<"), Name.make("$inv_lt")); - map.put(Name.make("inverse_operator>"), Name.make("$inv_gt")); - map.put(Name.make("inverse_operator<="), Name.make("$inv_le")); - map.put(Name.make("inverse_operator>="), Name.make("$inv_ge")); - map.put(Name.make("inverse_operator<<"), Name.make("$inv_left")); - map.put(Name.make("inverse_operator>>"), Name.make("$inv_right")); - map.put(Name.make("inverse_operator>>>"), Name.make("$inv_unsigned_right")); - map.put(Name.make("inverse_operator&"), Name.make("$inv_ampersand")); - map.put(Name.make("inverse_operator|"), Name.make("$inv_bar")); - map.put(Name.make("inverse_operator^"), Name.make("$inv_caret")); - map.put(Name.make("inverse_operator~"), Name.make("$inv_tilde")); - map.put(Name.make("inverse_operator&&"), Name.make("$inv_and")); - map.put(Name.make("inverse_operator||"), Name.make("$inv_or")); - map.put(Name.make("inverse_operator!"), Name.make("$inv_not")); - map.put(Name.make("inverse_operator=="), Name.make("$inv_equalsequals")); - map.put(Name.make("inverse_operator!="), Name.make("$inv_ne")); - - Name o = map.get(n); - if (o != null) - return o; - return n; - } - static HashMap<String,String> translationCache_ = new HashMap<String,String>(); - - public static String translate(String id) { - String cached = (String) translationCache_.get(id); - if (cached != null) - return cached; - try { - String rname = Configuration.COMPILER_FRAGMENT_DATA_DIRECTORY + id + ".xcd"; // xcd = x10 compiler data/definition - InputStream is = Emitter.class.getClassLoader().getResourceAsStream(rname); - if (is == null) - throw new IOException("Cannot find resource '"+rname+"'"); - byte[] b = new byte[is.available()]; - for (int off = 0; off < b.length; ) { - int read = is.read(b, off, b.length - off); - off += read; - } - String trans = new String(b, "UTF-8"); - // Skip initial lines that start with "// SYNOPSIS: " - // (spaces matter!) - while (trans.indexOf("// SYNOPSIS: ") == 0) - trans = trans.substring(trans.indexOf('\n')+1); - // Remove one trailing newline (if any) - if (trans.lastIndexOf('\n') == trans.length()-1) - trans = trans.substring(0, trans.length()-1); - boolean newline = trans.lastIndexOf('\n') == trans.length()-1; - trans = "/* template:"+id+" { */" + trans + "/* } */"; - // If the template ends in a newline, add it after the footer - if (newline) - trans = trans + "\n"; - translationCache_.put(id, trans); - is.close(); - return trans; - } catch (IOException io) { - throw new InternalCompilerError("No translation for " + id + " found!", io); - } - } - - - /** - * Expand a given template with given parameters. - * - * @param id xcd filename for the template - * @param components arguments to the template. - */ - public void dump(String id, Object[] components, Translator tr) { - String regex = translate(id); - dumpRegex(id, components, tr, regex); - } - - /** - * Support "inline" .xcd so that you dont have to create a separate xcd file for a short - * code fragment. - * @param components - * @param regex - */ - public void dumpCodeString(Object[] components, String regex) { - dumpRegex("internal", components, tr, regex); - } - public void dumpRegex(String id, Object[] components, Translator tr, String regex) { - for (int i = 0; i < components.length; i++) { - assert ! (components[i] instanceof Object[]); - } - int len = regex.length(); - int pos = 0; - int start = 0; - while (pos < len) { - if (regex.charAt(pos) == '\n') { - w.write(regex.substring(start, pos)); - w.newline(0); - start = pos+1; - } - else - if (regex.charAt(pos) == '#') { - w.write(regex.substring(start, pos)); - Integer idx = new Integer(regex.substring(pos+1,pos+2)); - pos++; - start = pos+1; - if (idx.intValue() >= components.length) - throw new InternalCompilerError("Template '"+id+"' uses #"+idx); - prettyPrint(components[idx.intValue()], tr); - } - pos++; - } - w.write(regex.substring(start)); - } - - /** - * Pretty-print a given object. - * - * @param o object to print - */ - public void prettyPrint(Object o, Translator tr) { - if (o instanceof Expander) { - ((Expander) o).expand(tr); - } else if (o instanceof Node) { - ((Node) o).del().translate(w, tr); - } else if (o instanceof Type) { - throw new InternalCompilerError("Should not attempt to pretty-print a type"); - } else if (o != null) { - w.write(o.toString()); - } - } - - public String getJavaImplForDef(X10Def o) { - X10TypeSystem xts = (X10TypeSystem) o.typeSystem(); - try { - Type java = (Type) xts.systemResolver().find(QName.make("x10.compiler.Native")); - List<Type> as = o.annotationsMatching(java); - for (Type at : as) { - assertNumberOfInitializers(at, 2); - String lang = getPropertyInit(at, 0); - if (lang != null && lang.equals("java")) { - String lit = getPropertyInit(at, 1); - return lit; - } - } - } - catch (SemanticException e) {} - return null; - } - public String getJavaRep(X10ClassDef def) { - return getJavaRepParam(def, 1); - } - public String getJavaRTTRep(X10ClassDef def) { - return getJavaRepParam(def, 3); - } - - public String getJavaRepParam(X10ClassDef def, int i) { - try { - X10TypeSystem xts = (X10TypeSystem) tr.typeSystem(); - Type rep = (Type) xts.systemResolver().find(QName.make("x10.compiler.NativeRep")); - List<Type> as = def.annotationsMatching(rep); - for (Type at : as) { - assertNumberOfInitializers(at, 4); - String lang = getPropertyInit(at, 0); - if (lang != null && lang.equals("java")) { - return getPropertyInit(at, i); - } - } - } - catch (SemanticException e) {} - return null; - } - public String getPropertyInit(Type at, int index) { - at = X10TypeMixin.baseType(at); - if (at instanceof X10ClassType) { - X10ClassType act = (X10ClassType) at; - if (index < act.propertyInitializers().size()) { - Expr e = act.propertyInitializer(index); - if (e.isConstant()) { - Object v = e.constantValue(); - if (v instanceof String) { - return (String) v; - } - } - } - } - return null; - } - - public void assertNumberOfInitializers(Type at, int len) { - at = X10TypeMixin.baseType(at); - if (at instanceof X10ClassType) { - X10ClassType act = (X10ClassType) at; - assert len == act.propertyInitializers().size(); - } - } - boolean printRepType(Type type, boolean printGenerics, boolean boxPrimitives, boolean inSuper) { - if (type.isVoid()) { - w.write("void"); - return true; - } - - // If the type has a native representation, use that. - if (type instanceof X10ClassType) { - X10ClassDef cd = ((X10ClassType) type).x10Def(); - String pat = getJavaRep(cd); - if (pat != null) { - if (boxPrimitives) { - String[] s = new String[] { "boolean", "byte", "char", "short", "int", "long", "float", "double" }; - String[] w = new String[] { "java.lang.Boolean", "java.lang.Byte", "java.lang.Character", "java.lang.Short", "java.lang.Integer", "java.lang.Long", "java.lang.Float", "java.lang.Double" }; - for (int i = 0; i < s.length; i++) { - if (pat.equals(s[i])) { - pat = w[i]; - break; - } - } - } - List<Type> typeArguments = ((X10ClassType) type).typeArguments(); - Object[] o = new Object[typeArguments.size()+1]; - int i = 0; - NodeFactory nf = tr.nodeFactory(); - o[i++] = new TypeExpander(this, type, printGenerics, boxPrimitives, inSuper); - for (Type a : typeArguments) { - o[i++] = new TypeExpander(this, a, printGenerics, true, inSuper); - } - if (! printGenerics) { - pat = pat.replaceAll("<.*>", ""); - } - dumpRegex("NativeRep", o, tr, pat); - return true; - } - } - - return false; - } - - - - public String rttShortName(X10ClassDef cd) { - if (cd.isMember() || cd.isLocal()) - return cd.name() + "$RTT"; - else - return "RTT"; - } - - public String rttName(X10ClassDef cd) { - if (cd.isTopLevel()) - return cd.fullName() + "." + rttShortName(cd); - if (cd.isLocal()) - return rttShortName(cd); - if (cd.isMember()) { - X10ClassType container = (X10ClassType) Types.get(cd.container()); - return rttName(container.x10Def()) + "." + rttShortName(cd); - } - assert false : "unexpected class " + cd; - return ""; - } - - public void printType(Type type, int flags) { - boolean printTypeParams = (flags & X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS) != 0; - boolean boxPrimitives = (flags & X10PrettyPrinterVisitor.BOX_PRIMITIVES) != 0; - boolean inSuper = (flags & X10PrettyPrinterVisitor.NO_VARIANCE) != 0; - boolean ignoreQual = (flags & X10PrettyPrinterVisitor.NO_QUALIFIER) != 0; - - X10TypeSystem xts = (X10TypeSystem) type.typeSystem(); - - type = X10TypeMixin.baseType(type); - - if (type instanceof X10ClassType) { - X10ClassType ct = (X10ClassType) type; - if (ct.isAnonymous()) { - if (ct.interfaces().size() > 0) { - printType(ct.interfaces().get(0), flags); - return; - } - else if (ct.superClass() != null) { - printType(ct.superClass(), flags); - return; - } - else { - assert false; - printType(xts.Object(), flags); - return; - } - } - } - - if (printRepType(type, printTypeParams, boxPrimitives, inSuper)) - return; - - if (type instanceof ParameterType) { - w.write(((ParameterType) type).name().toString()); - return; - } - - if (type instanceof ClosureType) { - ClosureType ct = (ClosureType) type; - List<Type> args = ct.argumentTypes(); - Type ret = ct.returnType(); - if (ret.isVoid()) { - w.write("x10.core.fun.VoidFun"); - } - else { - w.write("x10.core.fun.Fun"); - } - w.write("_" + ct.typeParameters().size()); - w.write("_" + args.size()); - if (printTypeParams && args.size() + (ret.isVoid() ? 0 : 1) > 0) { - w.write("<"); - String sep = ""; - for (Type a : args) { - w.write(sep); - sep = ","; - printType(a, (printTypeParams ? X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS : 0) | - X10PrettyPrinterVisitor.BOX_PRIMITIVES); - } - if (! ret.isVoid()) { - w.write(sep); - printType(ret, (printTypeParams ? X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS : 0) | - X10PrettyPrinterVisitor.BOX_PRIMITIVES); - } - w.write(">"); - } - return; - } - - // Shouldn't get here. - if (type instanceof MacroType) { - MacroType mt = (MacroType) type; - printType(mt.definedType(), X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS); - return; - } - - // Print the class name - if (ignoreQual) { - if (type instanceof X10ClassType) { - w.write(((X10ClassType) type).name().toString()); - } - else { - type.print(w); - } - } - else { - type.print(w); - } - - if (printTypeParams) { - if (type instanceof X10ClassType) { - X10ClassType ct = (X10ClassType) type; - String sep = "<"; - for (int i = 0; i < ct.typeArguments().size(); i++) { - w.write(sep); - sep = ", "; - - Type a = ct.typeArguments().get(i); - - final boolean variance = false; - if (! inSuper && variance) { - ParameterType.Variance v = ct.x10Def().variances().get(i); - switch (v) { - case CONTRAVARIANT: - w.write("? super "); - break; - case COVARIANT: - w.write("? extends "); - break; - case INVARIANT: - break; - } - } - printType(a, (printTypeParams ? X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS : 0) | - X10PrettyPrinterVisitor.BOX_PRIMITIVES); - } - if (ct.typeArguments().size() > 0) - w.write(">"); - } - } - } - public void serializeConstraint(XConstraint constraint) { - // String serializedConstraint = serializedForm(constraint); - // StringLit lit = tr.nodeFactory().StringLit(Position.COMPILER_GENERATED, serializedConstraint); - // tr.print(null, lit, w); - w.write("new x10.constraint.XConstraint_c() {{"); - w.newline(4); - w.begin(0); - w.write("try {"); - w.newline(4); - w.begin(0); - List<XTerm> terms = constraint.constraints(); - for (XTerm term : terms) { - w.write("addTerm("); - w.begin(0); - serializeTerm(term, constraint); - w.end(); - w.write(");"); - w.newline(); - //XConstraint_c c = new XConstraint_c(); c.addTerm(XTerms.makeEquals(XTerms.makeField(c.self(), XTerms.makeName("p")), XTerms.makeLit(2))) - } - w.end(); - w.newline(); - w.write("} catch (x10.constraint.XFailure f) {"); - w.newline(4); - w.begin(0); - w.write("setInconsistent();"); - w.end(); - w.newline(); - w.write("}"); - w.end(); - w.newline(); - w.write("}}"); - } - private static final String XTERMS = "x10.constraint.XTerms"; - private void serializeTerm(XTerm term, XConstraint parent) { - if (term.equals(parent.self())) { - w.write("self()"); - } else - if (term == XTerms.OPERATOR) { - w.write(XTERMS+".OPERATOR"); - } else - if (term instanceof XAnd_c) { - w.write(XTERMS+".makeAnd("); - w.begin(0); - serializeTerm(((XAnd_c)term).left(), parent); - w.write(","); - w.allowBreak(0, " "); - serializeTerm(((XAnd_c)term).right(), parent); - w.end(); - w.write(")"); - } else - if (term instanceof XEquals_c) { - w.write(XTERMS+".makeEquals("); - w.begin(0); - serializeTerm(((XEquals_c)term).left(), parent); - w.write(","); - w.allowBreak(0, " "); - serializeTerm(((XEquals_c)term).right(), parent); - w.end(); - w.write(")"); - } else - if (term instanceof XNot_c) { - w.write(XTERMS+".makeNot("); - w.begin(0); - serializeTerm(((XNot_c)term).unaryArg(), parent); - w.end(); - w.write(")"); - } else - if (term instanceof XFormula_c) { - if (!((XFormula_c)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(); - for (XTerm arg : arguments) { - w.write(","); - w.allowBreak(0, " "); - serializeTerm(arg, parent); - } - w.end(); - w.write(")"); - } else - if (term instanceof XTypeLit_c) { - w.write("new x10.types.ConstrainedType.XTypeLit_c("); - w.begin(0); - new RuntimeTypeExpander(this, ((XTypeLit_c)term).type()).expand(tr); - w.end(); - w.write(")"); - } else - if (term instanceof XLit_c) { - Object val = ((XLit_c)term).val(); - w.write(XTERMS+".makeLit("); - w.begin(0); - if (val == null) { - w.write("null"); - } else - if (val instanceof Boolean || val instanceof Number) { - w.write(val.toString()); - } else - if (val instanceof Character) { - CharLit lit = tr.nodeFactory().CharLit(Position.COMPILER_GENERATED, ((Character) val).charValue()); - tr.print(null, lit, w); - } else - if (val instanceof String) { - StringLit lit = tr.nodeFactory().StringLit(Position.COMPILER_GENERATED, (String) val); - tr.print(null, lit, w); - } else - if (val instanceof QName) { - StringLit lit = tr.nodeFactory().StringLit(Position.COMPILER_GENERATED, ((QName) val).toString()); - tr.print(null, lit, w); - } else - if (val instanceof XName) { - serializeName((XName) val); - } else - if (val.getClass() == Object.class) { - StringLit lit = tr.nodeFactory().StringLit(Position.COMPILER_GENERATED, val.toString()); - tr.print(null, lit, w); - } else - { - throw new RuntimeException("Unknown value type "+val.getClass()); - } - w.end(); - w.write(")"); - } else - if (term instanceof XField_c) { - w.write(XTERMS+".makeField((x10.constraint.XVar)"); - w.begin(0); - serializeTerm(((XField_c)term).receiver(), parent); - w.write(","); - w.allowBreak(0, " "); - serializeName(((XField_c)term).field()); - w.end(); - w.write(")"); - } else - if (term instanceof XEQV_c) { - w.write("genEQV("); - w.begin(0); - serializeName(((XEQV_c)term).name()); - w.write(","); - w.allowBreak(0, " "); - w.write(""+((XEQV_c)term).isEQV()); - w.end(); - w.write(")"); - } else - if (term instanceof XLocal_c) { - w.write(XTERMS+".makeLocal("); - w.begin(0); - serializeName(((XLocal_c)term).name()); - w.end(); - w.write(")"); - } else - { - throw new RuntimeException("Unknown term type "+term.getClass()+": "+term); - } - } - - private void serializeName(XName n) { - assert (n instanceof XNameWrapper); - XNameWrapper<?> name = (XNameWrapper<?>) n; - w.write(XTERMS+".makeName("); - w.begin(0); - Object val = name.val(); - if (val == null) { - w.write("null"); - } else - if (val instanceof Def) { - StringLit lit = tr.nodeFactory().StringLit(Position.COMPILER_GENERATED, val.toString()); - tr.print(null, lit, w); - } else - if (val instanceof ParameterType) { - StringLit lit = tr.nodeFactory().StringLit(Position.COMPILER_GENERATED, val.toString()); - tr.print(null, lit, w); - } else - if (val instanceof Binary.Operator) { - StringLit lit = tr.nodeFactory().StringLit(Position.COMPILER_GENERATED, val.toString()); - tr.print(null, lit, w); - } else - if (val instanceof Unary.Operator) { - StringLit lit = tr.nodeFactory().StringLit(Position.COMPILER_GENERATED, val.toString()); - tr.print(null, lit, w); - } else - if (val instanceof String) { - StringLit lit = tr.nodeFactory().StringLit(Position.COMPILER_GENERATED, val.toString()); - tr.print(null, lit, w); - } else - if (val.getClass() == Object.class) { - StringLit lit = tr.nodeFactory().StringLit(Position.COMPILER_GENERATED, val.toString()); - tr.print(null, lit, w); - } else - { - throw new RuntimeException("Unknown value type "+val.getClass()); - } - w.write(","); - w.allowBreak(0, " "); - StringLit lit = tr.nodeFactory().StringLit(Position.COMPILER_GENERATED, name.toString()); - tr.print(null, lit, w); - w.end(); - w.write(")"); - } - - - public void generateDispatchers(X10ClassDef cd) { - if (true) return; - if (cd.flags().isInterface() || cd.flags().isAbstract()) { - return; - } - - X10ClassType ct = (X10ClassType) cd.asType(); - - Collection<MethodInstance> seen = new ArrayList<MethodInstance>(); - - // Remove methods where we generate the dispatcher directly. - for (MethodDef md : cd.methods()) { - MethodInstance mi = md.asInstance(); - mi = (MethodInstance) mi.container(ct); - if (methodUsesClassParameter(mi.def()) && ! md.flags().isStatic()) - seen.add(mi); - } - - List<MethodInstance> methods = new ArrayList<MethodInstance>(); - getInheritedVirtualMethods(ct, methods); - - // Remove abstract or overridden methods. - for (ListIterator<MethodInstance> i = methods.listIterator(); i.hasNext(); ) { - MethodInstance mi = i.next(); - if (mi.flags().isAbstract()) { - i.remove(); - continue; - } - X10TypeSystem ts = (X10TypeSystem) tr.typeSystem(); - MethodInstance mj = ts.findImplementingMethod(cd.asType(), mi, tr.context()); - if (mj != null && mj.def() != mi.def()) - i.remove(); - } - - // Remove methods that don't need dispatchers - // and reset containers. - for (ListIterator<MethodInstance> i = methods.listIterator(); i.hasNext(); ) { - MethodInstance mi = i.next(); - mi = (MethodInstance) mi.container(ct); - if (!overridesMethodThatUsesClassParameter(mi)) - i.remove(); - else if (methodUsesClassParameter(mi.def())) - i.remove(); - else - i.set(mi); - } - - // Remove seen methods. - for (ListIterator<MethodInstance> i = methods.listIterator(); i.hasNext(); ) { - MethodInstance mi = i.next(); - if (seen(seen, mi)) - i.remove(); - } - - for (MethodInstance mi : methods) { - generateDispatcher((X10MethodInstance) mi, methodUsesClassParameter(mi.def())); - } - } - - private boolean seen(Collection<MethodInstance> seen, MethodInstance mi) { - for (MethodInstance mj : seen) { - if (mi.name().equals(mj.name()) && mj.hasFormals(mi.formalTypes(), tr.context())) - return true; - } - seen.add(mi); - return false; - } - - public void getInheritedVirtualMethods(X10ClassType ct, List<MethodInstance> methods) { - for (MethodInstance mi : ct.methods()) { - if (! mi.flags().isStatic()) - methods.add(mi); - } - Type sup = ct.superClass(); - if (sup instanceof X10ClassType) { - getInheritedVirtualMethods((X10ClassType) sup, methods); - } - for (Type t : ct.interfaces()) { - if (t instanceof X10ClassType) { - getInheritedVirtualMethods((X10ClassType) t, methods); - } - } - } - - public void generateDispatcher(X10MethodInstance md, boolean usesClassParam) { - X10TypeSystem ts = (X10TypeSystem) tr.typeSystem(); - - Flags flags = md.flags(); - flags = X10Flags.toX10Flags(flags).clearExtern(); - flags = flags.clearNative(); - - // Hack to ensure that X10Flags are not printed out .. javac will - // not know what to do with them. - flags = X10Flags.toX10Flags(flags); - - w.begin(0); - w.write(flags.translate()); - - String sep = "<"; - for (int i = 0; i < md.typeParameters().size(); i++) { - w.write(sep); - sep = ", "; - printType(md.typeParameters().get(i), X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS | X10PrettyPrinterVisitor.BOX_PRIMITIVES); - } - if (md.typeParameters().size() > 0) - w.write("> "); - - printType(md.returnType(), X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS | X10PrettyPrinterVisitor.BOX_PRIMITIVES); - w.allowBreak(2, 2, " ", 1); - w.write(mangleIdentifier(md.name()).toString()); - - w.write("("); - - w.allowBreak(2, 2, "", 0); - w.begin(0); - boolean first = true; - - // Add a formal parameter of type Type for each type parameters. - for (Type p : md.typeParameters()) { - if (! first) { - w.write(","); - w.allowBreak(0, " "); - } - first = false; - w.write("final "); - w.write(X10PrettyPrinterVisitor.X10_RUNTIME_TYPE_CLASS); - w.write(" "); - Type pt = p; - assert pt instanceof ParameterType; - w.write(mangleIdentifier(((ParameterType) pt).name()).toString()); - } - - List<Expander> dispatchArgs = new ArrayList<Expander>(); - - for (Type pt : md.typeParameters()) { - dispatchArgs.add(new Inline(this, mangleIdentifier(((ParameterType) pt).name()).toString())); - } - - for (int i = 0; i < md.formalTypes().size(); i++) { - Type f = md.formalTypes().get(i); - if (! first) { - w.write(","); - w.allowBreak(0, " "); - } - first = false; - - w.write(Flags.FINAL.translate()); - printType(f, X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS | X10PrettyPrinterVisitor.BOX_PRIMITIVES); - w.write(" "); - - Name name = Name.make("a" + (i+1)); - w.write(name.toString()); - - dispatchArgs.add(new Join(this, "", CollectionUtil.list("(", new TypeExpander(this, f, true, true, false), ") ", name.toString()))); - } - - w.end(); - w.write(")"); - - if (! md.throwTypes().isEmpty()) { - w.allowBreak(6); - w.write("throws "); - - for (Iterator<Type> i = md.throwTypes().iterator(); i.hasNext(); ) { - Type t = i.next(); - printType(t, X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS); - if (i.hasNext()) { - w.write(","); - w.allowBreak(4, " "); - } - } - } - - w.end(); - - if (isAbstract(md)) { - w.write(";"); - return; - } - - w.write(" "); - w.write("{"); - w.allowBreak(4); - - if (! md.returnType().isVoid()) { - w.write(" return "); - } - - String pat = getJavaImplForDef(md.x10Def()); - if (pat != null) { - String target = "this"; - emitNativeAnnotation(pat, target, md.typeParameters(), dispatchArgs); - w.write("; }"); - return; - } - - w.write("this"); - w.write("."); - - - sep = "<"; - for (int i = 0; i < md.typeParameters().size(); i++) { - w.write(sep); - sep = ", "; - printType(md.typeParameters().get(i), X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS | - X10PrettyPrinterVisitor.BOX_PRIMITIVES); - } - if (md.typeParameters().size() > 0) - w.write("> "); - - w.write(mangleIdentifier(md.name()).toString()); - w.write("("); - w.begin(0); - - for (int i = 0; i < dispatchArgs.size(); i++) { - if (i != 0) { - w.write(","); - w.allowBreak(0, " "); - } - dispatchArgs.get(i).expand(tr); - } - - w.end(); - w.write(");"); - w.allowBreak(0, " "); - w.write("}"); - } - - boolean isAbstract(MemberInstance<?> mi) { - if (mi.flags().isAbstract()) - return true; - Type t = X10TypeMixin.baseType(mi.container()); - if (t instanceof ClassType) { - ClassType ct = (ClassType) t; - if (ct.flags().isInterface()) - return true; - } - return false; - } - public void generateRTTMethods(X10ClassDef def) { - generateRTTMethods(def, false); - } - - public void generateRTTMethods(X10ClassDef def, boolean boxed) { - Set<ClassDef> visited = new HashSet<ClassDef>(); - visited.add(def); - - // Generate RTTI methods, one for each parameter. - for (int i = 0; i < def.typeParameters().size(); i++) { - ParameterType pt = def.typeParameters().get(i); - ParameterType.Variance var = def.variances().get(i); - - w.write("public x10.types.Type<?> " + "rtt_" + mangle(def.fullName()) + "_"); - w.write(mangleIdentifier(pt.name()).toString()); - w.write("()"); - - if (def.flags().isInterface()) { - w.write(";"); - } - else if (! boxed) { - w.write(" { return this."); - w.write(mangleIdentifier(pt.name()).toString()); - w.write("; }"); - } - else { - w.write(" { throw new java.lang.RuntimeException(); }"); - } - w.newline(); - } - - // Generate RTTI methods for each interface instantiation. - if (! def.flags().isInterface()) { - 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 ct = (X10ClassType) it; - X10ClassDef idef = ct.x10Def(); - - if (visited.contains(idef)) - continue; - visited.add(idef); - - for (Type t : ct.interfaces()) { - Type it2 = X10TypeMixin.baseType(t); - worklist.add(it2); - } - - for (int i = 0; i < idef.typeParameters().size(); i++) { - ParameterType pt = idef.typeParameters().get(i); - w.write("public x10.types.Type<?> " + "rtt_" + mangle(idef.fullName()) + "_"); - w.write(mangleIdentifier(pt.name()).toString()); - w.write("() { "); - - if (! boxed) { - w.write("return "); - Type at = ct.typeArguments().get(i); - new RuntimeTypeExpander(this, at).expand(); - } - else { - w.write("throw new java.lang.RuntimeException()"); - } - - w.write("; }"); - w.newline(); - } - } - } - } - } - /* - * For "java" annotations: - * - * Given a method with signature: - * def m[X, Y](x, y); - * and a call - * o.m[A, B](a, b); - * #0 = o - * #1 = A - * #2 = boxed representation of A - * #3 = run-time Type object for A - * #4 = B - * #5 = boxed representation of B - * #6 = run-time Type object for B - * #7 = a - * #8 = b - */ - public void emitNativeAnnotation(String pat, Object target, List<Type> types, List<? extends Object> args) { - Object[] components = new Object[1 + types.size() * 3 + args.size()]; - int i = 0; - components[i++] = target; - for (Type at : types) { - components[i++] = new TypeExpander(this, at, true, false, false); - components[i++] = new TypeExpander(this, at, true, true, false); - components[i++] = new RuntimeTypeExpander(this, at); - } - for (Object e : args) { - components[i++] = e; - } - this.dumpRegex("Native", components, tr, pat); - } - private boolean overridesMethodThatUsesClassParameter(MethodInstance mi) { - if (methodUsesClassParameter(mi.def())) - return true; - - for (MethodInstance mj : mi.implemented(tr.context())) { - boolean usesParameter = methodUsesClassParameter(mj.def()); - if (usesParameter) - return true; - } - - return false; - } - - private boolean methodUsesClassParameter(MethodDef md) { - Type container = Types.get(md.container()); - container = X10TypeMixin.baseType(container); - if (container instanceof X10ClassType) { - X10ClassDef cd = ((X10ClassType) container).x10Def(); - - if (cd.typeParameters().size() == 0) - return false; - - if (getJavaRep(cd) != null) - return false; - - for (Ref<? extends Type> tref : md.formalTypes()) { - Type t = Types.get(tref); - if (t instanceof ParameterType) { - ParameterType pt = (ParameterType) t; - Def d = Types.get(pt.def()); - if (d == cd) { - return true; - } - } - } - Type t = Types.get(md.returnType()); - if (t instanceof ParameterType) { - ParameterType pt = (ParameterType) t; - Def d = Types.get(pt.def()); - if (d == cd) { - return true; - } - } - } - - return false; - } - public static List<Object> asList(Object a, Object b) { - List<Object> l = new ArrayList<Object>(2); l.add(a); l.add(b); return l; - } - public static List<Object> asList(Object a, Object b, Object c) { - List<Object> l = new ArrayList<Object>(3); l.add(a); l.add(b); l.add(c); return l; - } - public static List<Object> asList(Object a, Object b, Object c, Object d) { - List<Object> l = new ArrayList<Object>(3); l.add(a); l.add(b); l.add(c); l.add(d); return l; - } - public static List<Object> asList(Object a, Object b, Object c, Object d, Object e) { - List<Object> l = new ArrayList<Object>(3); l.add(a); l.add(b); l.add(c); l.add(d); l.add(e); return l; - } - - public void generateMethodDecl(X10MethodDecl_c n, boolean boxPrimitives) { - X10TypeSystem ts = (X10TypeSystem) tr.typeSystem(); - - Flags flags = n.flags().flags(); - - Context c = tr.context(); - - if (c.currentClass().flags().isInterface()) { - flags = flags.clearPublic(); - flags = flags.clearAbstract(); - } - - // Hack to ensure that X10Flags are not printed out .. javac will - // not know what to do with them. - flags = X10Flags.toX10Flags(flags); - - w.begin(0); - w.write(flags.translate()); - - String sep = "<"; - for (int i = 0; i < n.typeParameters().size(); i++) { - w.write(sep); - sep = ", "; - printType(n.typeParameters().get(i).type(), X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS | X10PrettyPrinterVisitor.BOX_PRIMITIVES); - } - if (n.typeParameters().size() > 0) - w.write("> "); - - printType(n.returnType().type(), X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS | (boxPrimitives ? X10PrettyPrinterVisitor.BOX_PRIMITIVES : 0)); - w.allowBreak(2, 2, " ", 1); - tr.print(n, n.name(), w); - - w.write("("); - - w.allowBreak(2, 2, "", 0); - w.begin(0); - boolean first = true; - - // Add a formal parameter of type Type for each type parameters. - for (TypeParamNode p : n.typeParameters()) { - if (! first) { - w.write(","); - w.allowBreak(0, " "); - } - first = false; - - w.write("final "); - w.write(X10PrettyPrinterVisitor.X10_RUNTIME_TYPE_CLASS); - w.write(" "); - w.write(Emitter.mangleIdentifier(p.name().id()).toString()); - } - - for (int i = 0; i < n.formals().size(); i++) { - Formal f = n.formals().get(i); - if (! first) { - w.write(","); - w.allowBreak(0, " "); - } - first = false; - - tr.print(n, f.flags(), w); - printType(f.type().type(), X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS | (boxPrimitives ? X10PrettyPrinterVisitor.BOX_PRIMITIVES : 0)); - w.write(" "); - - Name name = f.name().id(); - if (name.toString().equals("")) { - name = Name.makeFresh("a"); - } - tr.print(n, f.name().id(name), w); - } - - w.end(); - w.write(")"); - - if (! n.throwTypes().isEmpty()) { - w.allowBreak(6); - w.write("throws "); - - - for (Iterator<TypeNode> i = n.throwTypes().iterator(); i.hasNext(); ) { - TypeNode tn = (TypeNode) i.next(); - // vj 09/26/08: Changed to print out translated version of throw type - // tr.print(n, tn, w); - // TODO: Nate to check. - printType(tn.type(), X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS); - - if (i.hasNext()) { - w.write(","); - w.allowBreak(4, " "); - } - } - } - - w.end(); - - if (n.body() != null) { - - // if (! unboxFormals.isEmpty()) { - // for (Map.Entry<Name,Formal> e : unboxFormals.entrySet()) { - // Name newName = e.getKey(); - // Formal f = e.getValue(); - // tr.print(n, f.flags(), w); - // printType(f.type().type(), true, false, false); // don't box - // w.write(" "); - // tr.print(n, f.name(), w); - // w.write(" = "); - // w.write(newName.toString()); - // w.write(";"); - // } - // w.allowBreak(0, " "); - - tr.print(n, n.body(), w); - } - else { - w.write(";"); - } - } - - public void generateRTType(X10ClassDef def) { - w.newline(); - - String mangle = mangle(def.fullName()); - - boolean isConstrained = def.classInvariant() != null && !def.classInvariant().get().valid(); - - String superClass = "x10.types.RuntimeType"; - if (X10PrettyPrinterVisitor.serialize_runtime_constraints && isConstrained) { // constrained type; treat specially - superClass = "x10.types.ConstrainedType"; - } - - if (def.asType().isGloballyAccessible()) { - w.write("public static "); - } - w.write("class "); - - Expander rttShortName; - - if (def.typeParameters().size() == 0) { - rttShortName = new Join(this, "", rttShortName(def), ""); - } - else { - X10ClassType ct = (X10ClassType) def.asType(); - rttShortName = new Join(this, ", ", ct.typeArguments()); - List<TypeExpander> args = new ArrayList<TypeExpander>(); - for (Type a : ct.typeArguments()) { - args.add(new TypeExpander(this, a, - X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS - | X10PrettyPrinterVisitor.BOX_PRIMITIVES)); - } - rttShortName = new Join(this, "", rttShortName(def), "<", - new Join(this, ", ", args), ">"); - } - - rttShortName.expand(tr); - - w.write(" extends "); - w.write(superClass); - w.write("<"); - printType(def.asType(), X10PrettyPrinterVisitor.BOX_PRIMITIVES - | X10PrettyPrinterVisitor.PRINT_TYPE_PARAMS - | X10PrettyPrinterVisitor.NO_VARIANCE); - w.write("> {"); - w.newline(); - w.begin(4); - if (def.asType().isGloballyAccessible() && def.typeParameters().size() == 0) { - w.write("public static final "); - rttShortName.expand(tr); - w.write(" it = new "); - rttShortName.expand(tr); - w.write("();"); - w.newline(); - w.newline(); - } - for (int i = 0; i < def.typeParameters().size(); i++) { - ParameterType pt = def.typeParameters().get(i); - w.write("public final x10.types.Type "); - w.write(Emitter.mangleIdentifier(pt.name()).toString()); - w.write(";"); - w.newline(); - } - w.newline(); - w.write("public " + this.rttShortName(def) + "("); - - for (int i = 0; i < def.typeParameters().size(); i++) { - ParameterType pt = def.typeParameters().get(i); - if (i != 0) - w.write(", "); - w.write("final x10.types.Type "); - w.write(Emitter.mangleIdentifier(pt.name()).toString()); - } - - w.write(") {"); - w.begin(4); - w.write("super("); - - if (X10PrettyPrinterVisitor.serialize_runtime_constraints && isConstrained) { // constrained type; treat specially - w.write("new x10.types.RuntimeType<"); - printType(def.asType(), X10PrettyPrinterVisitor.BOX_PRIMITIVES); - w.write(">("); - printType(def.asType(), X10PrettyPrinterVisitor.BOX_PRIMITIVES); - w.write(".class"); - w.write(")"); - // new RuntimeTypeExpander(def.asType()).expand(tr); // Cannot do this, because we are *defining* T.it here - w.write(", "); - w.write("null, "); // TODO - XConstraint constraint = def.classInvariant().get(); - assert (constraint != null); - serializeConstraint(constraint); - } - else { - printType(def.asType(), X10PrettyPrinterVisitor.BOX_PRIMITIVES); - w.write(".class"); - } - w.write(");"); - w.newline(); - for (int i = 0; i < def.typeParameters().size(); i++) { - ParameterType pt = def.typeParameters().get(i); - w.write("this."); - w.write(Emitter.mangleIdentifier(pt.name()).toString()); - w.write(" = "); - w.write(Emitter.mangleIdentifier(pt.name()).toString()); - w.write(";"); - w.newline(); - } - w.end(); - w.write("}"); - w.newline(); - w.write("public boolean instanceof$(java.lang.Object o) {"); - w.newline(); - w.begin(4); - if (def.asType().isInnerClass()) { - w.write("try { "); - printType(def.asType(), X10PrettyPrinterVisitor.BOX_PRIMITIVES); - w.write(" zzz = ("); - printType(def.asType(), X10PrettyPrinterVisitor.BOX_PRIMITIVES); - w.write(") o; } catch (ClassCastException xyzzy) { return false; }"); - } - else { - w.write("if (! (o instanceof "); - printType(def.asType(), X10PrettyPrinterVisitor.BOX_PRIMITIVES); - w.write(")) return false;"); - } - w.newline(); - // w.write("RTT ro = (RTT) new RTT(this, o);"); - // w.newline(); - // w.write("if (ro == null) return false;"); -... [truncated message content] |
From: <vj...@us...> - 2009-08-22 10:43:57
|
Revision: 11073 http://x10.svn.sourceforge.net/x10/?rev=11073&view=rev Author: vj0 Date: 2009-08-22 10:43:48 +0000 (Sat, 22 Aug 2009) Log Message: ----------- Partial support for t::= (t==t) constraint terms. Solver is currently incomplete, but can handle many common cases. Need to implement full Shostak congruence closure. Modified Paths: -------------- trunk/x10.compiler/src/x10/types/X10TypeMixin.java trunk/x10.compiler/src/x10/types/XTypeTranslator.java trunk/x10.constraints/src/x10/constraint/XConstraint.java trunk/x10.constraints/src/x10/constraint/XConstraint_c.java trunk/x10.constraints/src/x10/constraint/XPromise_c.java trunk/x10.runtime/src-x10/x10/lang/Region.x10 trunk/x10.tests/examples/Constructs/Array/ArrayPlusEqual.x10 Modified: trunk/x10.compiler/src/x10/types/X10TypeMixin.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeMixin.java 2009-08-22 02:22:42 UTC (rev 11072) +++ trunk/x10.compiler/src/x10/types/X10TypeMixin.java 2009-08-22 10:43:48 UTC (rev 11073) @@ -124,6 +124,22 @@ return new XConstraint_c(); } + /** + * Return the constraint c entailed by the assertion v is of type t. + * @param v + * @param t + * @return + */ + public static XConstraint xclause(XVar v, Type t) { + XConstraint c = xclause(t); + try { + return c.substitute(v, c.self()); + } catch (XFailure z) { + XConstraint c1 = new XConstraint_c(); + c1.setInconsistent(); + return c1; + } + } public static XConstraint xclause(Type t) { if (t instanceof AnnotatedType) { AnnotatedType at = (AnnotatedType) t; @@ -468,4 +484,22 @@ public static XTerm getRegionUpperBound(Type type) { return null; } + + public static boolean hasVar(Type t, XVar x) { + if (t instanceof ConstrainedType) { + ConstrainedType ct = (ConstrainedType) t; + Type b = baseType(t); + XConstraint c = xclause(t); + if ( hasVar(b, x)) return true; + for (XTerm term : c.constraints()) { + if (term.hasVar(x)) + return true; + } + } + if (t instanceof MacroType) { + MacroType pt = (MacroType) t; + return hasVar(pt.definedType(), x); + } + return false; + } } Modified: trunk/x10.compiler/src/x10/types/XTypeTranslator.java =================================================================== --- trunk/x10.compiler/src/x10/types/XTypeTranslator.java 2009-08-22 02:22:42 UTC (rev 11072) +++ trunk/x10.compiler/src/x10/types/XTypeTranslator.java 2009-08-22 10:43:48 UTC (rev 11073) @@ -44,6 +44,7 @@ import x10.constraint.XConstraint; import x10.constraint.XConstraint_c; import x10.constraint.XEQV_c; +import x10.constraint.XEquals; import x10.constraint.XFailure; import x10.constraint.XLit; import x10.constraint.XLit_c; @@ -70,7 +71,7 @@ } // TODO: vj 08/11/09 -- why does this do nothing? - public void addTypeToEnv(XTerm self, final Type t) throws SemanticException { + public void addTypeToEnv(XTerm self, final Type t) /*throws SemanticException*/ { } private XTerm trans(XConstraint c, Unary t, X10Context xc) throws SemanticException { @@ -175,6 +176,33 @@ } } + public XConstraint normalize(XConstraint c, X10Context xc) { + XConstraint result = new XConstraint_c(); + for (XTerm term : c.extConstraints()) { + try { + if (term instanceof XEquals) { + XEquals xt = (XEquals) term; + XTerm right = xt.right(); + if (right instanceof XEquals) { + XEquals xright = (XEquals) right; + XTerm t1 = xright.left(); + XTerm t2 = xright.right(); + if (c.entails(t1, t2)) { + result.addBinding(xt.left(), XTerms.TRUE); + } else + if (c.disEntails(t1, t2)) { + result.addBinding(xt.left(), XTerms.FALSE); + } else + result.addBinding(xt.left(), xt.right()); + } + } else + result.addTerm(term); + } catch (XFailure t) { + + } + } + return result; + } public XLocal trans(LocalInstance li) throws SemanticException { return trans(li, li.type()); } @@ -212,24 +240,6 @@ // return XTerms.makeLit(t); } - public static boolean hasVar(Type t, XVar x) { - if (t instanceof ConstrainedType) { - ConstrainedType ct = (ConstrainedType) t; - Type b = X10TypeMixin.baseType(t); - XConstraint c = X10TypeMixin.xclause(t); - if ( hasVar(b, x)) return true; - for (XTerm term : c.constraints()) { - if (term.hasVar(x)) - return true; - } - } - if (t instanceof MacroType) { - MacroType pt = (MacroType) t; - return hasVar(pt.definedType(), x); - } - return false; - } - public static Type subst(Type t, XTerm y, XRoot x) throws SemanticException { return Subst.subst(t, y, x); } @@ -280,7 +290,7 @@ } public boolean hasVar(XVar v) { - return XTypeTranslator.hasVar(type(), v); + return X10TypeMixin.hasVar(type(), v); } public XTerm subst(XTerm y, XRoot x, boolean propagate) { @@ -358,6 +368,38 @@ c.addTerm(new SubtypeConstraint_c(left.type(), right.type(), t.equals())); } + private XTerm simplify(Binary rb, XTerm v) { + XTerm result = v; + Expr r1 = rb.left(); + Expr r2 = rb.right(); + + // Determine if their types force them to be equal or disequal. + + XConstraint c1 = X10TypeMixin.xclause(r1.type()).copy(); + XVar x = genEQV(c1, false); + try { + c1.addSelfBinding(x); + } catch (XFailure z) { + // cant happen + } + XConstraint c2 = X10TypeMixin.xclause(x, r2.type()).copy(); + if (rb.operator()== Binary.EQ) { + try { + if (! c1.addIn(c2).consistent()) + result = XTerms.FALSE; + try { + if (c1.entails(c2) && c2.entails(c1)) { + result = XTerms.TRUE; + } + } catch (XFailure z) { + // nothing, shouldnt happen. + } + } catch (XFailure z) { + result = XTerms.FALSE; + } + } + return result; + } private XTerm trans(XConstraint c, Binary t, X10Context xc) throws SemanticException { Expr left = t.left(); @@ -368,7 +410,17 @@ if (lt == null || rt == null) throw new SemanticException("Cannot translate " + t + " to constraint term."); if (t.operator() == Binary.EQ) { - v = XTerms.makeEquals(lt, rt); + if (right instanceof ParExpr) { + right = ((ParExpr)right).expr(); + } + if (right instanceof Binary && ((Binary) right).operator() == Binary.EQ) { + rt = simplify((Binary) right, rt); + } + if (left instanceof Binary && ((Binary) right).operator() == Binary.EQ) { + lt = simplify((Binary) left, lt); + } + + v = XTerms.makeEquals(lt, rt); } else if (t.operator() == Binary.COND_AND || (t.operator() == Binary.BIT_AND && ts.isImplicitCastValid(t.type(), ts.Boolean(), xc))) { v = XTerms.makeAnd(lt, rt); @@ -578,19 +630,19 @@ return v; } - public XRoot genEQV(XConstraint c, Type t) throws SemanticException { + public XRoot genEQV(XConstraint c, Type t) { XRoot v = c.genEQV(); addTypeToEnv(v, t); return v; } - public XRoot genEQV(XConstraint c, Type t, boolean hidden) throws SemanticException { + public XRoot genEQV(XConstraint c, Type t, boolean hidden) { XRoot v = c.genEQV(hidden); addTypeToEnv(v, t); return v; } - public XVar genEQV(XConstraint c, boolean hidden) throws SemanticException { + public XVar genEQV(XConstraint c, boolean hidden) { XVar v = c.genEQV(hidden); return v; Modified: trunk/x10.constraints/src/x10/constraint/XConstraint.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XConstraint.java 2009-08-22 02:22:42 UTC (rev 11072) +++ trunk/x10.constraints/src/x10/constraint/XConstraint.java 2009-08-22 10:43:48 UTC (rev 11073) @@ -297,4 +297,5 @@ * @return */ List<XFormula> atoms(); + } Modified: trunk/x10.constraints/src/x10/constraint/XConstraint_c.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XConstraint_c.java 2009-08-22 02:22:42 UTC (rev 11072) +++ trunk/x10.constraints/src/x10/constraint/XConstraint_c.java 2009-08-22 10:43:48 UTC (rev 11073) @@ -18,11 +18,51 @@ import java.util.Set; /** - * A representation of constraints of the form X1=t1 && ... Xk == tk. - * Note that there is no unification, only checking. So it is possible - * to represent such a constraint directly as a mapping from Xi to ti. - * The constraint is implemented as a Map from variables to terms. + * A constraint solver for the following constraint system: + * <verbatim> + * t ::= x -- variable + * | t.f -- field access + * | g(t1,..., tn) -- uninterpreted function symbol + * + * c ::= t == t -- equality + * | t != t -- dis-equality + * | c,c -- conjunction + * | p(t1,..., tn) -- atomic formula + * </verbatim> * + * The constraint system implements the usual congruence rules for equality. + * + * <p> TBD: Add + * <verbatim> + * t ::= t == t + * </verbatim> + * + * <p> This is useful in specifying that a Region is zeroBased iff its rank=0. + * + * + * <p>A constraint is implemented as a graph whose nodes are XPromises. Additionally, a constraint + * keeps track of two variables, self and this. + * + * <p> + * A promise contains fields: + * <olist> + * <li>XPromise value -- points to a node it has been equated to + * <li>Collection<XPromise> disequals -- contains set of other nodes this has been disequated with + * <li>XTerm var -- externally visible term labeling this promise + * <li>Map<XName, XPromise> fields -- hashmap of fields of this promise. + * </olist> + * It maintsins the invariant <tt> value != null implies (disequals==null,fields == null)</tt> + * + * This representation is a bit different from the Nelson-Oppen and Shostak congruence closure + * algorithms described, e.g. in Cyrluk, Lincoln and Shankar "On Shostak's Decision Procedure + * for Combination of Theories", CADE 96. + * + * <p> + * <bf>TODO:</bf> + * Use Shostak's congruence procedure. Treat <tt>t.f</tt> as the term <tt>f(t)</tt>, + * i.e. each field is regarded as a unary function symbol. This will be helpful in implementing + * Nelson-Oppen integration of decision procedures. + * * @author vj * */ @@ -293,11 +333,9 @@ if (term instanceof XPromise) // this is the case for literals, for here return (XPromise) term; - // otherwise it must be a XVar. if (roots == null) return null; - if (term instanceof XVar) { XVar var = (XVar) term; XVar[] vars = var.vars(); @@ -317,12 +355,22 @@ return null; } + private XTerm simplify(XTerm t) { + return t; + } /** * Add t1=t2 to the constraint, unless it is inconsistent. * @param var -- t1 * @param val -- t2 */ public void addBinding(XTerm left, XTerm right) throws XFailure { + if (right instanceof XEquals) { + right = simplify(right); + } + if (left instanceof XEquals) { + left = simplify(left); + } + assert left != null; assert right != null; @@ -522,6 +570,25 @@ if (entails(left, right)) { return true; } + if (right instanceof XEquals) { + XEquals r = (XEquals) right; + if (entails(r.left(), r.right())) { + return entails(left, XTerms.TRUE); + } + if (disEntails(r.left(), r.right())) { + return entails(left, XTerms.FALSE); + } + } + if (right instanceof XDisEquals) { + XDisEquals r = (XDisEquals) right; + if (entails(r.left(), r.right())) { + return entails(left, XTerms.FALSE); + } + if (disEntails(r.left(), r.right())) { + return entails(left, XTerms.TRUE); + } + } + } else if (t instanceof XDisEquals) { XDisEquals f = (XDisEquals) t; XTerm left = f.left(); @@ -548,13 +615,13 @@ } return false; } - List<XTerm> atoms = constraints(); + if (t.solver() != null) { if (t.solver().entails(this, t, sigma)) return true; } - + List<XTerm> atoms = constraints(); for (XTerm ta : atoms) { if (ta.solver() != null && ta.solver() != t.solver()) { if (ta.solver().entails(this, t, sigma)) @@ -588,25 +655,31 @@ int r1Count = 0; XVar[] vars1 = null; if (p1 instanceof XPromise_c) { - r1Count = ((XPromise_c) p1).lookupReturnValue(); - vars1 = ((XVar) t1).vars(); + if (t1 instanceof XVar) { + r1Count = ((XPromise_c) p1).lookupReturnValue(); + vars1 = ((XVar) t1).vars(); + } } - + XPromise p2 = lookupPartialOk(t2); if (p2 == null) // No match, the term t2 is not equated to anything by this. - return false; + return false; int r2Count = 0; XVar[] vars2 = null; if (p2 instanceof XPromise_c) { - r2Count = ((XPromise_c) p2).lookupReturnValue(); - if (! (t2 instanceof XVar)) { + if (t2 instanceof XVar) { + r2Count = ((XPromise_c) p2).lookupReturnValue(); + /* if (! (t2 instanceof XVar)) { assert false: "Internal Error:" + t2 + "expected to be an XVar."; - } - vars2 = ((XVar) t2).vars(); + }*/ + vars2 = ((XVar) t2).vars(); + } } - if ((r1Count == 0 || r1Count == vars1.length) && (r2Count == 0 || r2Count == vars2.length)) { + if ((!(t1 instanceof XVar) || (r1Count == 0 || r1Count == vars1.length)) + && (! (t1 instanceof XVar) || (r2Count == 0 || r2Count == vars2.length))) { + // exact lookups return p1.equals(p2); } Modified: trunk/x10.constraints/src/x10/constraint/XPromise_c.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XPromise_c.java 2009-08-22 02:22:42 UTC (rev 11072) +++ trunk/x10.constraints/src/x10/constraint/XPromise_c.java 2009-08-22 10:43:48 UTC (rev 11073) @@ -333,6 +333,7 @@ public boolean disBind(/* @nonnull */XPromise target) throws XFailure { assert target.value() == null; + assert forwarded() == false; if (disEquals == null) disEquals = new HashSet<XPromise>(); boolean result = disEquals.add(target); return result; Modified: trunk/x10.runtime/src-x10/x10/lang/Region.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Region.x10 2009-08-22 02:22:42 UTC (rev 11072) +++ trunk/x10.runtime/src-x10/x10/lang/Region.x10 2009-08-22 10:43:48 UTC (rev 11073) @@ -390,8 +390,9 @@ // // - protected def this(rank: int, rect: boolean, zeroBased: boolean) { - property(rank, rect, zeroBased); + protected def this(r: int, t: boolean, z: boolean) + :Region{self.rank==r, self.rect==t, self.zeroBased==z} { + property(r, t, z); } } Modified: trunk/x10.tests/examples/Constructs/Array/ArrayPlusEqual.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayPlusEqual.x10 2009-08-22 02:22:42 UTC (rev 11072) +++ trunk/x10.tests/examples/Constructs/Array/ArrayPlusEqual.x10 2009-08-22 10:43:48 UTC (rev 11073) @@ -2,15 +2,15 @@ public class ArrayPlusEqual extends x10Test { - val v: Rail[int] = Rail.makeVar[int](2, (x:nat)=>0); + val v = Rail.makeVar[int](2, (x:nat)=>0); public def run() { - for ((i):Point(1) in 0..1) v(i) += 5; - for ((i):Point(1) in 0..1) chk(v(i) == 5); + for ((i) in 0..1) v(i) += 5; + for ((i) in 0..1) chk(v(i) == 5); return true; } - public static def main(var args: Rail[String]): void = { + public static def main(Rail[String]) { new ArrayPlusEqual().execute(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vj...@us...> - 2009-08-24 06:28:27
|
Revision: 11075 http://x10.svn.sourceforge.net/x10/?rev=11075&view=rev Author: vj0 Date: 2009-08-24 06:28:15 +0000 (Mon, 24 Aug 2009) Log Message: ----------- Support for proto. All the rules in the design have been implemented (save the last rule for checking bodies of generic classes and methods). XRX has been updated with these changes, and compiles correctly. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/X10AmbAssign_c.java trunk/x10.compiler/src/x10/ast/X10Call_c.java trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java trunk/x10.compiler/src/x10/ast/X10FieldAssign_c.java trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java trunk/x10.compiler/src/x10/ast/X10Field_c.java trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java trunk/x10.compiler/src/x10/ast/X10Special_c.java trunk/x10.compiler/src/x10/parser/X10KWLexer.gi trunk/x10.compiler/src/x10/parser/X10KWLexer.java trunk/x10.compiler/src/x10/parser/X10KWLexerprs.java trunk/x10.compiler/src/x10/parser/X10KWLexersym.java trunk/x10.compiler/src/x10/parser/X10Parser.java trunk/x10.compiler/src/x10/parser/X10Parserprs.java trunk/x10.compiler/src/x10/parser/X10Parsersym.java trunk/x10.compiler/src/x10/parser/x10.g trunk/x10.compiler/src/x10/types/ConstrainedType_c.java trunk/x10.compiler/src/x10/types/MacroType_c.java trunk/x10.compiler/src/x10/types/ParameterType_c.java trunk/x10.compiler/src/x10/types/X10Context.java trunk/x10.compiler/src/x10/types/X10Context_c.java trunk/x10.compiler/src/x10/types/X10Flags.java trunk/x10.compiler/src/x10/types/X10MethodDef.java trunk/x10.compiler/src/x10/types/X10MethodDef_c.java trunk/x10.compiler/src/x10/types/X10NullType_c.java trunk/x10.compiler/src/x10/types/X10ParsedClassType_c.java trunk/x10.compiler/src/x10/types/X10PrimitiveType_c.java trunk/x10.compiler/src/x10/types/X10Type.java trunk/x10.compiler/src/x10/types/X10TypeEnv.java trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java trunk/x10.compiler/src/x10/types/X10TypeMixin.java trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.compiler/src/x10/types/X10UnknownType_c.java trunk/x10.runtime/src-x10/x10/array/BaseArray.x10 trunk/x10.runtime/src-x10/x10/array/DistArray.x10 trunk/x10.runtime/src-x10/x10/array/FastArray.x10 trunk/x10.runtime/src-x10/x10/array/MatBuilder.x10 trunk/x10.runtime/src-x10/x10/array/PolyRegion.x10 trunk/x10.runtime/src-x10/x10/array/PolyScanner.x10 trunk/x10.runtime/src-x10/x10/array/RectLayout.x10 trunk/x10.runtime/src-x10/x10/array/RectRegion.x10 trunk/x10.runtime/src-x10/x10/lang/Clock.x10 trunk/x10.runtime/src-x10/x10/runtime/Activity.x10 trunk/x10.runtime/src-x10/x10/runtime/Clock_c.x10 trunk/x10.runtime/src-x10/x10/runtime/Pool.x10 trunk/x10.runtime/src-x10/x10/runtime/RootFinish.x10 trunk/x10.runtime/src-x10/x10/runtime/Runtime.x10 trunk/x10.runtime/src-x10/x10/util/ArrayList.x10 trunk/x10.runtime/src-x10/x10/util/HashMap.x10 trunk/x10.runtime/src-x10/x10/util/Random.x10 Added Paths: ----------- trunk/x10.tests/tests/Constructs/Proto/ trunk/x10.tests/tests/Constructs/Proto/Cast_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Proto/Coercion2_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Proto/Coercion_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Proto/ConstructorMustReturnProto_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Proto/CovariantCall.x10 trunk/x10.tests/tests/Constructs/Proto/MethodMustReturnProto_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Proto/ProtoAssign.x10 trunk/x10.tests/tests/Constructs/Proto/ProtoAssignField.x10 trunk/x10.tests/tests/Constructs/Proto/ProtoCall_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Proto/ProtoCatch_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Proto/ProtoField_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Proto/ProtoImplements_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Proto/ProtoReadField_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Proto/ProtoSuper_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Proto/StaticMethod_MustFailCompile.x10 Modified: trunk/x10.compiler/src/x10/ast/X10AmbAssign_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10AmbAssign_c.java 2009-08-23 22:10:22 UTC (rev 11074) +++ trunk/x10.compiler/src/x10/ast/X10AmbAssign_c.java 2009-08-24 06:28:15 UTC (rev 11075) @@ -18,6 +18,8 @@ import polyglot.types.SemanticException; import polyglot.util.Position; import polyglot.visit.ContextVisitor; +import polyglot.visit.NodeVisitor; +import x10.types.X10Context; public class X10AmbAssign_c extends AmbAssign_c { @@ -26,6 +28,17 @@ } @Override + public Assign visitLeft(NodeVisitor v) { + + if (v instanceof ContextVisitor) { + ContextVisitor cv = (ContextVisitor) v; + v = cv.context(((X10Context) cv.context()).pushAssignment()); + } + return super.visitLeft(v); + } + + + @Override public Node disambiguate(ContextVisitor ar) throws SemanticException { if (left instanceof Call) { Call c = (Call) left; Modified: trunk/x10.compiler/src/x10/ast/X10Call_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Call_c.java 2009-08-23 22:10:22 UTC (rev 11074) +++ trunk/x10.compiler/src/x10/ast/X10Call_c.java 2009-08-24 06:28:15 UTC (rev 11075) @@ -209,12 +209,22 @@ } } - Call_c call = (Call_c) this.targetImplicit(true).target(r).arguments(args); + X10Call_c call = (X10Call_c) this.targetImplicit(true).target(r).arguments(args); Type rt = X10Field_c.rightType(mi.rightType(), mi.x10Def(), r, c); - call = (Call_c)call.methodInstance(mi).type(rt); + call = (X10Call_c)call.methodInstance(mi).type(rt); + + call.checkProtoMethod(); return call; } + void checkProtoMethod() throws SemanticException { + if (((X10Type) target().type()).isProto() + && ! X10Flags.toX10Flags(methodInstance().flags()).isProto() + ) + throw new SemanticException(methodInstance() + + " must be declared as a proto method since it is called on a receiver " + + target() + " with a proto type."); + } XRoot getThis(Type t) { t = X10TypeMixin.baseType(t); if (t instanceof X10ClassType) { @@ -235,7 +245,8 @@ Expr cc = null; { - // Check if target.name is a field or local of function type; if so, convert to a closure call. + // Check if target.name is a field or local of function type; + // if so, convert to a closure call. X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); @@ -284,6 +295,9 @@ } } } + + + ///////////////////////////////////////////////////////////////////// // Inline the super call here and handle type arguments. @@ -402,13 +416,15 @@ // End inlined super call. ///////////////////////////////////////////////////////////////////// + checkProtoMethod(); + + // If we found a method, the call must typecheck if (X10Flags.toX10Flags(mi.flags()).isRooted() && ! ((X10Type) target.type()).isRooted()) throw new SemanticException(mi + " can only be called on a rooted receiver; " + target + " is not rooted."); - - // If we found a method, the call must type check, so no need to check + // the arguments here. result.checkConsistency(c); // result = result.adjustMI(tc); Modified: trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2009-08-23 22:10:22 UTC (rev 11074) +++ trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2009-08-24 06:28:15 UTC (rev 11075) @@ -92,6 +92,7 @@ import x10.types.X10Flags; import x10.types.X10MethodDef; import x10.types.X10MethodInstance; +import x10.types.X10Type; import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.X10TypeSystem_c; @@ -639,6 +640,7 @@ if (n.superClass == null && type.superType() != null) n = (X10ClassDecl_c) n.superClass(nf.CanonicalTypeNode(position(), type.superType())); + List<TypeNode> newInterfaces = new ArrayList<TypeNode>(); for (Ref<? extends Type> t : type.interfaces()) { boolean added = false; @@ -685,13 +687,16 @@ } map.put(ct.x10Def(), ct); } + n = (X10ClassDecl_c) n.adjustAbstractMethods(oldtc); + return n; } @Override protected void checkSupertypeCycles(TypeSystem ts) throws SemanticException { Ref<? extends Type> stref = type.superType(); + if (stref != null) { Type t = stref.get(); t = followDefs(t); @@ -702,6 +707,10 @@ t + "; not a class.", superClass != null ? superClass.position() : position()); } + if (((X10Type) t).isProto()) { + throw new SemanticException("proto supertypes are not permitted.", + superClass().position()); + } ts.checkCycles((ReferenceType) t); } @@ -715,6 +724,10 @@ throw new SemanticException("Cannot " + s + " type " + t + "; not an interface.", position()); } + if (((X10Type) t).isProto()) { + throw new SemanticException("Cannot implement " + t + "; proto interfaces are illegal.", + position()); + } ts.checkCycles((ReferenceType) t); } } Modified: trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java 2009-08-23 22:10:22 UTC (rev 11074) +++ trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java 2009-08-24 06:28:15 UTC (rev 11075) @@ -357,9 +357,9 @@ ((Ref<Type>) nnci.returnType()).update(r.type()); // Report.report(1, "X10MethodDecl_c: typeoverride mi= " + nn.methodInstance()); - Type retTypeBase = X10TypeMixin.baseType(r.type()); + Type retTypeBase = X10TypeMixin.baseTypeWithoutProto(r.type()); //Type clazz = ((X10Type) X10TypeMixin.baseType(Types.get(nnci.container()))).addFlags(X10Flags.ROOTED); - Type clazz = X10TypeMixin.baseType(Types.get(nnci.container())); + Type clazz = X10TypeMixin.baseTypeWithoutProto(Types.get(nnci.container())); if (! xts.typeEquals(retTypeBase, clazz, tc.context())) { throw new SemanticException("The return type of the constructor (" + retTypeBase + ") must be derived from" @@ -396,19 +396,22 @@ throw new SemanticException("Cannot throw a dependent type.", type.position()); } - return super.typeCheck(tc); + n = (X10ConstructorDecl_c) (super.typeCheck(tc)); + X10TypeMixin.protoTypeCheck(n.formals(), (X10Type) n.returnType().type(), + n.position(), false); + return n; } public Node conformanceCheck(ContextVisitor tc) throws SemanticException { X10ConstructorDecl_c n = (X10ConstructorDecl_c) super.conformanceCheck(tc); X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); - Type retTypeBase = X10TypeMixin.baseType(n.returnType().type()); + Type retTypeBase = ((X10Type) X10TypeMixin.baseTypeWithoutProto(n.returnType().type())); XConstraint c = X10TypeMixin.xclause(n.returnType().type()); X10ConstructorDef nnci = (X10ConstructorDef) n.constructorDef(); // Type clazz = ((X10Type) nnci.asInstance().container()).setFlags(X10Flags.ROOTED); - Type clazz = nnci.asInstance().container(); + Type clazz = nnci.asInstance().container(); if (! ts.typeEquals(retTypeBase, clazz, tc.context())) { throw new SemanticException("The return type of the constructor (" + retTypeBase + ") must be derived from" Modified: trunk/x10.compiler/src/x10/ast/X10FieldAssign_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10FieldAssign_c.java 2009-08-23 22:10:22 UTC (rev 11074) +++ trunk/x10.compiler/src/x10/ast/X10FieldAssign_c.java 2009-08-24 06:28:15 UTC (rev 11075) @@ -11,6 +11,7 @@ import polyglot.ast.Assign; import polyglot.ast.Assign_c; import polyglot.ast.Expr; +import polyglot.ast.Field; import polyglot.ast.FieldAssign_c; import polyglot.ast.Id; import polyglot.ast.Node; @@ -22,15 +23,63 @@ import polyglot.util.InternalCompilerError; import polyglot.util.Position; import polyglot.visit.ContextVisitor; +import x10.types.X10Context; +import x10.types.X10Flags; +import x10.types.X10Type; +import x10.types.X10TypeMixin; public class X10FieldAssign_c extends FieldAssign_c { public X10FieldAssign_c(Position pos, Receiver target, Id name, Operator op, Expr right) { super(pos, target, name, op, right); } + + @Override + public Assign typeCheckLeft(ContextVisitor tc) throws SemanticException { + tc = tc.context(((X10Context) tc.context()).pushAssignment()); + return super.typeCheckLeft(tc); + } /** Type check the expression. */ public Node typeCheck(ContextVisitor tc) throws SemanticException { + + TypeSystem ts = tc.typeSystem(); + X10FieldAssign_c n = (X10FieldAssign_c) typeCheckLeft(tc); + X10Type t = (X10Type) n.leftType(); + X10Type targetType = (X10Type) n.target().type(); + + if (t == null) + t = (X10Type) ts.unknownType(n.position()); + + Expr right = n.right(); + Assign.Operator op = n.operator(); + + X10Type s = (X10Type) right.type(); + + // Check the proto condition. + + if (s.isProto()) { + if (! targetType.isProto()) { + throw new SemanticException("The receiver " + this.target() + + " does not have a proto type; hence " + + this.right() + + " cannot be assigned to it's field " + this.name(), + this.position()); + } + if (op != ASSIGN) { + throw new SemanticException("Only the assignment operator = can be used to " + + " assign the proto value " + this.right() + + " to a field.", position()); + } + s = s.clearFlags(X10Flags.PROTO); + if (ts.isSubtype(s, t, tc.context())) { + return n.type(t); + } + + throw new SemanticException("Cannot assign " + s + " to " + t + ".", + n.position()); + } + return X10LocalAssign_c.typeCheckAssign(this, tc); } } \ No newline at end of file Modified: trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java 2009-08-23 22:10:22 UTC (rev 11074) +++ trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java 2009-08-24 06:28:15 UTC (rev 11075) @@ -51,6 +51,7 @@ import x10.types.X10Context; import x10.types.X10FieldDef; import x10.types.X10InitializerDef; +import x10.types.X10Type; import x10.types.X10TypeSystem; public class X10FieldDecl_c extends FieldDecl_c implements X10FieldDecl { @@ -240,9 +241,15 @@ @Override public Node typeCheck(ContextVisitor tc) throws SemanticException { + if (this.type().type().isVoid()) throw new SemanticException("Field cannot have type " + this.type().type() + ".", position()); + if (((X10Type)this.type().type()).isProto()) { + throw new SemanticException("Field cannot have type " + + this.type().type() + " (a proto type).", position()); + + } X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); X10Context context = (X10Context) tc.context(); Modified: trunk/x10.compiler/src/x10/ast/X10Field_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Field_c.java 2009-08-23 22:10:22 UTC (rev 11074) +++ trunk/x10.compiler/src/x10/ast/X10Field_c.java 2009-08-24 06:28:15 UTC (rev 11075) @@ -50,6 +50,7 @@ import x10.types.X10Flags; import x10.types.X10MemberDef; import x10.types.X10MethodInstance; +import x10.types.X10Type; import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; @@ -73,52 +74,72 @@ super(pos, target, name); } + public static class ProtoFieldAccessException extends SemanticException{ + public ProtoFieldAccessException(String s) { + super(s); + } + } public Node typeCheck(ContextVisitor tc) throws SemanticException { + Node n = typeCheck1(tc); + // Keep this at the very end. This is caught by + // handle proto. + if (! ((X10Context) tc.context()).inAssignment()) { + if (n instanceof X10Field_c) { + + X10Type xtType = (X10Type) ((X10Field_c) n).target().type(); + if (xtType.isProto()) { + throw new SemanticException("Cannot read fields of the proto value " + + ((X10Field_c) n).target()); + } + } + } + return n; + } + public Node typeCheck1(ContextVisitor tc) throws SemanticException { X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); X10Context c = (X10Context) tc.context(); - if (c == null) { -assert c != null : "pos=" + position(); - } + Type tType = target.type(); - if (tType == null) - assert tType != null : "type of target of |" + this + "| is null"; + if (target instanceof TypeNode) { - Type t = ((TypeNode) target).type(); - t = X10TypeMixin.baseType(t); - if (t instanceof ParameterType) { - throw new SemanticException("Cannot access a static field of a type parameter.", position()); - } + Type t = ((TypeNode) target).type(); + t = X10TypeMixin.baseType(t); + if (t instanceof ParameterType) { + throw new SemanticException("Cannot access a static field of a type parameter.", position()); + } } + + if (c.inSuperTypeDeclaration()) { - Type tBase = X10TypeMixin.baseType(tType); - if (tBase instanceof X10ClassType) { - X10ClassType tCt = (X10ClassType) tBase; - if (tCt.def() == c.supertypeDeclarationType()) { - // The only fields in scope here are the ones explicitly declared here. - for (FieldDef fd : tCt.x10Def().properties()) { - if (fd.name().equals(name.id())) { - X10FieldInstance fi = (X10FieldInstance) fd.asInstance(); - fi = (X10FieldInstance) ts.FieldMatcher(tType, name.id(), c).instantiate(fi); - if (fi != null) { - // Found! - X10Field_c result = this; - Type t = rightType(fi.rightType(), fi.x10Def(), target, c); - result = (X10Field_c) result.fieldInstance(fi).type(t); - return result; - } + Type tBase = X10TypeMixin.baseType(tType); + if (tBase instanceof X10ClassType) { + X10ClassType tCt = (X10ClassType) tBase; + if (tCt.def() == c.supertypeDeclarationType()) { + // The only fields in scope here are the ones explicitly declared here. + for (FieldDef fd : tCt.x10Def().properties()) { + if (fd.name().equals(name.id())) { + X10FieldInstance fi = (X10FieldInstance) fd.asInstance(); + fi = (X10FieldInstance) ts.FieldMatcher(tType, name.id(), c).instantiate(fi); + if (fi != null) { + // Found! + X10Field_c result = this; + Type t = rightType(fi.rightType(), fi.x10Def(), target, c); + result = (X10Field_c) result.fieldInstance(fi).type(t); + return result; + } + } + } + + throw new SemanticException("Cannot access field " + name + " of " + tCt + " in class declaration header; the field may be a member of a superclass.", + position()); } - } - - throw new SemanticException("Cannot access field " + name + " of " + tCt + " in class declaration header; the field may be a member of a superclass.", - position()); } - } } - + try { X10FieldInstance fi = (X10FieldInstance) ts.findField(tType, ts.FieldMatcher(tType, name.id(), c)); if (fi == null) { @@ -129,138 +150,139 @@ X10Field_c result = this; Type type = rightType(fi.rightType(), fi.x10Def(), target, c); if (type instanceof UnknownType) { - throw new SemanticException(); + throw new SemanticException(); } - + Type retType = type; // Substitute in the actual target for this. This is done by findField, now. -// Type thisType = tType; -// XConstraint rc = X10TypeMixin.realX(retType); -// if (rc != null) { -// XVar var= X10TypeMixin.selfVar(thisType); -// if (var == null) -// var = ts.xtypeTranslator().genEQV(rc, thisType); -// XConstraint newRC = rc.substitute(var, ts.xtypeTranslator().transThis(thisType)); -// retType = X10TypeMixin.xclause(retType, newRC); -// fi = fi.type(retType); -// } + // Type thisType = tType; + // XConstraint rc = X10TypeMixin.realX(retType); + // if (rc != null) { + // XVar var= X10TypeMixin.selfVar(thisType); + // if (var == null) + // var = ts.xtypeTranslator().genEQV(rc, thisType); + // XConstraint newRC = rc.substitute(var, ts.xtypeTranslator().transThis(thisType)); + // retType = X10TypeMixin.xclause(retType, newRC); + // fi = fi.type(retType); + // } result = (X10Field_c)fieldInstance(fi).type(retType); result.checkConsistency(c); - + // Check the guard XConstraint guard = ((X10FieldInstance) result.fieldInstance()).guard(); if (guard != null && ! new XConstraint_c().entails(guard, c.constraintProjection(guard))) { - throw new SemanticException("Cannot access field. Field guard not satisfied.", position()); + throw new SemanticException("Cannot access field. Field guard not satisfied.", position()); } - + checkFieldAccessesInDepClausesAreFinal(result, tc); - + if (ENABLE_PLACE_TYPES) - checkFieldPlaceType(result, tc); - + checkFieldPlaceType(result, tc); + //Report.report(1, "X10Field_c: typeCheck " + result+ " has type " + result.type()); return result; - } catch (NoMemberException e) { - if (target instanceof Expr) { - Position pos = position(); - - // Now try 0-ary property methods. - try { - X10MethodInstance mi = ts.findMethod(target.type(), ts.MethodMatcher(target.type(), name.id(), Collections.EMPTY_LIST, c)); - if (X10Flags.toX10Flags(mi.flags()).isProperty()) { - Call call = nf.Call(pos, target, this.name); - call = call.methodInstance(mi); - call = (Call) call.type(rightType(mi.rightType(), mi.x10Def(), target, c)); - return call; - } - } - catch (SemanticException ex) { - } - } - throw e; - } - catch (XFailure e) { - throw new SemanticException(e.getMessage(), position()); - } + } catch (NoMemberException e) { + if (target instanceof Expr) { + Position pos = position(); + + // Now try 0-ary property methods. + try { + X10MethodInstance mi = ts.findMethod(target.type(), ts.MethodMatcher(target.type(), name.id(), Collections.EMPTY_LIST, c)); + if (X10Flags.toX10Flags(mi.flags()).isProperty()) { + Call call = nf.Call(pos, target, this.name); + call = call.methodInstance(mi); + call = (Call) call.type(rightType(mi.rightType(), mi.x10Def(), target, c)); + return call; + } + } + catch (SemanticException ex) { + } + } + throw e; + } + catch (XFailure e) { + throw new SemanticException(e.getMessage(), position()); + } + } - + public static Type rightType(Type t, X10MemberDef fi, Receiver target, Context c) throws SemanticException { - XConstraint x = X10TypeMixin.xclause(t); - if (x != null && fi.thisVar() != null) { - if (target instanceof Expr) { - XVar receiver = null; - try { - X10TypeSystem ts = (X10TypeSystem) t.typeSystem(); - XTerm r = ts.xtypeTranslator().trans((XConstraint) null, target, (X10Context) c); - if (r instanceof XVar) { - receiver = (XVar) r; - } - } - catch (SemanticException e) { - } - if (receiver == null) - receiver = x.genEQV(); - t = Subst.subst(t, (new XVar[] { receiver }), (new XRoot[] { fi.thisVar() }), new Type[] { }, new ParameterType[] { }); - } - } - return t; + XConstraint x = X10TypeMixin.xclause(t); + if (x != null && fi.thisVar() != null) { + if (target instanceof Expr) { + XVar receiver = null; + try { + X10TypeSystem ts = (X10TypeSystem) t.typeSystem(); + XTerm r = ts.xtypeTranslator().trans((XConstraint) null, target, (X10Context) c); + if (r instanceof XVar) { + receiver = (XVar) r; + } + } + catch (SemanticException e) { + } + if (receiver == null) + receiver = x.genEQV(); + t = Subst.subst(t, (new XVar[] { receiver }), (new XRoot[] { fi.thisVar() }), new Type[] { }, new ParameterType[] { }); + } + } + return t; } - + private static final boolean ENABLE_PLACE_TYPES = false; // TODO: vj -- check this code 08/12/09 protected void checkFieldPlaceType(X10Field_c result, ContextVisitor tc) throws SemanticException { - - if (result.fieldInstance().flags().isFinal()) - return; - if (result.fieldInstance().flags().isStatic()) - return; - - if (result.target() instanceof Special) - return; - X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); - X10Context xc = (X10Context) tc.context(); - X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); - - if (! ts.isSubtype(result.target().type(), ts.Ref(), xc)) - return; + if (result.fieldInstance().flags().isFinal()) + return; + if (result.fieldInstance().flags().isStatic()) + return; - try { - // Given e.f, check if e.loc==here is true. - XConstraint_c pc = new XConstraint_c(); - XTerm target = ts.xtypeTranslator().trans(pc, result.target(), xc); - if (target != null) { - XTerm eloc = ts.xtypeTranslator().trans(pc, target, - ((StructType) ts.Ref()).fieldNamed(Name.make("location"))); - Type t = result.target().type(); + if (result.target() instanceof Special) + return; - XTerm here = ts.xtypeTranslator().transHere(); - pc.addBinding(eloc, here); + X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); + X10Context xc = (X10Context) tc.context(); + X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); - XConstraint targetConstraint = X10TypeMixin.realX(result.target().type()); - if (targetConstraint.entails(pc, xc.constraintProjection(targetConstraint, pc))) { - // Gamma, true |- here==e.loc - return; - } - } - } - catch (XFailure e) { - // fall through - } - catch (SemanticException e) { - // fall through - } + if (! ts.isSubtype(result.target().type(), ts.Ref(), xc)) + return; - tc.job().compiler().errorQueue().enqueue(ErrorInfo.WARNING, "Place type error: field target " + result.target() + " may not be local.", result.position()); + try { + // Given e.f, check if e.loc==here is true. + XConstraint_c pc = new XConstraint_c(); + XTerm target = ts.xtypeTranslator().trans(pc, result.target(), xc); + if (target != null) { + XTerm eloc = ts.xtypeTranslator().trans(pc, target, + ((StructType) ts.Ref()).fieldNamed(Name.make("location"))); + Type t = result.target().type(); + + XTerm here = ts.xtypeTranslator().transHere(); + pc.addBinding(eloc, here); + + XConstraint targetConstraint = X10TypeMixin.realX(result.target().type()); + if (targetConstraint.entails(pc, xc.constraintProjection(targetConstraint, pc))) { + // Gamma, true |- here==e.loc + return; + } + } + } + catch (XFailure e) { + // fall through + } + catch (SemanticException e) { + // fall through + } + + tc.job().compiler().errorQueue().enqueue(ErrorInfo.WARNING, "Place type error: field target " + result.target() + " may not be local.", result.position()); } - + protected void checkFieldAccessesInDepClausesAreFinal(X10Field_c result, ContextVisitor tc) throws SemanticException { -// Check that field accesses in dep clauses refer to final fields. + // Check that field accesses in dep clauses refer to final fields. X10Context xtc = (X10Context) tc.context(); if (xtc.inDepType()) { FieldInstance fi = result.fieldInstance(); @@ -273,13 +295,13 @@ ((X10Special)target).kind()==X10Special.SELF) { // The fieldInstance must be a property. //Report.report(1, "X10Field_c checking " + fi + " is a property. "); - // The following is going to look for property propertyNames$ + // The following is going to look for property propertyNames$ // and may throw a MissingDependencyException asking for the field to be set. if (! (fi instanceof X10FieldInstance && ((X10FieldInstance) fi).isProperty())) throw new SemanticException("Field \"" + fi.name() + "\" is not a property of " + fi.container() + ". " + "Only properties may appear unqualified or prefixed with self in a dependent clause." - ); + ); } } } Modified: trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2009-08-23 22:10:22 UTC (rev 11074) +++ trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2009-08-24 06:28:15 UTC (rev 11075) @@ -314,6 +314,11 @@ if (xf.isExtern() && body != null) { throw new SemanticException("An extern method cannot have a body.", position()); } + + if (xf.isProto() && xf.isStatic()) { + throw new SemanticException("Only instance method may have a proto flag.", + position()); + } // Set the native flag if incomplete or extern so super.checkFlags doesn't complain. if (xf.isIncomplete() || xf.isExtern()) @@ -344,6 +349,7 @@ X10Flags xf = X10Flags.toX10Flags(mi.flags()); + // Check these flags here rather than in checkFlags since we need the body. if (xf.isIncomplete() && body != null) { throw new SemanticException("An incomplete method cannot have a body.", position()); @@ -395,10 +401,15 @@ n = (X10MethodDecl_c) n.superTypeCheck(tc); dupFormalCheck(typeParameters, formals); + + X10TypeMixin.protoTypeCheck(formals(), (X10Type) returnType().type(), position(), + true); return n; } + + public static void dupFormalCheck(List<TypeParamNode> typeParams, List<Formal> formals) throws SemanticException { Set<Name> pnames = new HashSet<Name>(); for (TypeParamNode p : typeParams) { Modified: trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2009-08-23 22:10:22 UTC (rev 11074) +++ trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2009-08-24 06:28:15 UTC (rev 11075) @@ -67,6 +67,8 @@ import polyglot.ast.Stmt; import polyglot.ast.StringLit; import polyglot.ast.TopLevelDecl; +import polyglot.ast.Try; +import polyglot.ast.Try_c; import polyglot.ast.TypeNode; import polyglot.ast.Unary; import polyglot.ast.While; @@ -115,6 +117,8 @@ return new X10Disamb_c(); } + + @Override public polyglot.ast.Initializer Initializer(Position pos, FlagsNode flags, Block body) { Initializer n = new X10Initializer_c(pos, flags, body); Modified: trunk/x10.compiler/src/x10/ast/X10Special_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Special_c.java 2009-08-23 22:10:22 UTC (rev 11074) +++ trunk/x10.compiler/src/x10/ast/X10Special_c.java 2009-08-24 06:28:15 UTC (rev 11075) @@ -25,6 +25,8 @@ import x10.constraint.XVar; import x10.types.X10ConstructorDef; import x10.types.X10Context; +import x10.types.X10Flags; +import x10.types.X10MethodDef; import x10.types.X10ProcedureDef; import x10.types.X10Type; import x10.types.X10TypeMixin; @@ -81,28 +83,44 @@ } // Use the constructor return type, not the base type. - if (c.currentDepType() == null && c.currentCode() instanceof X10ConstructorDef) { - X10ConstructorDef cd = (X10ConstructorDef) c.currentCode(); - Type returnType = cd.returnType().get(); - returnType = ts.expandMacros(returnType); - if (returnType.isClass()) { - t = returnType.toClass(); - } - else { - throw new SemanticException("Constructor return type is not a class type.", cd.position()); - } - } + if (c.currentDepType() == null) + if (c.currentCode() instanceof X10ConstructorDef) { + X10ConstructorDef cd = (X10ConstructorDef) c.currentCode(); + Type returnType = cd.returnType().get(); + returnType = ts.expandMacros(returnType); + // Set the type of this to be proto T, where T is the return + // type of the constructor. + if (returnType.isClass()) { + t = X10TypeMixin.makeProto((X10Type) returnType).toClass(); + } + else { + throw new SemanticException("Constructor return type is not a class type.", cd.position()); + } + } else + // Check if this is a proto method, then the type of this needs + // to be set to proto C + if (c.currentCode() instanceof X10MethodDef) { + X10MethodDef cd = (X10MethodDef) c.currentCode(); + if (cd.isProto()) { + t = X10TypeMixin.makeProto((X10Type) t).toClass(); + } + } } else { if (qualifier.type().isClass()) { t = qualifier.type().toClass(); - + CodeDef cd = c.currentCode(); + if (!c.currentClass().hasEnclosingInstance(t)) { throw new SemanticException("The nested class \"" + c.currentClass() + "\" does not have " + "an enclosing instance of type \"" + t + "\".", qualifier.position()); } + if (cd instanceof X10ConstructorDef + || (cd instanceof X10MethodDef && ((X10MethodDef) cd).isProto())) + t = X10TypeMixin.makeProto((X10Type) t).toClass(); + } else { throw new SemanticException("Invalid qualifier for \"this\" or \"super\".", qualifier.position()); Modified: trunk/x10.compiler/src/x10/parser/X10KWLexer.gi =================================================================== --- trunk/x10.compiler/src/x10/parser/X10KWLexer.gi 2009-08-23 22:10:22 UTC (rev 11074) +++ trunk/x10.compiler/src/x10/parser/X10KWLexer.gi 2009-08-24 06:28:15 UTC (rev 11075) @@ -120,6 +120,7 @@ private property protected + proto public return rooted @@ -491,6 +492,11 @@ $setResult($_protected); $EndAction ./ + | p r o t o + /.$BeginAction + $setResult($_proto); + $EndAction + ./ | p u b l i c /.$BeginAction Modified: trunk/x10.compiler/src/x10/parser/X10KWLexer.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10KWLexer.java 2009-08-23 22:10:22 UTC (rev 11074) +++ trunk/x10.compiler/src/x10/parser/X10KWLexer.java 2009-08-24 06:28:15 UTC (rev 11075) @@ -12,7 +12,7 @@ public class X10KWLexer extends X10KWLexerprs { private char[] inputChars; - private final int keywordKind[] = new int[78 + 1]; + private final int keywordKind[] = new int[79 + 1]; public int[] getKeywordKinds() { return keywordKind; } @@ -513,124 +513,131 @@ // - // Rule 62: KeyWord ::= p u b l i c + // Rule 62: KeyWord ::= p r o t o // - keywordKind[62] = (X10Parsersym.TK_public); + keywordKind[62] = (X10Parsersym.TK_proto); // - // Rule 63: KeyWord ::= r e t u r n + // Rule 63: KeyWord ::= p u b l i c // - keywordKind[63] = (X10Parsersym.TK_return); + keywordKind[63] = (X10Parsersym.TK_public); // - // Rule 64: KeyWord ::= r o o t e d + // Rule 64: KeyWord ::= r e t u r n // - keywordKind[64] = (X10Parsersym.TK_rooted); + keywordKind[64] = (X10Parsersym.TK_return); // - // Rule 65: KeyWord ::= s t a t i c + // Rule 65: KeyWord ::= r o o t e d // - keywordKind[65] = (X10Parsersym.TK_static); + keywordKind[65] = (X10Parsersym.TK_rooted); // - // Rule 66: KeyWord ::= s t r i c t f p + // Rule 66: KeyWord ::= s t a t i c // - keywordKind[66] = (X10Parsersym.TK_strictfp); + keywordKind[66] = (X10Parsersym.TK_static); // - // Rule 67: KeyWord ::= s t r u c t + // Rule 67: KeyWord ::= s t r i c t f p // - keywordKind[67] = (X10Parsersym.TK_struct); + keywordKind[67] = (X10Parsersym.TK_strictfp); // - // Rule 68: KeyWord ::= s u p e r + // Rule 68: KeyWord ::= s t r u c t // - keywordKind[68] = (X10Parsersym.TK_super); + keywordKind[68] = (X10Parsersym.TK_struct); // - // Rule 69: KeyWord ::= s w i t c h + // Rule 69: KeyWord ::= s u p e r // - keywordKind[69] = (X10Parsersym.TK_switch); + keywordKind[69] = (X10Parsersym.TK_super); // - // Rule 70: KeyWord ::= s y n c h r o n i z e d + // Rule 70: KeyWord ::= s w i t c h // - keywordKind[70] = (X10Parsersym.TK_synchronized); + keywordKind[70] = (X10Parsersym.TK_switch); // - // Rule 71: KeyWord ::= t h i s + // Rule 71: KeyWord ::= s y n c h r o n i z e d // - keywordKind[71] = (X10Parsersym.TK_this); + keywordKind[71] = (X10Parsersym.TK_synchronized); // - // Rule 72: KeyWord ::= t h r o w + // Rule 72: KeyWord ::= t h i s // - keywordKind[72] = (X10Parsersym.TK_throw); + keywordKind[72] = (X10Parsersym.TK_this); // - // Rule 73: KeyWord ::= t h r o w s + // Rule 73: KeyWord ::= t h r o w // - keywordKind[73] = (X10Parsersym.TK_throws); + keywordKind[73] = (X10Parsersym.TK_throw); // - // Rule 74: KeyWord ::= t r a n s i e n t + // Rule 74: KeyWord ::= t h r o w s // - keywordKind[74] = (X10Parsersym.TK_transient); + keywordKind[74] = (X10Parsersym.TK_throws); // - // Rule 75: KeyWord ::= t r u e + // Rule 75: KeyWord ::= t r a n s i e n t // - keywordKind[75] = (X10Parsersym.TK_true); + keywordKind[75] = (X10Parsersym.TK_transient); // - // Rule 76: KeyWord ::= t r y + // Rule 76: KeyWord ::= t r u e // - keywordKind[76] = (X10Parsersym.TK_try); + keywordKind[76] = (X10Parsersym.TK_true); // - // Rule 77: KeyWord ::= v o l a t i l e + // Rule 77: KeyWord ::= t r y // - keywordKind[77] = (X10Parsersym.TK_volatile); + keywordKind[77] = (X10Parsersym.TK_try); // - // Rule 78: KeyWord ::= w h i l e + // Rule 78: KeyWord ::= v o l a t i l e // - keywordKind[78] = (X10Parsersym.TK_while); + keywordKind[78] = (X10Parsersym.TK_volatile); + // + // Rule 79: KeyWord ::= w h i l e + // + + keywordKind[79] = (X10Parsersym.TK_while); + + for (int i = 0; i < keywordKind.length; i++) { if (keywordKind[i] == 0) @@ -639,4 +646,3 @@ } } - Modified: trunk/x10.compiler/src/x10/parser/X10KWLexerprs.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10KWLexerprs.java 2009-08-23 22:10:22 UTC (rev 11074) +++ trunk/x10.compiler/src/x10/parser/X10KWLexerprs.java 2009-08-24 06:28:15 UTC (rev 11075) @@ -25,13 +25,13 @@ public final static int NT_OFFSET = 27; public final int getNtOffset() { return NT_OFFSET; } - public final static int LA_STATE_OFFSET = 425; + public final static int LA_STATE_OFFSET = 427; public final int getLaStateOffset() { return LA_STATE_OFFSET; } public final static int MAX_LA = 1; public final int getMaxLa() { return MAX_LA; } - public final static int NUM_RULES = 78; + public final static int NUM_RULES = 79; public final int getNumRules() { return NUM_RULES; } public final static int NUM_NONTERMINALS = 2; @@ -43,7 +43,7 @@ public final static int SEGMENT_SIZE = 8192; public final int getSegmentSize() { return SEGMENT_SIZE; } - public final static int START_STATE = 79; + public final static int START_STATE = 80; public final int getStartState() { return START_STATE; } public final static int IDENTIFIER_SYMBOL = 0; @@ -55,10 +55,10 @@ public final static int EOLT_SYMBOL = 28; public final int getEoltSymbol() { return EOLT_SYMBOL; } - public final static int ACCEPT_ACTION = 346; + public final static int ACCEPT_ACTION = 347; public final int getAcceptAction() { return ACCEPT_ACTION; } - public final static int ERROR_ACTION = 347; + public final static int ERROR_ACTION = 348; public final int getErrorAction() { return ERROR_ACTION; } public final static boolean BACKTRACK = false; @@ -104,8 +104,8 @@ 5,4,8,6,5,4,5,5,5,8, 7,2,4,7,5,5,7,3,4,2, 10,6,10,9,6,3,4,8,7,7, - 9,6,6,6,6,8,6,5,6,12, - 4,5,6,9,4,3,8,5 + 9,5,6,6,6,6,8,6,5,6, + 12,4,5,6,9,4,3,8,5 }; }; public final static byte baseCheck[] = BaseCheck.baseCheck; @@ -123,33 +123,33 @@ 1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1, - 81,143,74,144,94,147,152,33,28,151, - 42,79,49,24,30,81,85,89,61,59, - 44,155,154,162,57,92,153,165,167,168, - 96,87,171,172,173,177,178,180,182,183, - 97,105,185,187,188,113,114,192,194,189, - 68,195,198,200,115,201,204,206,100,66, - 120,209,210,212,125,118,216,213,219,226, - 221,227,230,232,231,234,237,239,242,240, - 246,247,127,251,253,132,244,258,256,260, - 262,261,268,137,270,264,271,273,276,133, - 277,279,282,285,287,283,289,291,293,295, - 18,296,299,300,301,302,308,304,305,315, - 319,314,323,326,309,331,316,333,321,327, - 335,337,340,345,339,341,141,347,350,349, - 353,354,355,357,360,365,366,359,374,376, - 378,379,381,369,383,384,387,389,390,391, - 392,396,401,398,393,406,405,404,411,414, - 412,415,419,420,422,425,423,431,428,434, - 435,436,437,438,439,444,442,450,453,456, - 449,443,460,459,463,464,466,465,468,473, - 467,469,477,481,483,484,486,490,487,491, - 496,498,497,500,501,504,505,506,508,514, - 518,507,522,523,524,526,532,534,536,537, - 540,542,525,543,544,546,549,548,550,551, - 552,559,564,566,555,561,568,571,573,574, - 576,583,575,585,579,586,589,590,591,592, - 593,595,599,600,603,347,347 + 1,82,138,81,141,154,143,159,84,28, + 156,42,85,52,24,30,90,94,95,61, + 63,44,160,166,169,162,101,48,172,170, + 174,71,89,175,178,180,179,184,186,187, + 190,104,113,191,188,193,117,49,21,200, + 194,68,201,202,204,115,206,195,209,123, + 66,125,210,216,214,126,130,218,221,222, + 225,223,229,231,235,233,236,238,241,244, + 242,246,248,133,250,253,135,255,258,260, + 262,263,264,271,139,265,273,274,275,277, + 144,278,280,283,285,289,290,291,293,295, + 296,18,297,299,303,302,304,309,306,310, + 313,319,317,321,323,324,328,326,331,332, + 333,335,336,341,344,346,338,103,349,350, + 351,355,356,357,360,364,361,370,362,372, + 377,379,380,382,384,374,388,391,385,389, + 397,399,152,403,395,393,406,411,407,408, + 415,412,109,417,420,422,426,423,429,431, + 432,433,434,435,436,440,438,446,448,451, + 454,447,452,457,456,461,462,463,464,465, + 469,466,478,479,482,481,483,468,488,484, + 489,492,495,498,499,502,500,503,504,506, + 505,513,517,515,522,523,524,527,531,533, + 534,537,539,540,541,542,546,547,548,550, + 549,551,562,564,566,508,568,569,570,572, + 553,573,577,580,582,559,586,583,587,589, + 590,592,593,595,597,599,348,348 }; }; public final static char baseAction[] = BaseAction.baseAction; @@ -162,66 +162,66 @@ 0,1,2,3,4,5,6,7,8,9, 10,11,12,13,14,15,16,0,18,2, 0,21,22,0,1,2,3,0,1,0, - 3,14,0,6,11,12,4,8,11,16, - 17,0,13,0,3,2,14,6,0,20, - 9,3,11,10,6,7,0,1,0,16, - 0,18,4,3,4,0,0,0,3,2, - 12,11,5,0,1,17,11,10,0,6, - 0,1,17,3,0,7,0,3,0,1, - 6,0,1,0,6,0,0,4,2,0, - 9,23,16,8,0,6,10,3,9,23, - 6,16,0,0,0,3,4,0,4,0, - 7,7,0,4,0,1,0,10,9,3, - 6,0,0,2,17,9,0,24,6,7, - 0,10,0,0,4,9,0,11,8,6, - 0,0,0,0,0,2,6,0,12,8, - 6,0,10,2,0,1,0,0,26,2, - 0,0,0,7,2,5,0,0,7,0, - 4,0,0,2,0,8,0,0,0,10, - 8,0,8,0,0,9,3,0,4,0, - 0,14,14,0,13,0,7,10,0,0, - 5,0,0,13,3,0,0,2,0,10, - 0,18,14,11,6,0,0,7,3,0, - 0,0,3,0,8,4,0,7,0,0, - 2,0,9,0,3,0,0,1,5,10, - 0,1,0,1,18,0,11,0,1,0, - 0,0,2,0,5,10,5,0,1,0, - 0,2,0,1,11,0,0,1,0,4, - 2,0,0,13,0,1,0,6,0,3, - 0,3,0,11,0,0,1,7,0,0, - 0,0,1,0,0,6,8,0,0,2, - 10,19,9,0,0,0,22,3,0,1, - 0,8,0,1,20,0,0,19,13,4, - 0,1,0,7,0,3,0,1,0,0, - 0,7,22,4,0,7,0,3,0,0, - 10,2,0,0,0,9,0,0,0,0, - 12,5,10,4,0,0,12,9,0,5, - 5,3,19,0,1,0,1,0,0,1, - 0,4,0,0,4,2,0,1,0,0, - 0,0,0,3,3,0,1,0,9,11, - 0,1,20,0,0,0,2,10,16,4, - 0,0,9,0,0,5,5,4,0,0, - 1,0,0,2,0,1,8,0,6,15, - 0,1,5,0,0,0,0,0,0,1, - 7,0,0,0,8,8,12,4,0,0, - 15,2,0,12,2,0,8,15,0,0, - 5,2,0,0,0,0,0,0,0,0, - 2,8,0,9,7,13,0,5,20,14, - 0,5,0,0,4,0,0,21,3,0, - 0,9,2,10,5,0,0,0,12,0, - 0,6,5,0,0,0,0,0,12,3, - 10,6,0,0,11,2,17,0,1,15, - 13,0,0,0,0,0,5,2,4,7, - 7,0,1,0,1,0,0,2,2,0, - 1,0,0,0,1,0,5,0,0,0, - 0,0,1,8,0,5,9,8,0,1, - 0,19,14,0,1,0,1,0,8,2, - 0,17,0,0,0,0,3,2,0,9, - 6,9,0,1,0,0,2,2,0,0, - 0,0,0,15,0,1,8,7,0,0, - 1,10,0,0,0,13,0,0,0,0, - 0,0,0,0,25,0,0,15,0,21, - 0,0,0,0,0,0,0,0,0,0 + 3,14,5,13,11,12,0,8,11,16, + 17,0,13,0,3,2,5,0,0,20, + 9,0,11,10,3,7,5,10,7,16, + 0,18,0,3,4,0,4,0,3,2, + 0,11,24,6,12,0,11,10,8,17, + 0,1,17,0,0,5,16,4,0,0, + 1,7,3,0,0,1,3,14,5,5, + 0,1,0,0,16,2,4,23,0,9, + 8,23,0,10,0,3,0,5,4,3, + 4,7,0,15,0,0,1,5,4,0, + 5,9,0,9,0,3,2,0,0,10, + 0,9,0,0,10,5,17,9,5,11, + 7,0,1,0,12,0,5,4,0,0, + 5,0,1,26,5,0,8,2,0,0, + 2,0,1,0,0,2,7,0,0,0, + 6,2,4,0,7,0,0,0,2,0, + 0,8,0,0,0,10,9,8,8,0, + 0,0,3,0,4,0,14,14,0,0, + 7,10,18,0,6,0,3,0,13,2, + 0,0,0,14,0,10,5,3,0,7, + 0,11,0,3,0,0,8,0,4,7, + 0,0,2,0,9,0,3,0,1,0, + 1,10,0,1,0,18,11,0,1,0, + 6,0,0,0,0,2,2,6,6,10, + 0,1,0,0,0,1,0,0,1,0, + 4,2,0,11,0,1,13,5,0,0, + 0,3,0,3,0,0,0,1,0,7, + 11,0,0,0,1,0,8,5,0,0, + 2,10,0,19,9,3,0,22,0,1, + 0,1,0,0,8,0,4,0,1,20, + 0,0,0,3,0,0,1,0,13,7, + 0,7,19,0,4,0,3,10,0,0, + 0,2,7,22,0,0,0,9,0,0, + 0,0,12,0,10,6,6,4,12,0, + 9,0,1,0,19,6,0,1,0,0, + 1,0,4,0,0,4,3,0,0,2, + 0,1,0,20,0,11,0,9,0,3, + 0,3,0,1,10,0,0,0,16,4, + 0,0,2,6,0,9,0,6,4,0, + 1,0,0,2,8,0,1,5,0,1, + 0,0,0,0,0,0,6,0,7,0, + 1,4,8,8,12,0,0,0,15,2, + 0,0,2,0,8,0,0,12,2,6, + 0,0,0,0,0,0,15,0,0,8, + 3,7,9,13,6,20,14,0,0,2, + 0,0,0,0,6,4,21,0,0,9, + 2,0,10,6,0,12,5,0,0,0, + 6,0,0,0,0,0,2,0,5,12, + 11,10,0,1,0,17,0,15,13,3, + 6,0,0,0,17,2,0,1,7,7, + 0,1,0,0,2,2,0,1,0,0, + 0,0,1,4,6,0,0,0,0,0, + 0,1,0,8,6,3,9,8,0,19, + 14,0,1,0,1,0,1,0,0,0, + 2,0,0,15,2,8,0,1,9,0, + 9,0,0,2,5,0,0,2,0,0, + 8,0,0,1,0,7,0,1,0,10, + 0,0,0,0,13,0,0,0,0,0, + 0,25,0,15,0,21,0,0,0,0, + 0,0,0,0,0,0 }; }; public final static byte termCheck[] = TermCheck.termCheck; @@ -229,68 +229,68 @@ public interface TermAction { public final static char termAction[] = {0, - 347,91,99,100,82,92,87,89,88,94, - 93,86,95,90,98,97,85,347,84,241, - 347,83,96,347,126,125,127,347,111,347, - 109,242,347,110,124,128,373,130,108,123, - 122,347,397,347,113,144,107,115,347,129, - 116,120,114,145,119,121,347,149,347,143, - 347,142,139,137,138,347,347,10,192,180, - 140,136,182,347,102,141,191,181,347,101, - 347,131,423,132,347,117,347,134,347,135, - 133,347,151,347,389,347,347,104,166,347, - 150,118,403,156,347,190,167,168,189,157, - 169,372,347,347,347,174,173,8,354,347, - 176,185,347,193,3,199,347,200,194,214, - 198,347,347,217,201,215,347,175,230,231, - 347,218,347,347,262,226,347,225,261,103, - 347,347,347,347,347,147,112,347,105,106, - 146,347,152,148,347,153,347,347,346,155, - 347,347,347,154,160,158,347,347,159,347, - 161,347,347,164,347,162,347,347,347,163, - 165,347,170,347,347,171,178,347,183,347, - 347,172,179,347,177,347,184,356,347,347, - 188,347,347,186,197,347,347,202,347,196, - 347,187,195,203,396,347,347,205,204,347, - 347,347,206,347,379,207,347,404,347,347, - 370,347,208,347,210,347,48,213,219,211, - 347,390,347,216,209,347,212,347,383,347, - 347,347,223,347,221,220,222,347,224,347, - 347,227,347,374,228,347,347,232,347,229, - 233,347,6,375,347,368,347,234,5,235, - 347,237,347,236,347,347,422,238,347,347, - 347,347,349,347,347,244,243,347,347,245, - 418,239,246,347,347,347,240,248,347,249, - 347,250,347,251,247,347,347,382,253,252, - 347,425,347,256,347,254,347,392,347,347, - 347,369,255,257,347,259,347,258,347,347, - 260,386,347,347,347,263,347,347,347,347, - 384,266,385,415,347,347,265,269,347,267, - 268,275,264,347,270,347,271,347,347,273, - 347,272,347,347,274,277,347,378,347,347, - 347,347,347,280,281,347,282,347,279,278, - 347,283,276,347,347,347,362,284,285,286, - 347,347,287,347,347,288,348,289,347,347, - 377,347,347,290,347,402,410,347,291,411, - 347,367,292,46,347,347,347,347,347,296, - 293,347,347,347,364,295,365,297,347,347, - 294,414,347,416,298,347,299,359,347,347, - 412,399,347,347,347,347,347,347,347,347, - 307,302,347,304,305,301,347,409,300,303, - 347,308,347,72,309,347,347,306,311,347, - 347,310,381,420,361,347,347,347,360,347, - 347,312,313,347,347,347,347,347,366,319, - 391,315,347,347,314,317,394,347,318,363, - 316,347,347,347,347,347,320,388,405,321, - 322,347,406,347,407,347,347,323,324,347, - 325,347,347,347,387,347,326,347,347,347, - 347,347,332,328,347,331,329,330,347,333, - 347,327,413,347,424,347,334,347,335,380, - 347,351,347,347,347,347,338,339,347,336, - 340,337,347,401,347,347,341,421,347,347, - 347,347,347,408,347,358,342,376,347,347, - 344,398,347,347,347,400,347,347,347,347, - 347,347,347,347,343,347,347,417,347,371 + 348,92,100,101,83,88,93,90,89,95, + 94,87,96,91,99,98,86,348,85,242, + 348,84,97,348,127,126,128,348,112,348, + 110,243,111,178,125,129,348,131,109,124, + 123,348,398,348,114,145,116,348,348,130, + 117,348,115,146,121,177,120,153,122,144, + 348,143,348,138,139,348,140,10,193,181, + 348,137,176,183,141,348,192,182,157,142, + 348,103,425,348,348,102,373,374,348,348, + 132,118,133,348,348,136,135,108,134,390, + 348,152,348,348,404,167,263,119,348,151, + 262,158,348,168,348,169,348,170,355,175, + 174,186,348,413,348,3,200,191,194,8, + 199,190,348,195,348,215,218,348,348,201, + 348,216,348,348,219,104,202,227,231,226, + 232,348,283,348,106,348,410,105,348,348, + 113,348,150,347,147,348,107,148,348,348, + 149,348,154,348,348,156,155,348,348,348, + 159,161,162,348,160,348,348,348,165,348, + 348,163,348,348,348,164,172,166,171,348, + 348,348,179,348,184,348,173,180,348,348, + 185,357,188,348,189,348,198,348,187,203, + 348,348,348,196,348,197,397,205,348,206, + 348,204,348,207,348,348,380,348,208,405, + 348,348,371,348,209,348,211,48,214,348, + 391,212,348,217,348,210,213,348,384,348, + 220,348,348,348,348,224,228,222,223,221, + 348,225,348,348,348,375,348,348,233,348, + 230,234,348,229,348,369,376,235,348,6, + 5,236,348,238,348,348,348,424,348,239, + 237,348,348,348,350,348,244,245,348,348, + 246,420,348,240,247,249,348,241,348,250, + 348,252,348,348,251,348,253,348,427,248, + 348,348,348,255,348,348,393,348,254,257, + 348,370,383,348,258,348,259,261,348,348, + 348,387,260,256,348,348,348,264,348,348, + 348,348,385,348,386,267,268,417,266,348, + 270,348,271,348,265,269,348,272,348,348, + 274,348,273,348,348,275,276,348,348,278, + 348,379,348,277,348,279,348,280,348,281, + 348,282,348,284,285,348,348,348,286,287, + 348,348,363,289,348,288,348,349,290,348, + 378,348,348,291,412,348,403,292,348,368, + 348,46,348,348,348,348,293,348,294,348, + 297,298,365,296,366,348,348,348,295,416, + 348,348,299,348,300,348,348,418,400,414, + 348,348,348,348,348,348,360,348,348,303, + 312,306,305,302,411,301,304,348,348,308, + 348,348,73,348,309,310,307,348,348,311, + 382,348,422,362,348,361,313,348,348,348, + 314,348,348,348,348,348,318,348,316,367, + 315,392,348,319,348,395,348,364,317,320, + 321,348,348,348,352,389,348,407,322,323, + 348,408,348,348,324,325,348,326,348,348, + 348,348,388,406,327,348,348,348,348,348, + 348,333,348,329,332,339,330,331,348,328, + 415,348,334,348,426,348,335,348,348,348, + 381,348,348,409,340,336,348,402,337,348, + 338,348,348,342,341,348,348,423,348,348, + 343,348,348,359,348,377,348,345,348,399, + 348,348,348,348,401,348,348,348,348,348, + 348,344,348,419,348,372 }; }; public final static char termAction[] = TermAction.termAction; Modified: trunk/x10.compiler/src/x10/parser/X10KWLexersym.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10KWLexersym.java 2009-08-23 22:10:22 UTC (rev 11074) +++ trunk/x10.compiler/src/x10/parser/X10KWLexersym.java 2009-08-24 06:28:15 UTC (rev 11075) @@ -10,7 +10,7 @@ public final static int Char_a = 3, Char_b = 18, - Char_c = 5, + Char_c = 6, Char_d = 15, Char_e = 1, Char_f = 13, @@ -22,7 +22,7 @@ Char_l = 7, Char_m = 20, Char_n = 8, - Char_o = 6, + Char_o = 5, Char_p = 14, Char_q = 24, Char_r = 4, @@ -42,8 +42,8 @@ "t", "a", "r", + "o", "c", - "o", "l", "n", "i", Modified: trunk/x10.compiler/src/x10/parser/X10Parser.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10Parser.java 2009-08-23 22:10:22 UTC (rev 11074) +++ trunk/x10.compiler/src/x10/parser/X10Parser.java 2009-08-24 06:28:15 UTC (rev 11075) @@ -1,5 +1,5 @@ -//#line 18 "C:/eclipsews/v7/x10.compiler/src/x10/parser/x10.g" +//#line 18 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" // // Licensed Material // (C) Copyright IBM Corp, 2006 @@ -9,7 +9,7 @@ import lpg.runtime.*; -//#line 28 "C:/eclipsews/v7/x10.compiler/src/x10/parser/x10.g" +//#line 28 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" import java.util.Arrays; import java.util.ArrayList; import java.util.Collections; @@ -19,6 +19,8 @@ import java.util.Arrays; import java.io.File; +import x10.ast.X10Binary_c; +import x10.ast.X10Unary_c; import polyglot.types.QName; import polyglot.types.Name; import polyglot.ast.AmbExpr; @@ -61,6 +63,32 @@ import polyglot.ast.Unary; import polyglot.ast.FlagsNode; import polyglot.parse.ParsedName; +import x10.ast.AddFlags; +import x10.ast.AnnotationNode; +import x10.ast.Closure; +import x10.ast.ClosureCall; +import x10.ast.Here; +import x10.ast.DepParameterExpr; +import x10.ast.Tuple; +import x10.ast.When; +import x10.ast.X10Formal; +import x10.ast.X10Formal_c; +import x10.ast.X10Loop; +import x10.ast.X10Call; +import x10.ast.Consta... [truncated message content] |
From: <vj...@us...> - 2009-08-25 02:11:40
|
Revision: 11083 http://x10.svn.sourceforge.net/x10/?rev=11083&view=rev Author: vj0 Date: 2009-08-25 02:11:30 +0000 (Tue, 25 Aug 2009) Log Message: ----------- More support for structs. (1) Type-checker checks that a struct extends a struct (2) a method in a struct is final. (3) struct cant have rooted fields (4) struct cant have var field Todo: (a) support new v to covert a struct value to an object value. (b) implict cnversion from struct C to struct D (if C <: D) by slicing (c) support creation of a value by invoking constructor of struct as a static method. (d) implement support for behaves like ( <|) relation in generic type constraints. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java trunk/x10.compiler/src/x10/ast/X10New_c.java trunk/x10.compiler/src/x10/types/X10ClassDef.java trunk/x10.compiler/src/x10/types/X10ClassDef_c.java trunk/x10.compiler/src/x10/types/X10ParsedClassType_c.java trunk/x10.compiler/src/x10/types/X10TypeEnv.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 Added Paths: ----------- trunk/x10.runtime/src-x10/x10/lang/Primitive.x10 trunk/x10.tests/tests/Constructs/Struct/ trunk/x10.tests/tests/Constructs/Struct/StructCannotHaveNonFinalMethods_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Struct/StructCannotHaveRootedField_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Struct/StructCannotHaveVarField_MustFailCompile.x10 trunk/x10.tests/tests/Constructs/Struct/StructCannotSubclassClass_MustFailCompile.x10 Modified: trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2009-08-25 01:19:12 UTC (rev 11082) +++ trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2009-08-25 02:11:30 UTC (rev 11083) @@ -41,6 +41,7 @@ import polyglot.frontend.Job; import polyglot.frontend.Scheduler; import polyglot.frontend.Source; +import polyglot.main.Report; import polyglot.types.ClassDef; import polyglot.types.ClassType; import polyglot.types.ConstructorDef; @@ -202,35 +203,46 @@ final LazyRef<Type> superRef = Types.lazyRef(null); if (thisType.fullName().equals(QName.make("x10.lang.Ref"))) { - thisType.superType(null); + thisType.superType(null); } else if (thisType.fullName().equals(QName.make("x10.lang.Value"))) { - thisType.superType(null); + thisType.superType(null); + } + else if (thisType.fullName().equals(QName.make("x10.lang.Primitive"))) { + thisType.superType(null); } else if (thisType.fullName().equals(QName.make("x10.lang.Object"))) { - thisType.superType(null); + thisType.superType(null); } else if (flags().flags().isInterface()) { - thisType.superType(null); + thisType.superType(null); } else if (superClass == null && X10Flags.toX10Flags(flags().flags()).isValue()) { - superRef.setResolver(new Runnable() { - public void run() { - superRef.update(xts.Value()); - } - }); - thisType.superType(superRef); + superRef.setResolver(new Runnable() { + public void run() { + superRef.update(xts.Value()); + } + }); + thisType.superType(superRef); + } + else if (superClass == null && X10Flags.toX10Flags(flags().flags()).isStruct()) { + superRef.setResolver(new Runnable() { + public void run() { + superRef.update(xts.Primitive()); + } + }); + thisType.superType(superRef); } else if (superClass == null) { - superRef.setResolver(new Runnable() { - public void run() { - superRef.update(xts.Ref()); - } - }); - thisType.superType(superRef); + superRef.setResolver(new Runnable() { + public void run() { + superRef.update(xts.Ref()); + } + }); + thisType.superType(superRef); } else { - super.setSuperClass(ts, thisType); + super.setSuperClass(ts, thisType); } } @@ -637,9 +649,18 @@ // Make sure the node and type are consistent WRT super types. NodeFactory nf = tc.nodeFactory(); - if (n.superClass == null && type.superType() != null) + if (type.superType() != null) { + if (((X10ClassDef) type).isStruct()) { + if (! ((X10Type) type.superType().get()).isX10Struct()) { + throw new SemanticException(type.superType() + + " cannot be the superclass for " + type + + "; a struct must subclass a struct.",position()); + } + } + } + if (n.superClass == null && type.superType() != null) { n = (X10ClassDecl_c) n.superClass(nf.CanonicalTypeNode(position(), type.superType())); - + } List<TypeNode> newInterfaces = new ArrayList<TypeNode>(); for (Ref<? extends Type> t : type.interfaces()) { @@ -689,10 +710,20 @@ } n = (X10ClassDecl_c) n.adjustAbstractMethods(oldtc); + + if (X10Flags.toX10Flags(flags().flags()).isStruct()) { + n.checkStructMethods(parent, tc); + + } return n; } + + protected void checkStructMethods(Node parent, ContextVisitor tc) throws SemanticException { + + } + @Override protected void checkSupertypeCycles(TypeSystem ts) throws SemanticException { Ref<? extends Type> stref = type.superType(); Modified: trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java 2009-08-25 01:19:12 UTC (rev 11082) +++ trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java 2009-08-25 02:11:30 UTC (rev 11083) @@ -50,6 +50,7 @@ import x10.types.X10ClassType; import x10.types.X10Context; import x10.types.X10FieldDef; +import x10.types.X10Flags; import x10.types.X10InitializerDef; import x10.types.X10Type; import x10.types.X10TypeSystem; @@ -93,6 +94,19 @@ throw new SemanticException("Cannot declare a non-final field in a value class.", position()); } + if (ref instanceof X10Type) { + X10Type container = (X10Type) ref; + if (container.isX10Struct()) { + X10Flags x10flags = X10Flags.toX10Flags(fi.flags()); + if (x10flags.isRooted()) + throw new SemanticException("Illegal " + fi + + "; structs cannot have rooted fields.", position()); + + if (! x10flags.isFinal()) + throw new SemanticException("Illegal " + fi + + "; structs cannot have var fields.", position()); + } + } checkVariance(tc); X10MethodDecl_c.checkVisibility(tc.typeSystem(), context, this); Modified: trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2009-08-25 01:19:12 UTC (rev 11082) +++ trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2009-08-25 02:11:30 UTC (rev 11083) @@ -405,6 +405,19 @@ X10TypeMixin.protoTypeCheck(formals(), (X10Type) returnType().type(), position(), true); + X10MethodDef md = (X10MethodDef) methodDef(); + StructType container = md.container().get(); + if (container instanceof X10Type) { + X10Type xtype = (X10Type) container; + if (xtype.isX10Struct()) { + if (! md.flags().isFinal()) { + throw new SemanticException( md + + " must be final; structs may only have final methods." + , position()); + } + } + + } return n; } Modified: trunk/x10.compiler/src/x10/ast/X10New_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10New_c.java 2009-08-25 01:19:12 UTC (rev 11082) +++ trunk/x10.compiler/src/x10/ast/X10New_c.java 2009-08-25 02:11:30 UTC (rev 11083) @@ -506,7 +506,7 @@ } // Copy the method instance so we can modify it. - tp = ((X10Type) tp).setFlags(X10Flags.ROOTED); + // tp = ((X10Type) tp).setFlags(X10Flags.ROOTED); ci = (X10ConstructorInstance) ci.returnType(tp); X10New_c result = (X10New_c) this.constructorInstance(ci); result = (X10New_c) result.arguments(args); Modified: trunk/x10.compiler/src/x10/types/X10ClassDef.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10ClassDef.java 2009-08-25 01:19:12 UTC (rev 11082) +++ trunk/x10.compiler/src/x10/types/X10ClassDef.java 2009-08-25 02:11:30 UTC (rev 11083) @@ -42,4 +42,10 @@ /** Add a member type to the class. */ void addMemberType(TypeDef t); + + /** + * Is this the class def for an X10 struct? + * @return + */ + boolean isStruct(); } Modified: trunk/x10.compiler/src/x10/types/X10ClassDef_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10ClassDef_c.java 2009-08-25 01:19:12 UTC (rev 11082) +++ trunk/x10.compiler/src/x10/types/X10ClassDef_c.java 2009-08-25 02:11:30 UTC (rev 11083) @@ -325,4 +325,7 @@ public Ref<TypeConstraint> typeGuard() { return new LazyRef_c<TypeConstraint>(X10TypeMixin.parameterBounds(asType())); } + public boolean isStruct() { + return X10Flags.toX10Flags(flags()).isStruct(); + } } Modified: trunk/x10.compiler/src/x10/types/X10ParsedClassType_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10ParsedClassType_c.java 2009-08-25 01:19:12 UTC (rev 11082) +++ trunk/x10.compiler/src/x10/types/X10ParsedClassType_c.java 2009-08-25 02:11:30 UTC (rev 11083) @@ -389,16 +389,13 @@ } public boolean isRooted() { - return flags == null ? false - : X10Flags.toX10Flags(flags).isRooted(); + return X10Flags.toX10Flags(flags()).isRooted(); } public boolean isProto() { - return flags == null ? false - : X10Flags.toX10Flags(flags).isProto(); + return X10Flags.toX10Flags(flags()).isProto(); } public boolean isX10Struct() { - return flags == null ? false - : X10Flags.toX10Flags(flags).isStruct(); + return X10Flags.toX10Flags(flags()).isStruct(); } public boolean equalsNoFlag(X10Type o) { Modified: trunk/x10.compiler/src/x10/types/X10TypeEnv.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeEnv.java 2009-08-25 01:19:12 UTC (rev 11082) +++ trunk/x10.compiler/src/x10/types/X10TypeEnv.java 2009-08-25 02:11:30 UTC (rev 11083) @@ -37,6 +37,16 @@ boolean isSubtypeWithValueInterfaces(Type t1, Type t2); boolean isSubtype(Type t1, Type t2, boolean allowValueInterfaces); + + /** + * t1 behaves like t2 if t1 is a reftype and t1 is a subtype of t2. + * t1 behaves like t2 if t1 is a struct type and t1 is a substruct of t2. + * + * @param t1 + * @param t2 + * @return + */ + boolean behavesLike(Type t1, Type t2); boolean entails(XConstraint c1, XConstraint c2); Modified: trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java 2009-08-25 01:19:12 UTC (rev 11082) +++ trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java 2009-08-25 02:11:30 UTC (rev 11083) @@ -631,6 +631,17 @@ return isSubtype(t1, t2, false); } + public boolean behavesLike(Type t1, Type t2) { + X10Type xt1 = (X10Type) t1; + X10Type xt2 = (X10Type) t2; + if (xt1.isX10Struct() || xt1.isX10Struct()) { + if (xt1.isX10Struct() != xt2.isX10Struct()) + return false; + return isSubtype(X10TypeMixin.makeRef(xt1), X10TypeMixin.makeRef(xt2), true); + } + // both are class types + return isSubtype(t1, t2, true); + } /* (non-Javadoc) * @see x10.types.X10TypeEnv#isSubtypeWithValueInterfaces(polyglot.types.Type, polyglot.types.Type) */ @@ -655,17 +666,37 @@ X10Type xt1 = (X10Type) t1; X10Type xt2 = (X10Type) t2; - if (xt2.isRooted() && ! xt1.isRooted()) - return false; - if ((xt1.isProto() && ! xt2.isProto()) || (xt2.isProto() && ! xt1.isProto())) - return false; + if (xt2.isRooted() && ! xt1.isRooted()) { + if (xt1.isRooted() != xt2.isRooted()) + return false; + // they are both rooted + t1 = xt1.clearFlags(X10Flags.ROOTED); + t2 = xt2.clearFlags(X10Flags.ROOTED); + } + + if (xt1.isProto() || xt2.isProto()) { + if (xt1.isProto() != xt2.isProto()) + return false; + // they are both proto + t1 = xt1.clearFlags(X10Flags.PROTO); + t2 = xt2.clearFlags(X10Flags.PROTO); + xt1 = X10TypeMixin.baseForProto(xt1); + xt2 = X10TypeMixin.baseForProto(xt2); + } - xt1 = X10TypeMixin.baseForProto(xt1); - xt2 = X10TypeMixin.baseForProto(xt2); - t1 = xt1.clearFlags(((X10Flags) X10Flags.ROOTED).Proto()); - t2 = xt2.clearFlags(((X10Flags) X10Flags.ROOTED).Proto()); - + if (xt1.isX10Struct() || xt2.isX10Struct()) { + if (xt1.isX10Struct() != xt2.isX10Struct()) + return false; + if (! ts.typeEquals(X10TypeMixin.baseType(xt1), X10TypeMixin.baseType(xt2), + xcontext)) + return false; + xt1 = X10TypeMixin.makeRef(xt1); + xt2 = X10TypeMixin.makeRef(xt2); + // now keep going, the clause entailment will be checked by the + // logic below. + } + if (t1 == t2) return true; Modified: trunk/x10.compiler/src/x10/types/X10TypeMixin.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeMixin.java 2009-08-25 01:19:12 UTC (rev 11082) +++ trunk/x10.compiler/src/x10/types/X10TypeMixin.java 2009-08-25 02:11:30 UTC (rev 11083) @@ -171,6 +171,28 @@ return x; return x.clearFlags(X10Flags.PROTO); } + + /** + * If x is a class type, return struct x. Else return x. + * @param x + * @return + */ + public static X10Type makeStruct(X10Type x) { + if (x.isX10Struct()) + return x; + return x.setFlags(X10Flags.STRUCT); + } + + /** + * If x is a class type, return x, else return struct x. + * @param x + * @return + */ + public static X10Type makeRef(X10Type x) { + if (! x.isX10Struct()) + return x; + return x.clearFlags(X10Flags.STRUCT); + } public static Type baseTypeWithoutProto(Type t) { return baseForProto((X10Type) baseType(t)); } Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem.java 2009-08-25 01:19:12 UTC (rev 11082) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem.java 2009-08-25 02:11:30 UTC (rev 11083) @@ -172,6 +172,14 @@ * @return */ Type Rail(); + + /** + * Return the ClassType object for the struct x10.lang.Primitive + * + * @return + */ + Type Primitive(); + /** * Return the ClassType object for the x10.lang.ValRail interface. Modified: trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2009-08-25 01:19:12 UTC (rev 11082) +++ trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java 2009-08-25 02:11:30 UTC (rev 11083) @@ -845,6 +845,15 @@ return refType_; } + private X10ParsedClassType primitiveType_; + + public Type Primitive() { + if (primitiveType_ == null) + primitiveType_ = (X10ParsedClassType) load("x10.lang.Primitive"); + return primitiveType_; + } + + private X10ParsedClassType boxType_; public Type Box() { Added: trunk/x10.runtime/src-x10/x10/lang/Primitive.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Primitive.x10 (rev 0) +++ trunk/x10.runtime/src-x10/x10/lang/Primitive.x10 2009-08-25 02:11:30 UTC (rev 11083) @@ -0,0 +1,11 @@ +/* + * + * (C) Copyright IBM Corporation 2006-2008. + * + * This file is part of X10 Language. + * + */ + +package x10.lang; + +public abstract struct Primitive {} Added: trunk/x10.tests/tests/Constructs/Struct/StructCannotHaveNonFinalMethods_MustFailCompile.x10 =================================================================== --- trunk/x10.tests/tests/Constructs/Struct/StructCannotHaveNonFinalMethods_MustFailCompile.x10 (rev 0) +++ trunk/x10.tests/tests/Constructs/Struct/StructCannotHaveNonFinalMethods_MustFailCompile.x10 2009-08-25 02:11:30 UTC (rev 11083) @@ -0,0 +1,25 @@ +/* + * + * (C) Copyright IBM Corporation 2006 + * + * This file is part of X10 Test. + * + */ +import harness.x10Test; + +/** + * A struct cannot have a var field. + * @author vj + */ +public class StructCannotHaveNonFinalMethods_MustFailCompile extends x10Test { + + struct A { + def m() = 5; + } + + public def run()=true; + + public static def main(Rail[String]) { + new StructCannotHaveNonFinalMethods_MustFailCompile().execute(); + } +} Added: trunk/x10.tests/tests/Constructs/Struct/StructCannotHaveRootedField_MustFailCompile.x10 =================================================================== --- trunk/x10.tests/tests/Constructs/Struct/StructCannotHaveRootedField_MustFailCompile.x10 (rev 0) +++ trunk/x10.tests/tests/Constructs/Struct/StructCannotHaveRootedField_MustFailCompile.x10 2009-08-25 02:11:30 UTC (rev 11083) @@ -0,0 +1,25 @@ +/* + * + * (C) Copyright IBM Corporation 2006 + * + * This file is part of X10 Test. + * + */ +import harness.x10Test; + +/** + * A struct cannot have a rooted field. + * @author vj + */ +public class StructCannotHaveRootedField_MustFailCompile extends x10Test { + + struct A { + rooted val x:int=5; + } + + public def run()=true; + + public static def main(Rail[String]) { + new StructCannotHaveRootedField_MustFailCompile().execute(); + } +} Added: trunk/x10.tests/tests/Constructs/Struct/StructCannotHaveVarField_MustFailCompile.x10 =================================================================== --- trunk/x10.tests/tests/Constructs/Struct/StructCannotHaveVarField_MustFailCompile.x10 (rev 0) +++ trunk/x10.tests/tests/Constructs/Struct/StructCannotHaveVarField_MustFailCompile.x10 2009-08-25 02:11:30 UTC (rev 11083) @@ -0,0 +1,25 @@ +/* + * + * (C) Copyright IBM Corporation 2006 + * + * This file is part of X10 Test. + * + */ +import harness.x10Test; + +/** + * A struct cannot have a var field. + * @author vj + */ +public class StructCannotHaveVarField_MustFailCompile extends x10Test { + + struct A { + var x:int=5; + } + + public def run()=true; + + public static def main(Rail[String]) { + new StructCannotHaveVarField_MustFailCompile().execute(); + } +} Added: trunk/x10.tests/tests/Constructs/Struct/StructCannotSubclassClass_MustFailCompile.x10 =================================================================== --- trunk/x10.tests/tests/Constructs/Struct/StructCannotSubclassClass_MustFailCompile.x10 (rev 0) +++ trunk/x10.tests/tests/Constructs/Struct/StructCannotSubclassClass_MustFailCompile.x10 2009-08-25 02:11:30 UTC (rev 11083) @@ -0,0 +1,26 @@ +/* + * + * (C) Copyright IBM Corporation 2006 + * + * This file is part of X10 Test. + * + */ +import harness.x10Test; + +/** + * A struct cannot subclass a class. + * @author vj + */ +public class StructCannotSubclassClass_MustFailCompile extends x10Test { + + class B {} + struct A extends B { + val x:int=5; + } + + public def run()=true; + + public static def main(Rail[String]) { + new StructCannotSubclassClass_MustFailCompile().execute(); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2009-09-04 17:37:51
|
Revision: 11138 http://x10.svn.sourceforge.net/x10/?rev=11138&view=rev Author: dgrove-oss Date: 2009-09-04 17:37:43 +0000 (Fri, 04 Sep 2009) Log Message: ----------- XTENLANG-523 WIP : C++ codegen for structs A few simple first steps. methods of struct type aren't declared virtual. Verified that this results in sizeof(S) for several simple struct types being as expected (ie, no space allocated for C++ vtable). when emitting types for struct types, don't box them in x10aux::ref. access of instance fields of struct type never need place/null check. Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/visit/Emitter.java trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.runtime/src-cpp/x10aux/RTT.h Modified: trunk/x10.compiler/src/x10cpp/visit/Emitter.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/Emitter.java 2009-09-04 11:14:07 UTC (rev 11137) +++ trunk/x10.compiler/src/x10cpp/visit/Emitter.java 2009-09-04 17:37:43 UTC (rev 11138) @@ -238,6 +238,11 @@ // } else if (type.isClass()) { X10ClassType ct = (X10ClassType) type.toClass(); + if (ct.isX10Struct()) { + // Struct types are not boxed up as Refs. They are always generated as just C++ class types + // (Note: not pointer to Class, but the actual class). + asRef = false; + } if (ct.isAnonymous()) { if (ct.interfaces().size() == 1 && ct.interfaces().get(0) instanceof ClosureType) { @@ -515,8 +520,13 @@ } // [DC] there is no benefit to omitting the virtual keyword as we can // statically bind CALLS to final methods and methods that are members of final classes - else if (!flags.isProperty() && !flags.isPrivate()) - h.write("virtual "); + else if (!flags.isProperty() && !flags.isPrivate()) { + X10MethodInstance mi = (X10MethodInstance) def.asInstance(); + X10ClassType container = (X10ClassType) mi.container(); + if (!container.isX10Struct()) { + h.write("virtual "); + } + } } printType(ret, h); h.allowBreak(2, 2, " ", 1); @@ -565,8 +575,14 @@ } void printRTT(X10ClassType ct, ClassifiedStream h) { - boolean isInterface = ct.flags().isInterface(); - h.write(isInterface ? "RTT_H_DECLS_INTERFACE" : "RTT_H_DECLS_CLASS"); h.newline(); h.forceNewline(); + if (ct.flags().isInterface()) { + h.write("RTT_H_DECLS_INTERFACE"); + } else if (ct.isX10Struct()) { + h.write("RTT_H_DECLS_STRUCT"); + } else { + h.write("RTT_H_DECLS_CLASS"); + } + h.newline(); h.forceNewline(); } void printRTTDefn(X10ClassType ct, CodeWriter h) { Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2009-09-04 11:14:07 UTC (rev 11137) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2009-09-04 17:37:43 UTC (rev 11138) @@ -1016,6 +1016,7 @@ X10ClassType superClass = (X10ClassType) X10TypeMixin.baseType(currentClass.superClass()); boolean isInterface = currentClass.flags().isInterface(); X10TypeSystem xts = (X10TypeSystem) tr.typeSystem(); + String maybeVirtual = currentClass.isX10Struct() ? "" : "virtual "; ClassifiedStream h = sw.header(); @@ -1088,7 +1089,7 @@ if (numInterfaces > 0 && !currentClass.flags().isAbstract()) { /* ITables declarations */ h.write("static x10aux::itable_entry _itables["+(numInterfaces+1)+"];"); h.newline(); h.forceNewline(); - h.write("virtual x10aux::itable_entry* _getITables() { return _itables; }"); h.newline(); h.forceNewline(); + h.write(maybeVirtual+"x10aux::itable_entry* _getITables() { return _itables; }"); h.newline(); h.forceNewline(); int itableNum = 0; for (Type interfaceType : allInterfaces) { ITable itable = ITable.getITable((X10ClassType) X10TypeMixin.baseType(interfaceType)); @@ -1177,7 +1178,7 @@ } emitter.printTemplateSignature(newTypeParameters, h); if (newTypeParameters.isEmpty()) { - h.write("virtual "); + h.write(maybeVirtual); } emitter.printType(replaceType(X10TypeMixin.baseType(dropzone.returnType()), typeMap), h); h.write(" "+mangled_method_name(mname.toString())+"("); @@ -1264,7 +1265,7 @@ // Generate structEquals for values if (xts.isValueType(currentClass, context)) { h.write("public: "); - h.write("virtual "); + h.write(maybeVirtual); emitter.printType(xts.Boolean(), h); h.write(" "+mangled_method_name(STRUCT_EQUALS_METHOD)+"("); emitter.printType(xts.Object(), h); @@ -2281,12 +2282,11 @@ sw.end(); return; } else { - boolean assoc = - !(target instanceof New_c || - target instanceof Binary_c); - sw.write("x10aux::placeCheck(x10aux::nullCheck("); + boolean needsChecks = t.isClass() && !((X10ClassType)t.toClass()).isX10Struct(); + boolean assoc = !(target instanceof New_c || target instanceof Binary_c); + if (needsChecks) sw.write("x10aux::placeCheck(x10aux::nullCheck("); n.printSubExpr((Expr) target, assoc, sw, tr); - sw.write("))"); + if (needsChecks) sw.write("))"); } } else if (target instanceof TypeNode || target instanceof AmbReceiver) { @@ -2823,7 +2823,11 @@ sw.write(SAVED_THIS); context.saveEnvVariableInfo(THIS); } else { - sw.write("(("+emitter.translateType(n.type(),true)+")"+n.kind()+")"); + if (((X10ClassType)n.type().toClass()).isX10Struct()) { + sw.write("("+n.kind()+")"); + } else { + sw.write("(("+emitter.translateType(n.type(),true)+")"+n.kind()+")"); + } } } else if (n.kind().equals(X10Special_c.SUPER)) { sw.write(emitter.translateType(context.currentClass().superClass())); Modified: trunk/x10.runtime/src-cpp/x10aux/RTT.h =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/RTT.h 2009-09-04 11:14:07 UTC (rev 11137) +++ trunk/x10.runtime/src-cpp/x10aux/RTT.h 2009-09-04 17:37:43 UTC (rev 11138) @@ -10,6 +10,11 @@ static void _initRTT(); \ virtual const x10aux::RuntimeType *_type() const { return getRTT(); } +#define RTT_H_DECLS_STRUCT \ + static x10aux::RuntimeType rtt; \ + static const x10aux::RuntimeType* getRTT() { if (NULL == rtt.canonical) _initRTT(); return &rtt; } \ + static void _initRTT(); \ + #define RTT_H_DECLS_INTERFACE \ static x10aux::RuntimeType rtt; \ static const x10aux::RuntimeType* getRTT() { if (NULL == rtt.canonical) _initRTT(); return &rtt; } \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vj...@us...> - 2009-09-11 17:32:46
|
Revision: 11198 http://x10.svn.sourceforge.net/x10/?rev=11198&view=rev Author: vj0 Date: 2009-09-11 17:32:38 +0000 (Fri, 11 Sep 2009) Log Message: ----------- Thu Sep 03 03:54:47 2009 Implementation of place types. The key idea is that we add to the context a constrained term (of type place), representing the current known information about the type of here. To make it easier for programmers to write code, we permit the place argument p of the at expression at(p) e or statement at(p) s to be of type Ref or of type place. In case it is of type Ref, the at expression/statement will automatically coerce p to p.location. p is permitted to be any expression, including a method call. In the cases in which p is not representible as a constraint term, the compiler introduces a new final variable (say q), initialized with the expression and treats at(p) e as if it were at(q) e. The type of q is inferred to be the type of p. Specifically if the type of p constrains self to be some know place r, q will be constrained to be equal to r. At an implementation level, XContext and ClosureDef_c now carry two additional items, a placeTerm and a placeConstraint. The typeCheckOverride method of AtExpr_c is modified to establish the value of the placeTerm and placeConstraint fields in the ClosureDef_c associated with the body of the AtExpr_c. This is necessary so that type inference for the body of the AtExpr_c work correctly. The type of the AtExpr is the return type of the closure representing its body. Now a closure body may have multiple return statements inside it. The type of the closure is taken to be the merge (least upper bound) of the types of the expressions returned from within the body of the closure. This information is recorded in the associated codeDef(), of type ClosureDef. The way type inference for a closure/method body works is as follows. A resolver is set for the return type, containing a reference to the AST for the body at the time of type building. This resolver will be forced to execute when the returnType is visited during type-checking, and is disambiguated. By this point, typeCheckOverride will have been called on the parent AST node (atExpr). Unfortunately, this node is *a copy* of the node with which the resolver was initialized! Hence, we need to ensure that when the resolver runs it has access to the constrained placeTerm. We ensure this by storing the information in the ClosureDef associated with the AtExpr AST, since all copies of the AST refer to the same ClosureDef. Additionally, we modify the type-checking of X10New_c so that a constraint clause equivalent to "self.location==here" is added to the type of the expression. here, of course, is replaced by the constrained placeTerm from the environment. An important point: We we have to implement "adding the clause |self.location==here|" by adding to the type of the X10New_c expression the constraints |self.location==placeTerm, placeConstraint|. This is the right thing to do since placeTerm may be a symbolic variable about which the only pieces of information we have are those in placeConstraint. Thus if |p| is a final variable, the type-checker can infer that the type of |at (p) (new Foo())| is |Foo{self.location==p}|. If |p()| is a procedure call with the return type |Place{self==x}| then the type of |at (p())(new Foo())| will be inferred as |Foo{self.location==_1786, _1786==x}| (for some new symbolic variable |_1786|), i.e. |Foo{self.location==x}|. Handling of this. Note that in the body of an instance method, it is not necessarily the case that |this.location==here|. For instance the body of an instance method may contain an explicit |at| expression or statement which changes the value of |here|. To do: -- Addion of logic for ateach. -- Addition of logic for distributions. Sat Sep 05 21:39:46 2009 When a class is pushed into the context, add the constraint |this.location==here|. Mon Sep 07 08:53:13 2009 Refactored significant chunks of X10MethodInstance_c abstracting large swathes of detailed code into small, semantically meaningful, reusable chunks. See checkCall and instantiate2 in particular. Used to be that the env was made to contain the binding xi = xtype.self, and xi is the translation of the formal name. Bug in old code: Hmm.. this is not right. The variable may not be final, hence cannot appear in constraints. Well, then it wont matter that we add this. Mon Sep 07 18:50:45 2009 Ok there is a leakage of constraints into the formal type. The formal type should always be very small -- because it should just reflect what is written in the text. But see ll.txt. We are getting formal types with scores of conjuncts. Mon Sep 07 20:00:41 2009 Compile time had gone to 14 minutes for XRX! Reduced it to 5 :-) by recognizing that when formals are being fixed, the constraints must be copied. (Otherwise the old constraints were being modified in place, resulting in larger and larger constraints on each successive pass!) Mon Sep 07 20:01:41 2009 Realized that need to make sure that thisType is updated by instantiating with the chosen value for this. However, need to make sure that the updated this type is not communicated to the second call to instantiate2 -- the second call must be given the original thisType so that it can update it with a chosen UQV. The thisType updated by this call must be the one passed into checkCall. Mon Sep 07 20:03:52 2009 Need to figure out how to add here clauses in methods, e.g. in FastArray: def raw(){ dist.onePlace==here }:Rail[T] = raw; May already be implemented...check. Tue Sep 08 00:49:19 2009 Fixed here() --- now it simply genrates a local variable, here. Let p be the current place as recorded in the context. To check if receiver r is local (X10TypeSystem_c.isHere(...)), we now add here=p to the antecedent, and ask if r.location==p. Another unintended side-effect on a constraint --- need to copy in computeNewSigma. Need to add code to ensure that the type of a val field of Ref type with an initializer is extended with the clause self.at(this). isSubtype needs to add here=p to the antecedent. Fixed. * Look at Reader.x10. Arguments are passed at the type Marshal (an interface). Methods are subsequently invoked. We need a way of saying that something is local or a value (so that methods can be invoked on it). Specifying the clause self.at(here) does not work, since the field .location is not defined. To Object, added: property def loc():Place; property def at(p:Place):Boolean; property def at(r:Ref):Boolean; and these are defined under Ref and Value. Hopefully this means we can now use self.at(p) with interfaces! * When expanding bodies of property methods, need to make sure it is done recursively? Fri Sep 11 06:27:26 2009 * Fixed the problem of at clauses on Interfaces by hard-wiring into XTypeTranslator that a call |s.at(t)| where |at| has been resolved to the method |Object.at(Place)| or |Object.at(Ref)| should be considered as |here == tloc| if the type of |s| is a subtype of |Place|, and as }s.location == tloc| otherwise, where |tloc| is |t| if the type of |t| is |Place| and |t.location| otherwise. * Fixed the return type of |here|. Needs to include the clause |self == t| where |t| is the current place (obtained from the context). * Why is null being allowed as a value for a cosntrained type. Need to ensure that when we assign null to a variable, we check that the null value satisfies the constraint clause associated with the variable's type. * Need to ensure that activity().finishState.pop() will work, where activity: Activity{self.at(here)} activity.finishState: State{self.at(this)} Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/AssignPropertyCall_c.java trunk/x10.compiler/src/x10/ast/AtExpr.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.java trunk/x10.compiler/src/x10/ast/Closure_c.java trunk/x10.compiler/src/x10/ast/Future.java trunk/x10.compiler/src/x10/ast/Future_c.java trunk/x10.compiler/src/x10/ast/Here_c.java trunk/x10.compiler/src/x10/ast/TypeCheckReturnTypeGoal.java trunk/x10.compiler/src/x10/ast/UnknownTypeNode_c.java trunk/x10.compiler/src/x10/ast/X10Call_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/X10ConstructorCall_c.java trunk/x10.compiler/src/x10/ast/X10FieldAssign_c.java trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java trunk/x10.compiler/src/x10/ast/X10Field_c.java trunk/x10.compiler/src/x10/ast/X10Loop_c.java trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java trunk/x10.compiler/src/x10/ast/X10New_c.java trunk/x10.compiler/src/x10/ast/X10NodeFactory.java trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java trunk/x10.compiler/src/x10/ast/X10Return_c.java trunk/x10.compiler/src/x10/ast/X10Special_c.java trunk/x10.compiler/src/x10/parser/X10KWLexer.gi trunk/x10.compiler/src/x10/parser/X10KWLexer.java trunk/x10.compiler/src/x10/parser/X10KWLexerprs.java trunk/x10.compiler/src/x10/parser/X10KWLexersym.java trunk/x10.compiler/src/x10/parser/X10Parser.java trunk/x10.compiler/src/x10/parser/X10Parserprs.java trunk/x10.compiler/src/x10/parser/X10Parsersym.java trunk/x10.compiler/src/x10/parser/x10.g trunk/x10.compiler/src/x10/types/ClosureDef.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/X10ArraysMixin.java trunk/x10.compiler/src/x10/types/X10Context.java trunk/x10.compiler/src/x10/types/X10Context_c.java trunk/x10.compiler/src/x10/types/X10Flags.java trunk/x10.compiler/src/x10/types/X10MemberDef.java trunk/x10.compiler/src/x10/types/X10MethodDef.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/X10Type.java trunk/x10.compiler/src/x10/types/X10TypeEnv.java trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java trunk/x10.compiler/src/x10/types/X10TypeMixin.java trunk/x10.compiler/src/x10/types/X10TypeSystem.java trunk/x10.compiler/src/x10/types/X10TypeSystem_c.java trunk/x10.compiler/src/x10/types/XTypeTranslator.java trunk/x10.compiler/src/x10/types/notes.txt trunk/x10.compiler/src/x10/util/Synthesizer.java trunk/x10.compiler/src/x10/visit/Desugarer.java trunk/x10.compiler/src/x10/visit/Optimizer.java trunk/x10.compiler/src/x10/visit/X10DelegatingVisitor.java trunk/x10.constraints/src/x10/constraint/XConstraint.java trunk/x10.constraints/src/x10/constraint/XConstraint_c.java trunk/x10.constraints/src/x10/constraint/XField_c.java trunk/x10.constraints/src/x10/constraint/XFormula_c.java trunk/x10.constraints/src/x10/constraint/XTerms.java trunk/x10.runtime/src-x10/x10/array/BaseArray.x10 trunk/x10.runtime/src-x10/x10/array/BaseDist.x10 trunk/x10.runtime/src-x10/x10/array/DistArray.x10 trunk/x10.runtime/src-x10/x10/array/FastArray.x10 trunk/x10.runtime/src-x10/x10/array/LocalArray.x10 trunk/x10.runtime/src-x10/x10/array/MatBuilder.x10 trunk/x10.runtime/src-x10/x10/array/PolyMat.x10 trunk/x10.runtime/src-x10/x10/array/PolyRegion.x10 trunk/x10.runtime/src-x10/x10/array/PolyScanner.x10 trunk/x10.runtime/src-x10/x10/array/PolyXform.x10 trunk/x10.runtime/src-x10/x10/array/RectRegion.x10 trunk/x10.runtime/src-x10/x10/array/Row.x10 trunk/x10.runtime/src-x10/x10/array/UnionRegion.x10 trunk/x10.runtime/src-x10/x10/array/VarRow.x10 trunk/x10.runtime/src-x10/x10/array/Xform.x10 trunk/x10.runtime/src-x10/x10/io/File.x10 trunk/x10.runtime/src-x10/x10/io/FileReader.x10 trunk/x10.runtime/src-x10/x10/io/FileWriter.x10 trunk/x10.runtime/src-x10/x10/io/Marshal.x10 trunk/x10.runtime/src-x10/x10/io/PutbackReader.x10 trunk/x10.runtime/src-x10/x10/io/Reader.x10 trunk/x10.runtime/src-x10/x10/io/StringWriter.x10 trunk/x10.runtime/src-x10/x10/lang/Box.x10 trunk/x10.runtime/src-x10/x10/lang/MultipleExceptions.x10 trunk/x10.runtime/src-x10/x10/lang/Object.x10 trunk/x10.runtime/src-x10/x10/lang/Place.x10 trunk/x10.runtime/src-x10/x10/lang/Rail.x10 trunk/x10.runtime/src-x10/x10/lang/Ref.x10 trunk/x10.runtime/src-x10/x10/lang/System.x10 trunk/x10.runtime/src-x10/x10/lang/ValRail.x10 trunk/x10.runtime/src-x10/x10/lang/Value.x10 trunk/x10.runtime/src-x10/x10/runtime/Activity.x10 trunk/x10.runtime/src-x10/x10/runtime/ClockPhases.x10 trunk/x10.runtime/src-x10/x10/runtime/FinishStates.x10 trunk/x10.runtime/src-x10/x10/runtime/Future_c.x10 trunk/x10.runtime/src-x10/x10/runtime/Lock.x10 trunk/x10.runtime/src-x10/x10/runtime/PlaceLocalHandle.x10 trunk/x10.runtime/src-x10/x10/runtime/Pool.x10 trunk/x10.runtime/src-x10/x10/runtime/RID.x10 trunk/x10.runtime/src-x10/x10/runtime/RemoteFinish.x10 trunk/x10.runtime/src-x10/x10/runtime/RootFinish.x10 trunk/x10.runtime/src-x10/x10/runtime/Runtime.x10 trunk/x10.runtime/src-x10/x10/runtime/Thread.x10 trunk/x10.runtime/src-x10/x10/runtime/Worker.x10 trunk/x10.runtime/src-x10/x10/util/ArrayList.x10 trunk/x10.runtime/src-x10/x10/util/HashMap.x10 trunk/x10.runtime/src-x10/x10/util/RailBuilder.x10 trunk/x10.runtime/src-x10/x10/util/Random.x10 trunk/x10.runtime/src-x10/x10/util/StringBuilder.x10 trunk/x10.runtime/src-x10/x10/util/ValRailBuilder.x10 trunk/x10.runtime/src-x10/x10/util/concurrent/atomic/AtomicInteger.x10 trunk/x10.tests/examples/Constructs/At/AtFieldAccess.x10 trunk/x10.tests/examples/Constructs/Value/ValueClass.x10 Added Paths: ----------- trunk/x10.compiler/src/x10/ast/PlacedClosure.java trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java trunk/x10.compiler/src/x10/parser/notes.txt trunk/x10.constraints/src/x10/constraint/XConstrainedTerm.java trunk/x10.tests/examples/Constructs/At/AtFieldWrite.x10 trunk/x10.tests/examples/Constructs/At/AtFieldWrite_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/AtCheck.x10 trunk/x10.tests/examples/Constructs/Place/AtCheck2.x10 trunk/x10.tests/examples/Constructs/Place/AtCheck2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/AtThisIntoAtHere.x10 trunk/x10.tests/examples/Constructs/Place/AtThisIntoAtHere_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/At_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/CheckThisTypeInCall.x10 trunk/x10.tests/examples/Constructs/Place/FieldWrite.x10 trunk/x10.tests/examples/Constructs/Place/FutureFielAccessRev_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/FutureFieldAccessStatic_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/FutureFieldAccessStruct.x10 trunk/x10.tests/examples/Constructs/Place/FutureFieldAccess_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/FutureGlobalMethodInvoke.x10 trunk/x10.tests/examples/Constructs/Place/FutureGlobalMethodInvokeRev.x10 trunk/x10.tests/examples/Constructs/Place/FutureGlobalMethodInvokeStatic.x10 trunk/x10.tests/examples/Constructs/Place/FutureGlobalMethodInvokeStruct.x10 trunk/x10.tests/examples/Constructs/Place/FutureMethodInvokeRev_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/FutureMethodInvokeStatic_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/FutureMethodInvoke_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/FuturePropertyAccess.x10 trunk/x10.tests/examples/Constructs/Place/FuturePropertyAccessRev.x10 trunk/x10.tests/examples/Constructs/Place/FuturePropertyAccessStatic.x10 trunk/x10.tests/examples/Constructs/Place/FutureVarFieldAccessRev_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/FutureVarFieldAccessStatic_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/FutureVarFieldAccess_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/GlobalAccess.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckStringBuilder_MustFailCompile.x10 Removed Paths: ------------- trunk/x10.tests/examples/Constructs/Place/PlaceCheckGenericClass.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckInnerClass.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckReverse.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckStaticClass.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckStringBuilder.x10 trunk/x10.tests/examples/Constructs/Place/PlaceCheckValueClass.x10 Property Changed: ---------------- trunk/x10.tests/examples/Constructs/Array/ trunk/x10.tests/examples/Constructs/Async/ trunk/x10.tests/examples/Constructs/AtEach/ Modified: trunk/x10.compiler/src/x10/ast/AssignPropertyCall_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AssignPropertyCall_c.java 2009-09-11 15:14:23 UTC (rev 11197) +++ trunk/x10.compiler/src/x10/ast/AssignPropertyCall_c.java 2009-09-11 17:32:38 UTC (rev 11198) @@ -198,12 +198,11 @@ if (c != null) known.addIn(c.substitute(prop, c.self())); - try { + XTerm initVar = ts.xtypeTranslator().trans(known, initializer, (X10Context) ctx); known.addBinding(prop, initVar); - } - catch (SemanticException e) { - } + + } // bind this==self; sup clause may constrain this. Modified: trunk/x10.compiler/src/x10/ast/AtExpr.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AtExpr.java 2009-09-11 15:14:23 UTC (rev 11197) +++ trunk/x10.compiler/src/x10/ast/AtExpr.java 2009-09-11 17:32:38 UTC (rev 11198) @@ -10,12 +10,21 @@ */ package x10.ast; +import java.util.List; + +import polyglot.ast.CodeBlock; import polyglot.ast.Expr; +import polyglot.ast.Formal; +import polyglot.ast.TypeNode; import polyglot.types.Type; +import x10.types.ClosureDef; import x10.visit.ExprFlattener; /** The AST node for the X10 construct at (P) {e} * */ -public interface AtExpr extends Closure, RemoteActivityInvocation { +public interface AtExpr extends PlacedClosure { + + + } Modified: trunk/x10.compiler/src/x10/ast/AtExpr_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AtExpr_c.java 2009-09-11 15:14:23 UTC (rev 11197) +++ trunk/x10.compiler/src/x10/ast/AtExpr_c.java 2009-09-11 17:32:38 UTC (rev 11198) @@ -20,6 +20,7 @@ import polyglot.ast.Node; import polyglot.ast.Term; import polyglot.ast.TypeNode; +import polyglot.types.Context; import polyglot.types.SemanticException; import polyglot.types.Type; import polyglot.types.Types; @@ -30,7 +31,10 @@ import polyglot.visit.ContextVisitor; import polyglot.visit.NodeVisitor; 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; import x10.types.X10NamedType; @@ -44,78 +48,24 @@ * <code>at (place) { expression }<code> * stmts are used to represent the fully exploded version of the expression * as might be needed in order to inline array expressions. + * @author ?? + * @author vj 08/30/09 - Refactored out PlacedClosure. */ -public class AtExpr_c extends Closure_c +public class AtExpr_c extends PlacedClosure_c implements AtExpr { - public Expr place; - public AtExpr_c(Position p, Expr place, TypeNode returnType, Block body) { - super(p, Collections.EMPTY_LIST, Collections.EMPTY_LIST, returnType, null, Collections.EMPTY_LIST, body); - this.place = place; + super(p, place, returnType, body); } - /** Get the RemoteActivity's place. */ - public Expr place() { - return place; - } - - /** Set the RemoteActivity's place. */ - public RemoteActivityInvocation place(Expr place) { - this.place = place; - return this; - } - - /** Visit the children of the expression. - * vj: TODO: I use a hack below to bypass - * visiting the embedded stmt if the visitor is a ReachChecker. - * Otherwise a reach error is generated that is in fact spurious. - * There must be a way to convince the ReachChecker legitimately that this statement - * is reachable if the future is reachable. - * */ - public Node visitChildren( NodeVisitor v ) { - Expr place = (Expr) visitChild( this.place, v ); - AtExpr_c n = (AtExpr_c) super.visitChildren(v); - if (n.place != place) { - if (n == this) n = (AtExpr_c) copy(); - n.place = place; - } - return n; - } - - /** Type check the expression. */ public Node typeCheck( ContextVisitor tc ) throws SemanticException { - X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); - X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); - - Type placeType = place.type(); - Expr newPlace = place; - boolean placeIsPlace = ts.isImplicitCastValid(placeType, ts.Place(), tc.context()); - if ( ! placeIsPlace ) { - if (! placeIsPlace) { - throw new SemanticException( - "Place expression of at must be of type \"" + - ts.Place() + "\", not \"" + place.type() + "\".", - place.position()); - } - } - AtExpr_c n = (AtExpr_c) place(newPlace); - n = (AtExpr_c) super.typeCheck(tc); - + AtExpr_c n = (AtExpr_c) super.typeCheck(tc); Type t = n.returnType().type(); - return n.type(t); } - public Type childExpectedType(Expr child, AscriptionVisitor av) { - X10TypeSystem ts = (X10TypeSystem) av.typeSystem(); - if ( child == place ) { - return ts.Place(); - } - return child.type(); - } - + public String toString() { - return " at[" + returnType + "](" + place + ") " + body; + return "(#" + hashCode() + ") at[" + returnType + "](" + place + ") " + body; } /** Write the expression to an output file. */ @@ -129,36 +79,6 @@ printBlock(body, w, tr); } - /** - * Return the first (sub)term performed when evaluating this - * term. - */ - public Term firstChild() { - return returnType; - } - - /** - * Visit this term in evaluation order. - */ - public List<Term> acceptCFG(CFGBuilder v, List<Term> succs) { - v.visitCFG(returnType, place, ENTRY); - - // If building the CFG for the enclosing code, don't thread - // in the closure body. Otherwise, we're building the CFG - // for the closure itself. - if (! succs.isEmpty()) { - v.visitCFG(place, this, EXIT); - } - else { - v.visitCFG(place, body, ENTRY); - v.visitCFG(body, this, EXIT); - } - - /* - v.visitCFG(returnType, FlowGraph.EDGE_KEY_TRUE, body, ENTRY, - FlowGraph.EDGE_KEY_FALSE, this, EXIT); - */ - return succs; - } + } Modified: trunk/x10.compiler/src/x10/ast/AtStmt_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AtStmt_c.java 2009-09-11 15:14:23 UTC (rev 11197) +++ trunk/x10.compiler/src/x10/ast/AtStmt_c.java 2009-09-11 17:32:38 UTC (rev 11198) @@ -28,6 +28,7 @@ import polyglot.types.TypeSystem; import polyglot.util.CodeWriter; import polyglot.util.CollectionUtil; +import polyglot.util.InternalCompilerError; import polyglot.util.Position; import polyglot.visit.AscriptionVisitor; import polyglot.visit.CFGBuilder; @@ -35,8 +36,16 @@ import polyglot.visit.FlowGraph; import polyglot.visit.NodeVisitor; import polyglot.visit.PrettyPrinter; +import polyglot.visit.PruningVisitor; +import x10.constraint.XConstrainedTerm; +import x10.constraint.XConstraint; +import x10.constraint.XConstraint_c; +import x10.constraint.XFailure; +import x10.constraint.XTerm; +import x10.types.ClosureDef; import x10.types.X10Context; import x10.types.X10MethodDef; +import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; /** @@ -106,7 +115,28 @@ return this; } + XConstrainedTerm placeTerm; + + @Override + public Node typeCheckOverride(Node parent, ContextVisitor tc) throws SemanticException { + X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); + NodeVisitor v = tc.enter(parent, this); + + if (v instanceof PruningVisitor) { + return this; + } + if (placeTerm == null) { + placeTerm = PlacedClosure_c.computePlaceTerm((Expr) visitChild(this.place, v), + (X10Context) tc.context(),ts); + } + + // now that placeTerm is set in this node, continue visiting children + // enterScope will ensure that placeTerm is installed in the context. + + return null; + } + /** Visit the children of the statement. */ public Node visitChildren(NodeVisitor v) { Expr place = (Expr) visitChild(this.place, v); @@ -115,8 +145,6 @@ } public Context enterScope(Context c) { - if (Report.should_report(TOPICS, 5)) - Report.report(5, "enter at scope"); X10TypeSystem ts = (X10TypeSystem) c.typeSystem(); X10MethodDef asyncInstance = (X10MethodDef) ts.asyncCodeInstance(c.inStaticContext()); if (c.currentCode() instanceof X10MethodDef) { @@ -131,9 +159,18 @@ return c; } + @Override public Context enterChildScope(Node child, Context c) { if (child != this.body) { c = c.pop(); + } else { + c = super.enterChildScope(child,c); + X10Context xc = (X10Context) c; + if (child == body) { + if (placeTerm != null) + c = ((X10Context) c).pushPlace(placeTerm); + } + addDecls(c); } return c; } @@ -141,21 +178,11 @@ public Node typeCheck(ContextVisitor tc) throws SemanticException { X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); - - Type placeType = place.type(); - Expr newPlace = place; - boolean placeIsPlace = ts.isImplicitCastValid(placeType, ts.Place(), tc.context()); - if (! placeIsPlace) { - throw new SemanticException( - "Place expression of at must be of type \"" + - ts.Place() + "\", not \"" + place.type() + "\".", - place.position()); - } X10Context c = (X10Context) tc.context(); if (c.inSequentialCode()) throw new SemanticException("at may not be invoked in sequential code.", position()); - return (Node) place(newPlace); + return super.typeCheck(tc); } @@ -191,8 +218,6 @@ return body; } - - /** * Visit this term in evaluation order. * [IP] Treat this as a conditional to make sure the following Modified: trunk/x10.compiler/src/x10/ast/Closure.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Closure.java 2009-09-11 15:14:23 UTC (rev 11197) +++ trunk/x10.compiler/src/x10/ast/Closure.java 2009-09-11 17:32:38 UTC (rev 11198) @@ -17,6 +17,7 @@ import polyglot.ast.Expr; import polyglot.ast.Formal; import polyglot.ast.TypeNode; +import polyglot.util.Position; import x10.types.ClosureDef; public interface Closure extends Expr, CodeBlock { @@ -44,4 +45,6 @@ ClosureDef closureDef(); Closure closureDef(ClosureDef ci); + + Closure position(Position p); } Modified: trunk/x10.compiler/src/x10/ast/Closure_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Closure_c.java 2009-09-11 15:14:23 UTC (rev 11197) +++ trunk/x10.compiler/src/x10/ast/Closure_c.java 2009-09-11 17:32:38 UTC (rev 11198) @@ -95,7 +95,11 @@ public List<TypeParamNode> typeParameters() { return typeParameters; } - + public Closure position(Position pos) { + Closure_c n = (Closure_c) copy(); + n.position=pos; + return n; + } public Closure typeParameters(List<TypeParamNode> typeParams) { Closure_c n = (Closure_c) copy(); n.typeParameters=TypedList.copyAndCheck(typeParams, TypeParamNode.class, true); @@ -197,10 +201,12 @@ } /** Visit the children of the expression. */ - public Node visitChildren(NodeVisitor v) { + @SuppressWarnings("unchecked") + public Node visitChildren(NodeVisitor v) { List<TypeParamNode> typeParams = visitList(this.typeParameters, v); List<Formal> formals = visitList(this.formals, v); DepParameterExpr guard = (DepParameterExpr) visitChild(this.guard, v); + TypeNode returnType = (TypeNode) visitChild(this.returnType, v); List<TypeNode> throwTypes = visitList(this.throwTypes, v); Block body = (Block) visitChild(this.body, v); @@ -236,13 +242,15 @@ else { thisVar = ct.thisVar(); } - - ClosureDef mi = ts.closureDef(position(), Types.ref(ct.asType()), Types.ref(code.asInstance()), returnType.typeRef(), + + ClosureDef mi = ts.closureDef(position(), Types.ref(ct.asType()), + Types.ref(code.asInstance()), returnType.typeRef(), Collections.<Ref<? extends Type>>emptyList(), Collections.<Ref<? extends Type>>emptyList(), thisVar, Collections.<LocalDef>emptyList(), null, null, Collections.<Ref<? extends Type>>emptyList()); - + // System.err.println("Closure_c: Golden! TypeBuilder: return type for " + this + " is " + // + returnType + " with ref "+ returnType.typeRef()); if (returnType() instanceof UnknownTypeNode) { mi.inferReturnType(true); } @@ -251,7 +259,10 @@ // since closures don't have names, we'll never have to resolve the signature. Just push the code context. TypeBuilder tb2 = tb.pushCode(mi); + // System.err.println("Closure_c: Golden! TypeBuilder: visiting children of " + this ); + Closure_c n = (Closure_c) this.del().visitChildren(tb2); + //System.err.println("Closure_c: Golden! TypeBuilder: done visiting children of " + this); if (n.guard() != null) { mi.setGuard(n.guard().valueConstraint()); @@ -306,7 +317,8 @@ @Override public Context enterChildScope(Node child, Context c) { // We should have entered the method scope already. - assert c.currentCode() == this.closureDef(); + if ( c.currentCode() != this.closureDef()) + assert c.currentCode() == this.closureDef(); if (child != body()) { // Push formals so they're in scope in the types of the other formals. @@ -329,14 +341,14 @@ tn.setResolver(this, v); NodeVisitor childv = v.enter(parent, this); - childv = childv.enter(this, returnType()); - + childv = childv.enter(this, returnType()); + if (childv instanceof TypeCheckPreparer) { - TypeCheckPreparer tcp = (TypeCheckPreparer) childv; - final LazyRef<Type> r = (LazyRef<Type>) tn.typeRef(); - TypeChecker tc = new TypeChecker(v.job(), v.typeSystem(), v.nodeFactory(), v.getMemo()); - tc = (TypeChecker) tc.context(tcp.context().freeze()); - r.setResolver(new TypeCheckReturnTypeGoal(this, body, tc, r, true)); + TypeCheckPreparer tcp = (TypeCheckPreparer) childv; + final LazyRef<Type> r = (LazyRef<Type>) tn.typeRef(); + TypeChecker tc = new TypeChecker(v.job(), v.typeSystem(), v.nodeFactory(), v.getMemo()); + tc = (TypeChecker) tc.context(tcp.context().freeze()); + r.setResolver(new TypeCheckReturnTypeGoal(this, body, tc, r, true)); } } return super.setResolverOverride(parent, v); Modified: trunk/x10.compiler/src/x10/ast/Future.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Future.java 2009-09-11 15:14:23 UTC (rev 11197) +++ trunk/x10.compiler/src/x10/ast/Future.java 2009-09-11 17:32:38 UTC (rev 11198) @@ -17,5 +17,5 @@ /** The AST node for the X10 construct future (P) {e} * */ -public interface Future extends Closure, RemoteActivityInvocation { +public interface Future extends PlacedClosure { } Modified: trunk/x10.compiler/src/x10/ast/Future_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Future_c.java 2009-09-11 15:14:23 UTC (rev 11197) +++ trunk/x10.compiler/src/x10/ast/Future_c.java 2009-09-11 17:32:38 UTC (rev 11198) @@ -44,76 +44,25 @@ * <code>future (place) { expression }<code> * stmts are used to represent the fully exploded version of the expression * as might be needed in order to inline array expressions. + * + * @author ?? + * @author vj 08/30/09 -- added place checks by refactoring out PlacedClosure. */ -public class Future_c extends Closure_c +public class Future_c extends PlacedClosure_c implements Future { - public Expr place; - public Future_c(Position p, Expr place, TypeNode returnType, Block body) { - super(p, Collections.EMPTY_LIST, Collections.EMPTY_LIST, returnType, null, Collections.EMPTY_LIST, body); - this.place = place; + super(p, place, returnType, body); } - /** Get the RemoteActivity's place. */ - public Expr place() { - return place; - } - - /** Set the RemoteActivity's place. */ - public RemoteActivityInvocation place(Expr place) { - this.place = place; - return this; - } - - /** Visit the children of the expression. - * vj: TODO: I use a hack below to bypass - * visiting the embedded stmt if the visitor is a ReachChecker. - * Otherwise a reach error is generated that is in fact spurious. - * There must be a way to convince the ReachChecker legitimately that this statement - * is reachable if the future is reachable. - * */ - public Node visitChildren( NodeVisitor v ) { - Expr place = (Expr) visitChild( this.place, v ); - Future_c n = (Future_c) super.visitChildren(v); - if (n.place != place) { - if (n == this) n = (Future_c) copy(); - n.place = place; - } - return n; - } - /** Type check the expression. */ public Node typeCheck( ContextVisitor tc ) throws SemanticException { X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); - X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); - - Type placeType = place.type(); - Expr newPlace = place; - boolean placeIsPlace = ts.isImplicitCastValid(placeType, ts.Place(), tc.context()); - if ( ! placeIsPlace ) { - if (! placeIsPlace) { - throw new SemanticException( - "Place expression of future must be of type \"" + - ts.Place() + "\", not \"" + place.type() + "\".", - place.position()); - } - } - Future_c n = (Future_c) place(newPlace); - n = (Future_c) super.typeCheck(tc); - + Future_c n = (Future_c) super.typeCheck(tc); Type t = n.returnType().type(); - return n.type( ts.futureOf(position(), Types.ref(t))); } - public Type childExpectedType(Expr child, AscriptionVisitor av) { - X10TypeSystem ts = (X10TypeSystem) av.typeSystem(); - if ( child == place ) { - return ts.Place(); - } - return child.type(); - } - + public String toString() { return "future[" + returnType + "](" + place + ") " + body; } @@ -128,37 +77,5 @@ w.write(") "); printBlock(body, w, tr); } - - /** - * Return the first (sub)term performed when evaluating this - * term. - */ - public Term firstChild() { - return returnType; - } - - /** - * Visit this term in evaluation order. - */ - public List<Term> acceptCFG(CFGBuilder v, List<Term> succs) { - v.visitCFG(returnType, place, ENTRY); - - // If building the CFG for the enclosing code, don't thread - // in the closure body. Otherwise, we're building the CFG - // for the closure itself. - if (! succs.isEmpty()) { - v.visitCFG(place, this, EXIT); - } - else { - v.visitCFG(place, body, ENTRY); - v.visitCFG(body, this, EXIT); - } - - /* - v.visitCFG(returnType, FlowGraph.EDGE_KEY_TRUE, body, ENTRY, - FlowGraph.EDGE_KEY_FALSE, this, EXIT); - */ - return succs; - } } Modified: trunk/x10.compiler/src/x10/ast/Here_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Here_c.java 2009-09-11 15:14:23 UTC (rev 11197) +++ trunk/x10.compiler/src/x10/ast/Here_c.java 2009-09-11 17:32:38 UTC (rev 11198) @@ -17,11 +17,20 @@ import polyglot.ast.Expr_c; import polyglot.types.Resolver; import polyglot.types.SemanticException; +import polyglot.types.Type; import polyglot.util.CodeWriter; import polyglot.util.Position; import polyglot.visit.CFGBuilder; import polyglot.visit.ContextVisitor; import polyglot.visit.PrettyPrinter; +import x10.constraint.XConstrainedTerm; +import x10.constraint.XConstraint; +import x10.constraint.XConstraint_c; +import x10.constraint.XFailure; +import x10.constraint.XTerm; +import x10.constraint.XVar; +import x10.types.X10Context; +import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; @@ -64,7 +73,18 @@ /** Type check the expression. */ public Node typeCheck(ContextVisitor tc) throws SemanticException { X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); - return type(ts.Place()); + X10Context xc = (X10Context) tc.context(); + + Type tt = ts.Place(); + XConstraint cc = new XConstraint_c(); + try { + cc.addSelfBinding(xc.currentPlaceTerm()); + } + catch (XFailure e) { + throw new SemanticException("Constraint on here is inconsistent; " + e.getMessage(), position()); + } + tt = X10TypeMixin.xclause(X10TypeMixin.baseType(tt), cc); + return type(tt); } public String translate(Resolver c) { return "x10.lang.Runtime.here()"; Added: trunk/x10.compiler/src/x10/ast/PlacedClosure.java =================================================================== --- trunk/x10.compiler/src/x10/ast/PlacedClosure.java (rev 0) +++ trunk/x10.compiler/src/x10/ast/PlacedClosure.java 2009-09-11 17:32:38 UTC (rev 11198) @@ -0,0 +1,14 @@ +/** + * + */ +package x10.ast; + +/** + * An abstraction for future(p) Expr and at(p) Expr + * + * @author vj + * + */ +public interface PlacedClosure extends RemoteActivityInvocation, Closure { + +} Added: trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java (rev 0) +++ trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java 2009-09-11 17:32:38 UTC (rev 11198) @@ -0,0 +1,233 @@ +/** + * + */ +package x10.ast; + +import java.util.Collections; +import java.util.List; + +import polyglot.ast.Block; +import polyglot.ast.Expr; +import polyglot.ast.Formal; +import polyglot.ast.Node; +import polyglot.ast.Term; +import polyglot.ast.TypeNode; +import polyglot.types.Context; +import polyglot.types.SemanticException; +import polyglot.types.Type; +import polyglot.util.InternalCompilerError; +import polyglot.util.Position; +import polyglot.visit.AscriptionVisitor; +import polyglot.visit.CFGBuilder; +import polyglot.visit.ContextVisitor; +import polyglot.visit.NodeVisitor; +import polyglot.visit.PruningVisitor; +import polyglot.visit.TypeChecker; +import x10.constraint.XConstrainedTerm; +import x10.constraint.XConstraint; +import x10.constraint.XConstraint_c; +import x10.constraint.XFailure; +import x10.constraint.XTerm; +import x10.types.ClosureDef; +import x10.types.X10Context; +import x10.types.X10TypeMixin; +import x10.types.X10TypeSystem; + +/** + * A common abstraction for a closure that may execute at a given place, + * viz future (p) expr and at (p) expr. + * + * @author vj + * + */ +public class PlacedClosure_c extends Closure_c implements PlacedClosure { + + + protected Expr place; + + public PlacedClosure_c(Position p, Expr place, TypeNode returnType, Block body) { + super(p, Collections.EMPTY_LIST, Collections.EMPTY_LIST, returnType, null, + Collections.EMPTY_LIST, body); + this.place = place; + } + + /** Get the RemoteActivity's place. */ + public Expr place() { + return place; + } + + /** Set the RemoteActivity's place. */ + public RemoteActivityInvocation place(Expr place) { + this.place = place; + return this; + } + + /** Visit the children of the expression. + * vj: TODO: I use a hack below to bypass + * visiting the embedded stmt if the visitor is a ReachChecker. + * Otherwise a reach error is generated that is in fact spurious. + * There must be a way to convince the ReachChecker legitimately that this statement + * is reachable if the future is reachable. + * */ + public Node visitChildren( NodeVisitor v ) { + Expr place = (Expr) visitChild( this.place, v ); + PlacedClosure_c n = (PlacedClosure_c) super.visitChildren(v); + if (n.place != place) { + if (n == this) n = (PlacedClosure_c) copy(); + n.place = place; + } + return n; + } + + /* @Override + public NodeVisitor typeCheckEnter(TypeChecker v) throws SemanticException { + if (placeTerm != null) { + v = (TypeChecker) v.context(pushPlaceTerm((X10Context) v.context())); + } + return v; + +} +*/ + //XTerm placeTerm; + /** + * The type of the place term. May be Ref or Place. May contain a newly generated + * var, equated to self. The associated constraint must be considered to be in scope + * when examining the body of this PlacedClosure. + */ + // Type placeType; + + public static XConstrainedTerm computePlaceTerm( Expr place, X10Context xc, + X10TypeSystem ts + ) throws SemanticException { + //System.err.println("PlacedClosure_c: Golden! evaluating placeterm for " + this); + Type placeType = place.type(); + XConstraint d = X10TypeMixin.xclause(placeType); + d = (d==null) ? new XConstraint_c() : d.copy(); + XConstraint pc = null; + XTerm term = null; + XConstrainedTerm pt = null; + boolean placeIsPlace = ts.isImplicitCastValid(placeType, ts.Place(), xc); + if (placeIsPlace) { + term = ts.xtypeTranslator().trans(pc, place, xc); + if (term == null) { + term = XConstraint_c.genVar(); + } + try { + pt = XConstrainedTerm.instantiate(d, term); + } catch (XFailure z) { + assert false; + throw new InternalCompilerError("Cannot construct placeTerm from " + + term + " and constraint " + d + "."); + } + } else { + boolean placeIsRef = ts.isImplicitCastValid(placeType, ts.Ref(), xc); + if (placeIsRef) { + XTerm src = ts.xtypeTranslator().trans(pc, place, xc); + if (src == null) { + src = XConstraint_c.genVar(); + } + try { + d= d.substitute(src, d.self()); + pt = XConstrainedTerm.make(ts.locVar(src,xc), d); + } catch (XFailure z) { + assert false; + throw new InternalCompilerError("Cannot construct placeTerm from " + + place + " and constraint " + d + "."); + } + } else + throw new SemanticException( + "Place expression must be of type \"" + + ts.Place() + "\", or " + ts.Ref() + ", not \"" + place.type() + "\".", + place.position()); + } + + return pt; + } + @Override + public Node typeCheckOverride(Node parent, ContextVisitor tc) throws SemanticException { + + X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); + NodeVisitor v = tc.enter(parent, this); + + if (v instanceof PruningVisitor) { + return this; + } + ClosureDef def = (ClosureDef) this.codeDef(); + if (def.placeTerm() == null) { + def.setPlaceTerm(computePlaceTerm((Expr) visitChild(place, v), + (X10Context) tc.context(), ts)); + } + // now that placeTerm is set in this node, continue visiting children + // enterScope will ensure that placeTerm is installed in the context. + + return null; + } + + + public Node typeCheck(ContextVisitor tc) throws SemanticException { + X10Context xc = (X10Context) tc.context(); + if (xc.inSequentialCode()) + throw new SemanticException("at may not be invoked in sequential code.", position()); + Node n = super.typeCheck(tc); + return n; + } + + protected X10Context pushPlaceTerm(X10Context xc) { + ClosureDef def = (ClosureDef) codeDef(); + XConstrainedTerm pt = def.placeTerm(); + if (pt != null) { + xc = (X10Context) xc.pushPlace(pt); + } + return xc; + } + @Override + public Context enterChildScope(Node child, Context c) { + X10Context xc = (X10Context) super.enterChildScope(child, c); + if (child == body) { + xc = pushPlaceTerm(xc); + addDecls(xc); + } + return xc; + } + + /** + * Return the first (sub)term performed when evaluating this + * term. + */ + public Term firstChild() { + return returnType; + } + + /** + * Visit this term in evaluation order. + */ + public List<Term> acceptCFG(CFGBuilder v, List<Term> succs) { + v.visitCFG(returnType, place, ENTRY); + + // If building the CFG for the enclosing code, don't thread + // in the closure body. Otherwise, we're building the CFG + // for the closure itself. + if (! succs.isEmpty()) { + v.visitCFG(place, this, EXIT); + } + else { + v.visitCFG(place, body, ENTRY); + v.visitCFG(body, this, EXIT); + } + + /* + v.visitCFG(returnType, FlowGraph.EDGE_KEY_TRUE, body, ENTRY, + FlowGraph.EDGE_KEY_FALSE, this, EXIT); + */ + return succs; + } + + public Type childExpectedType(Expr child, AscriptionVisitor av) { + X10TypeSystem ts = (X10TypeSystem) av.typeSystem(); + if ( child == place ) { + return ts.Place(); + } + return child.type(); + } + +} Modified: trunk/x10.compiler/src/x10/ast/TypeCheckReturnTypeGoal.java =================================================================== --- trunk/x10.compiler/src/x10/ast/TypeCheckReturnTypeGoal.java 2009-09-11 15:14:23 UTC (rev 11197) +++ trunk/x10.compiler/src/x10/ast/TypeCheckReturnTypeGoal.java 2009-09-11 17:32:38 UTC (rev 11198) @@ -17,6 +17,7 @@ @Override public boolean runTask() { + TypeSystem ts = v.typeSystem(); boolean result = super.runTask(); if (result) { Modified: trunk/x10.compiler/src/x10/ast/UnknownTypeNode_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/UnknownTypeNode_c.java 2009-09-11 15:14:23 UTC (rev 11197) +++ trunk/x10.compiler/src/x10/ast/UnknownTypeNode_c.java 2009-09-11 17:32:38 UTC (rev 11198) @@ -49,7 +49,9 @@ NodeFactory nf = ar.nodeFactory(); // Dereference--this will cause type inference to be performed. + Type t = typeRef().get(); + if (t instanceof UnknownType) { return this; @@ -73,6 +75,6 @@ } public String toString() { - return "_"; + return "(#" + hashCode() + ")_"; } } Modified: trunk/x10.compiler/src/x10/ast/X10Call_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Call_c.java 2009-09-11 15:14:23 UTC (rev 11197) +++ trunk/x10.compiler/src/x10/ast/X10Call_c.java 2009-09-11 17:32:38 UTC (rev 11198) @@ -97,74 +97,85 @@ } - /** - * Looks up a method with given name and argument types. - */ - protected Pair<MethodInstance,List<Expr>> superFindMethod(ContextVisitor tc, X10Context xc, TypeSystem_c.MethodMatcher matcher, List<Type> typeArgs, List<Type> argTypes) throws SemanticException { - // Check for any method with the appropriate name. - // If found, stop the search since it shadows any enclosing - // classes method of the same name. - TypeSystem ts = tc.typeSystem(); - ClassType currentClass = xc.currentClass(); - if (currentClass != null && - ts.hasMethodNamed(currentClass, matcher.name())) { - - // Override to change the type from C to C{self==this}. - Type t = currentClass; - X10TypeSystem xts = (X10TypeSystem) ts; - XRoot thisVar = null; - if (XTypeTranslator.THIS_VAR) { - CodeDef cd = xc.currentCode(); - if (cd instanceof X10MemberDef) { - thisVar = ((X10MemberDef) cd).thisVar(); - } - } - else { -// thisVar = xts.xtypeTranslator().transThis(currentClass); - thisVar = xts.xtypeTranslator().transThisWithoutTypeConstraint(); - } - - if (thisVar != null) - t = X10TypeMixin.setSelfVar(t, thisVar); - - // Found a class that has a method of the right name. - // Now need to check if the method is of the correct type. - - X10MethodInstance mi = null; + /** + * Looks up a method with given name and argument types. + */ + protected Pair<MethodInstance,List<Expr>> superFindMethod(ContextVisitor tc, X10Context xc, + TypeSystem_c.MethodMatcher matcher, List<Type> typeArgs, + List<Type> argTypes) throws SemanticException { + return superFindMethod(tc, xc, matcher, typeArgs, argTypes, null); + } + protected Pair<MethodInstance,List<Expr>> superFindMethod(ContextVisitor tc, X10Context xc, + TypeSystem_c.MethodMatcher matcher, List<Type> typeArgs, + List<Type> argTypes, List<Expr> args) throws SemanticException { + // Check for any method with the appropriate name. + // If found, stop the search since it shadows any enclosing + // classes method of the same name. + TypeSystem ts = tc.typeSystem(); + ClassType currentClass = xc.currentClass(); + if (currentClass != null && + ts.hasMethodNamed(currentClass, matcher.name())) { - // First try to find the method without implicit conversions. - try { - mi = xts.findMethod(t, matcher.container(t)); - return new Pair<MethodInstance, List<Expr>>(mi, this.arguments); - } - catch (SemanticException e) { - // Now, try to find the method with implicit conversions, making them explicit. - try { - Pair<MethodInstance,List<Expr>> p = tryImplicitConversions(this, tc, t, typeArgs, argTypes); - return p; - } - catch (SemanticException e2) { - throw e; - } - } - } + // Override to change the type from C to C{self==this}. + Type t = currentClass; + X10TypeSystem xts = (X10TypeSystem) ts; + XRoot thisVar = null; + if (XTypeTranslator.THIS_VAR) { + CodeDef cd = xc.currentCode(); + if (cd instanceof X10MemberDef) { + thisVar = ((X10MemberDef) cd).thisVar(); + } + } + else { + // thisVar = xts.xtypeTranslator().transThis(currentClass); + thisVar = xts.xtypeTranslator().transThisWithoutTypeConstraint(); + } - if (xc.pop() != null) { - return superFindMethod(tc, (X10Context) xc.pop(), matcher, typeArgs, argTypes); - } + if (thisVar != null) + t = X10TypeMixin.setSelfVar(t, thisVar); - throw new SemanticException("Method " + matcher.signature() + " not found."); - } - + // Found a class that has a method of the right name. + // Now need to check if the method is of the correct type. + + X10MethodInstance mi = null; + + // First try to find the method without implicit conversions. + try { + mi = xts.findMethod(t, matcher.container(t)); + return new Pair<MethodInstance, List<Expr>>(mi, this.arguments); + } + catch (SemanticException e) { + // Now, try to find the method with implicit conversions, making them explicit. + try { + Pair<MethodInstance,List<Expr>> p = tryImplicitConversions(this, tc, t, typeArgs, argTypes); + return p; + } + catch (SemanticException e2) { + throw e; + } + } + } + + if (xc.pop() != null) { + return superFindMethod(tc, (X10Context) xc.pop(), matcher, typeArgs, argTypes); + } + + throw new SemanticException("Method " + matcher.signature() + " not found."); + } + /** * Looks up a method with name "name" and arguments compatible with * "argTypes". */ - protected Pair<MethodInstance,List<Expr>> findMethod(ContextVisitor tc, TypeSystem_c.MethodMatcher matcher, List<Type> typeArgs, List<Type> argTypes) throws SemanticException { + protected Pair<MethodInstance,List<Expr>> findMethod(ContextVisitor tc, TypeSystem_c.MethodMatcher matcher, + List<Type> typeArgs, List<Type> argTypes) throws SemanticException { X10Context xc = (X10Context) tc.context(); - Pair<MethodInstance,List<Expr>> result = xc.currentDepType() == null ? superFindMethod(tc, xc, matcher, typeArgs, argTypes) : superFindMethod(tc, (X10Context) xc.pop(), matcher, typeArgs, argTypes); + Pair<MethodInstance,List<Expr>> result = xc.currentDepType() == null ? + superFindMethod(tc, xc, matcher, typeArgs, argTypes) + : superFindMethod(tc, (X10Context) xc.pop(), matcher, typeArgs, argTypes); return result; } + protected Node typeCheckNullTarget(ContextVisitor tc, List<Type> typeArgs, List<Type> argTypes) throws SemanticException { X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); @@ -416,15 +427,8 @@ // End inlined super call. ///////////////////////////////////////////////////////////////////// - checkProtoMethod(); - - // If we found a method, the call must typecheck - if (X10Flags.toX10Flags(mi.flags()).isRooted() - && ! ((X10Type) target.type()).isRooted()) - throw new SemanticException(mi - + " can only be called on a rooted receiver; " + - target + " is not rooted."); - + result.checkProtoMethod(); + result.checkLocalReceiver(tc); // the arguments here. result.checkConsistency(c); // result = result.adjustMI(tc); @@ -434,6 +438,36 @@ return result; } + + public void checkLocalReceiver( ContextVisitor tc) + throws SemanticException { + X10Flags xFlags = X10Flags.toX10Flags(methodInstance().flags()); + // A global method can be invoked from anywhere. + if (xFlags.isGlobal()) + return; + + // A static method can be invoked from anywhere. + if (xFlags.isStatic()) + return; + + X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); + X10Context xc = (X10Context) tc.context(); + + Receiver target = target(); + + // Method invocations on structs and values are always permitted + if (! ts.isSubtype(target.type(), ts.Ref(), xc)) + return; + + + if (ts.isHere(target, xc)) + return; + + throw new SemanticError("Place type error: method target " + + target + " cannot be determined to be at " + xc.currentPlaceTerm(), + position()); + } + static Pair<MethodInstance,List<Expr>> tryImplicitConversions(final X10Call_c n, ContextVisitor tc, Type targetType, List<Type> typeArgs, List<Type> argTypes) throws SemanticException { final X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); final Context context = tc.context(); Modified: trunk/x10.compiler/src/x10/ast/X10ClassBody_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ClassBody_c.java 2009-09-11 15:14:23 UTC (rev 11197) +++ trunk/x10.compiler/src/x10/ast/X10ClassBody_c.java 2009-09-11 17:32:38 UTC (rev 11198) @@ -39,6 +39,9 @@ import polyglot.util.TypedList; import polyglot.visit.ContextVisitor; import polyglot.ast.ClassBody_c; +import x10.constraint.XConstrainedTerm; +import x10.constraint.XRoot; +import x10.types.ClosureDef; import x10.types.MacroType; import x10.types.ParameterType; import x10.types.TypeConstraint; @@ -81,7 +84,7 @@ } } } - + private void checkMethodCompatibility(ContextVisitor tc) throws SemanticException { X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); Modified: trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2009-09-11 15:14:23 UTC (rev 11197) +++ trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2009-09-11 17:32:38 UTC (rev 11198) @@ -76,9 +76,12 @@ import polyglot.visit.TypeBuilder; import polyglot.visit.TypeCheckPreparer; import polyglot.visit.TypeChecker; +import x10.constraint.XConstrainedTerm; import x10.constraint.XConstraint; import x10.constraint.XConstraint_c; import x10.constraint.XFailure; +import x10.constraint.XRoot; +import x10.constraint.XTerm; import x10.extension.X10Del; import x10.extension.X10Del_c; import x10.types.MacroType; @@ -89,6 +92,7 @@ import x10.types.X10ClassDef_c; import x10.types.X10ClassType; import x10.types.X10Context; +import x10.types.X10Def; import x10.types.X10FieldInstance; import x10.types.X10Flags; import x10.types.X10MethodDef; @@ -325,72 +329,80 @@ } public Context enterChildScope(Node child, Context c) { X10Context xc = (X10Context) c; - if (child != this.body) { - X10ClassDef_c type = (X10ClassDef_c) this.type; - xc = xc.pushSuperTypeDeclaration(type); - - // Add this class to the context, but don't push a class scope. - // This allows us to detect loops in the inheritance - // hierarchy, but avoids an infinite loop. - xc = (X10Context) xc.pushBlock(); - xc.addNamed(type.asType()); - - // Add type parameters - for (ParameterType t : type.typeParameters()) { - xc.addNamed(t); - } - - for (PropertyDecl pd : properties) { - FieldDef fd = pd.fieldDef(); - xc.addVariable(fd.asInstance()); - } - -// for (ClassMember cm : body.members()) { -// if (cm instanceof PropertyDecl) { -// PropertyDecl pd = (PropertyDecl) cm; -// FieldDef fd = pd.fieldDef(); -// xc.addVariable(fd.asInstance()); -// } -// } - -// for (FieldDef f : type.properties()) { -// xc.addVariable(f.asInstance()); -// } - - return child.del().enterScope(xc); - } - -// if (child == this.classInvariant) { -// X10ClassDef_c type = (X10ClassDef_c) this.type; -// xc = (X10Context) xc.pushClass(type, type.asType()); -// // Add type parameters -// for (ParameterType t : type.typeParameters()) { -// xc.addNamed(t); -// } -// return child.del().enterScope(xc); -// } - - if (child == this.body) { - X10ClassDef_c type = (X10ClassDef_c) this.type; - xc = (X10Context) xc.pushClass(type, type.asType()); - // Add type parameters - for (ParameterType t : type.typeParameters()) { - ... [truncated message content] |
From: <dgr...@us...> - 2009-09-11 20:21:28
|
Revision: 11203 http://x10.svn.sourceforge.net/x10/?rev=11203&view=rev Author: dgrove-oss Date: 2009-09-11 20:21:16 +0000 (Fri, 11 Sep 2009) Log Message: ----------- Major hacks to get C++ backend more or less working after the place-check commit. The basic idea is that we tread struct as a synonym for value until struct codegen is more complete. Pretty much everything in this commit needs to be backed out as soon as struct codegen is more complete. Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/visit/Emitter.java trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.runtime/src-cpp/Makefile trunk/x10.runtime/src-x10/x10/lang/Primitive.x10 Added Paths: ----------- trunk/x10.runtime/src-cpp/x10/lang/Primitive.cc trunk/x10.runtime/src-cpp/x10/lang/Primitive.h Modified: trunk/x10.compiler/src/x10cpp/visit/Emitter.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/Emitter.java 2009-09-11 17:58:32 UTC (rev 11202) +++ trunk/x10.compiler/src/x10cpp/visit/Emitter.java 2009-09-11 20:21:16 UTC (rev 11203) @@ -240,7 +240,7 @@ // } else if (type.isClass()) { X10ClassType ct = (X10ClassType) type.toClass(); - if (ct.isX10Struct()) { + if (false && ct.isX10Struct()) { // HACK: treating sturcts as values. // Struct types are not boxed up as Refs. They are always generated as just C++ class types // (Note: not pointer to Class, but the actual class). asRef = false; Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2009-09-11 17:58:32 UTC (rev 11202) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2009-09-11 20:21:16 UTC (rev 11203) @@ -1020,9 +1020,10 @@ if (currentClass.flags().isInterface()) { visitInterfaceBody(n, context, currentClass, superClass, xts); - } else if (xts.isValueType(currentClass, context)) { + } else if (xts.isValueType(currentClass, context) || currentClass.isX10Struct()) { // HACK: treating sturcts as values. visitValueBody(n, context, currentClass, superClass, xts); } else if (currentClass.isX10Struct()) { + assert false : "unreachable code due to structs as values hack"; context.setGeneratingSturct(true); visitStructBody(n, context, currentClass, superClass, xts); context.setGeneratingSturct(false); @@ -1256,14 +1257,16 @@ sw.begin(0); sw.write("if (p0.operator->() == this) return true; // short-circuit trivial equality"); sw.newline(); - sw.write("if (!this->" + emitter.translateType(superClass) - + "::" + mangled_method_name(STRUCT_EQUALS_METHOD) - + "(p0))"); - sw.newline(4); - sw.begin(0); - sw.write("return false;"); - sw.end(); - sw.newline(); + if (superClass != null) { // HACK: treating structs as values. + sw.write("if (!this->" + emitter.translateType(superClass) + + "::" + mangled_method_name(STRUCT_EQUALS_METHOD) + + "(p0))"); + sw.newline(4); + sw.begin(0); + sw.write("return false;"); + sw.end(); + sw.newline(); + } emitter.printType(currentClass, sw); sw.write(" that ="); sw.allowBreak(4, " "); @@ -2405,7 +2408,7 @@ } if (!isInterfaceInvoke) { - boolean needsCheck = !((X10Type)t).isX10Struct(); + boolean needsCheck = true || !((X10Type)t).isX10Struct(); // HACK: treating sturcts as values. sw.write(needsCheck ? "x10aux::placeCheck(x10aux::nullCheck(" : "("); n.printSubExpr((Expr) target, assoc, sw, tr); sw.write((needsCheck ? "))" : ")")+"->"); @@ -2532,7 +2535,7 @@ sw.end(); return; } else { - boolean needsChecks = !((X10Type)t).isX10Struct(); + boolean needsChecks = true || !((X10Type)t).isX10Struct(); // HACK: treating sturcts as values. boolean assoc = !(target instanceof New_c || target instanceof Binary_c); if (needsChecks) sw.write("x10aux::placeCheck(x10aux::nullCheck("); n.printSubExpr((Expr) target, assoc, sw, tr); @@ -3074,7 +3077,7 @@ sw.write(SAVED_THIS); context.saveEnvVariableInfo(THIS); } else { - if (((X10Type)n.type()).isX10Struct()) { + if (false && ((X10Type)n.type()).isX10Struct()) { // HACK: treating sturcts as values. sw.write("("+n.kind()+")"); } else { sw.write("(("+emitter.translateType(n.type(),true)+")"+n.kind()+")"); Modified: trunk/x10.runtime/src-cpp/Makefile =================================================================== --- trunk/x10.runtime/src-cpp/Makefile 2009-09-11 17:58:32 UTC (rev 11202) +++ trunk/x10.runtime/src-cpp/Makefile 2009-09-11 20:21:16 UTC (rev 11203) @@ -193,6 +193,7 @@ x10/lang/Box.o \ x10/lang/Fun.o \ x10/lang/Object.o \ + x10/lang/Primitive.o \ x10/lang/Rail.o \ x10/lang/RailIterator.o \ x10/lang/Ref.o \ Added: trunk/x10.runtime/src-cpp/x10/lang/Primitive.cc =================================================================== --- trunk/x10.runtime/src-cpp/x10/lang/Primitive.cc (rev 0) +++ trunk/x10.runtime/src-cpp/x10/lang/Primitive.cc 2009-09-11 20:21:16 UTC (rev 11203) @@ -0,0 +1,51 @@ +#include <x10/lang/Primitive.h> + +void x10::lang::Primitive::_instance_init() { + _I_("Doing initialisation for class: x10::lang::Primitive"); + +} + + +//#line 3 "/home/dgrove/x10-trunk/x10.runtime/src-x10/x10/lang/Primitive.x10" +void x10::lang::Primitive::_constructor() { + this->x10::lang::Value::_constructor(); + +} + +x10_boolean x10::lang::Primitive::_struct_equals(x10aux::ref<x10::lang::Object> p0) { + if (p0.operator->() == this) return true; // short-circuit trivial equality + if (!this->x10::lang::Value::_struct_equals(p0)) + return false; + x10aux::ref<x10::lang::Primitive> that = (x10aux::ref<x10::lang::Primitive>) p0; + return true; +} +void x10::lang::Primitive::_static_init() { + static bool done = false; + if (done) return; + done = true; + _I_("Doing static initialisation for class: x10::lang::Primitive"); + x10::lang::Value::_static_init(); + +} + +const x10aux::serialization_id_t x10::lang::Primitive::_serialization_id = + x10aux::DeserializationDispatcher::addDeserializer(x10::lang::Primitive::_deserializer<x10::lang::Object>); + +void x10::lang::Primitive::_serialize_body(x10aux::serialization_buffer& buf, x10aux::addr_map& m) { + x10::lang::Value::_serialize_body(buf, m); + +} + +void x10::lang::Primitive::_deserialize_body(x10aux::deserialization_buffer& buf) { + x10::lang::Value::_deserialize_body(buf); + +} + +x10aux::RuntimeType x10::lang::Primitive::rtt; +void x10::lang::Primitive::_initRTT() { + rtt.canonical = &rtt; + const x10aux::RuntimeType* parents[1] = { x10aux::getRTT<x10::lang::Value>()}; + rtt.init(&rtt, "x10.lang.Primitive", 1, parents, 0, NULL, NULL); +} + +extern "C" const char* LNMAP_x10_lang_Primitive_cc = "N{\"x10/lang/Primitive.cc\"} F{0:\"/home/dgrove/x10-trunk/x10.runtime/src-x10/x10/lang/Primitive.x10\",1:\"x10.lang.Primitive\",2:\"this\",3:\"\",4:\"x10::lang::Primitive\",5:\"_constructor\",6:\"void\",} L{13->0:3,} M{6 4.5()->3 1.2();}"; Added: trunk/x10.runtime/src-cpp/x10/lang/Primitive.h =================================================================== --- trunk/x10.runtime/src-cpp/x10/lang/Primitive.h (rev 0) +++ trunk/x10.runtime/src-cpp/x10/lang/Primitive.h 2009-09-11 20:21:16 UTC (rev 11203) @@ -0,0 +1,62 @@ +// HACK! HACK! HACK! +// NativeRep Primitive to be a sub-class of Value + +#ifndef __X10_LANG_PRIMITIVE_H +#define __X10_LANG_PRIMITIVE_H + +#include <x10rt17.h> + +#define X10_LANG_VALUE_H_NODEPS +#include <x10/lang/Value.h> +#undef X10_LANG_VALUE_H_NODEPS +namespace x10 { namespace lang { + +class Primitive : public x10::lang::Value { + public: + RTT_H_DECLS_CLASS + + void _instance_init(); + + static x10aux::ref<x10::lang::Primitive> _make() { + x10aux::ref<x10::lang::Primitive> this_ = new (x10aux::alloc<x10::lang::Primitive>()) x10::lang::Primitive(); + this_->_constructor(); + return this_; + } + void _constructor(); + + public: virtual x10_boolean _struct_equals(x10aux::ref<x10::lang::Object> p0); + public : static void _static_init(); + + // Serialization + public: static const x10aux::serialization_id_t _serialization_id; + + public: virtual x10aux::serialization_id_t _get_serialization_id() { + return _serialization_id; + } + + public: virtual void _serialize_body(x10aux::serialization_buffer& buf, x10aux::addr_map& m); + + public: template<class __T> static x10aux::ref<__T> _deserializer(x10aux::deserialization_buffer& buf) { + x10aux::ref<x10::lang::Primitive> this_ = new (x10aux::alloc<x10::lang::Primitive >()) x10::lang::Primitive(); + this_->_deserialize_body(buf); + return this_; + } + + public: void _deserialize_body(x10aux::deserialization_buffer& buf); + +}; + +} } +#endif // X10_LANG_PRIMITIVE_H + +namespace x10 { namespace lang { + class Primitive; +} } + +#ifndef X10_LANG_PRIMITIVE_H_NODEPS +#define X10_LANG_PRIMITIVE_H_NODEPS +#include <x10/lang/Value.h> +#ifndef X10_LANG_PRIMITIVE_H_GENERICS +#define X10_LANG_PRIMITIVE_H_GENERICS +#endif // X10_LANG_PRIMITIVE_H_GENERICS +#endif // __X10_LANG_PRIMITIVE_H_NODEPS Modified: trunk/x10.runtime/src-x10/x10/lang/Primitive.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Primitive.x10 2009-09-11 17:58:32 UTC (rev 11202) +++ trunk/x10.runtime/src-x10/x10/lang/Primitive.x10 2009-09-11 20:21:16 UTC (rev 11203) @@ -8,4 +8,7 @@ package x10.lang; +import x10.compiler.NativeRep; + +@NativeRep("c++", "x10aux::ref<x10::lang::Primitive>", "x10::lang::Primitive", null) // HACK: pretend structs are values public abstract struct Primitive {} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vj...@us...> - 2009-09-12 14:32:52
|
Revision: 11205 http://x10.svn.sourceforge.net/x10/?rev=11205&view=rev Author: vj0 Date: 2009-09-12 14:32:43 +0000 (Sat, 12 Sep 2009) Log Message: ----------- Implemented ! and ! expr suffixes to types: NamedType ::= TypeName TypeArgumentsopt Argumentsopt DepParametersopt DepParameters ::= { ExistentialListopt Conjunction } | ! PlaceType | ! | ! PlaceType { ExistentialListopt Conjunction } | ! { ExistentialListopt Conjunction } In the process of converting all the code in XRX to use !s instead of the clunky {self.at(here)}, {self.at(this)} etc. Added some tests. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java trunk/x10.compiler/src/x10/ast/X10NodeFactory.java trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java trunk/x10.compiler/src/x10/parser/X10Parser.java trunk/x10.compiler/src/x10/parser/X10Parserprs.java trunk/x10.compiler/src/x10/parser/X10Parsersym.java trunk/x10.compiler/src/x10/parser/x10.g trunk/x10.compiler/src/x10/types/X10Context_c.java trunk/x10.constraints/src/x10/constraint/XFormula_c.java trunk/x10.runtime/src-x10/x10/array/BaseArray.x10 trunk/x10.runtime/src-x10/x10/array/BaseDist.x10 trunk/x10.runtime/src-x10/x10/array/DistArray.x10 trunk/x10.runtime/src-x10/x10/array/PolyRegion.x10 trunk/x10.runtime/src-x10/x10/array/PolyScanner.x10 trunk/x10.runtime/src-x10/x10/runtime/PlaceLocalHandle.x10 trunk/x10.runtime/src-x10/x10/runtime/PlaceLocalStorage.x10 trunk/x10.tests/examples/x10lib/harness/x10Test.x10 Added Paths: ----------- trunk/x10.compiler/src/x10/ast/AmbHereThis_c.java trunk/x10.tests/examples/Constructs/Place/B_AtThisIntoAtHere.x10 trunk/x10.tests/examples/Constructs/Place/B_AtThisIntoAtHere_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Place/B_CheckThisTypeInCall.x10 trunk/x10.tests/examples/Constructs/Place/B_CheckThisTypeInCallMacro.x10 Added: trunk/x10.compiler/src/x10/ast/AmbHereThis_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AmbHereThis_c.java (rev 0) +++ trunk/x10.compiler/src/x10/ast/AmbHereThis_c.java 2009-09-12 14:32:43 UTC (rev 11205) @@ -0,0 +1,43 @@ +package x10.ast; + +import java.util.List; + +import polyglot.ast.Expr_c; +import polyglot.ast.Node; +import polyglot.ast.Receiver; +import polyglot.ast.Term; +import polyglot.types.SemanticException; +import polyglot.util.Position; +import polyglot.visit.CFGBuilder; +import polyglot.visit.ContextVisitor; + +public class AmbHereThis_c extends Expr_c { + + public AmbHereThis_c(Position pos) { + super(pos); + } + + /** + * Visit this term in evaluation order. + */ + @Override + public List acceptCFG(CFGBuilder v, List succs) { + return succs; + } + + public Term firstChild() { + return null; + } + + /** Disambiguate the receiver. */ + public Node disambiguate(ContextVisitor ar) throws SemanticException { + X10NodeFactory nf = ((X10NodeFactory) ar.nodeFactory()); + return (ar.context().inCode()) + ? nf.Here(position()) + : nf.This(position()); + } + + public String toString() { + return "hereOrThis"; + } +} Modified: trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java 2009-09-11 20:55:26 UTC (rev 11204) +++ trunk/x10.compiler/src/x10/ast/X10FieldDecl_c.java 2009-09-12 14:32:43 UTC (rev 11205) @@ -63,6 +63,13 @@ super(pos, flags, type, name, init); } + @Override + public Context enterScope(Context c) { + if (ii != null) { + return c.pushCode(ii); + } + return c; + } public Context enterChildScope(Node child, Context c) { if (child == this.type) { X10Context xc = (X10Context) c.pushBlock(); Modified: trunk/x10.compiler/src/x10/ast/X10NodeFactory.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10NodeFactory.java 2009-09-11 20:55:26 UTC (rev 11204) +++ trunk/x10.compiler/src/x10/ast/X10NodeFactory.java 2009-09-12 14:32:43 UTC (rev 11205) @@ -55,6 +55,7 @@ /** Return the language extension this node factory is for. */ ExtensionInfo extensionInfo(); + Expr AmbHereThis(Position pos) ; AtStmt AtStmt(Position pos, Expr place, Stmt body); AtExpr AtExpr(Position pos, Expr place, TypeNode returnType, Block body); Modified: trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2009-09-11 20:55:26 UTC (rev 11204) +++ trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2009-09-12 14:32:43 UTC (rev 11205) @@ -117,8 +117,13 @@ return new X10Disamb_c(); } + public Expr AmbHereThis(Position pos) { + Expr n = new AmbHereThis_c(pos); + n = (Expr)n.ext(extFactory().extAmbExpr()); + n = (Expr)n.del(delFactory().delAmbExpr()); + return n; + } - @Override public polyglot.ast.Initializer Initializer(Position pos, FlagsNode flags, Block body) { Initializer n = new X10Initializer_c(pos, flags, body); Modified: trunk/x10.compiler/src/x10/parser/X10Parser.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10Parser.java 2009-09-11 20:55:26 UTC (rev 11204) +++ trunk/x10.compiler/src/x10/parser/X10Parser.java 2009-09-12 14:32:43 UTC (rev 11205) @@ -2043,82 +2043,106 @@ } // - // Rule 61: DepParameters ::= { ExistentialListopt Conjunction } ! + // Rule 61: DepParameters ::= ! PlaceType // case 61: { //#line 1346 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" //#line 1344 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" - List ExistentialListopt = (List) getRhsSym(2); - //#line 1344 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" - List Conjunction = (List) getRhsSym(3); + Expr PlaceType = (Expr) getRhsSym(2); //#line 1346 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - setResult(nf.DepParameterExpr(pos(), ExistentialListopt, Conjunction)); + Expr placeClause = nf.Call(pos(), nf.Self(pos()), nf.Id(pos(), "at"), PlaceType); + setResult(nf.DepParameterExpr(pos(), null, Collections.singletonList(placeClause))); break; } // - // Rule 62: DepParameters ::= { ExistentialListopt Conjunction } ! PlaceType + // Rule 62: DepParameters ::= ! // case 62: { - //#line 1351 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1349 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" - List ExistentialListopt = (List) getRhsSym(2); - //#line 1349 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" - List Conjunction = (List) getRhsSym(3); - //#line 1349 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" - Expr PlaceType = (Expr) getRhsSym(6); - //#line 1351 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - if (PlaceType != null) - setResult(nf.DepParameterExpr(pos(), ExistentialListopt, CollectionUtil.append(Conjunction, Collections.singletonList(PlaceType)))); - else - setResult(nf.DepParameterExpr(pos(), ExistentialListopt, Conjunction)); + //#line 1352 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + + //#line 1352 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + Expr placeClause = nf.Call(pos(), nf.Self(pos()), nf.Id(pos(), "at"), nf.AmbHereThis(pos())); + setResult(nf.DepParameterExpr(pos(), null, Collections.singletonList(placeClause))); break; } // - // Rule 63: TypeParamsWithVariance ::= [ TypeParamWithVarianceList ] + // Rule 63: DepParameters ::= ! PlaceType { ExistentialListopt Conjunction } // case 63: { - //#line 1360 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1358 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1358 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1356 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + Expr PlaceType = (Expr) getRhsSym(2); + //#line 1356 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + List ExistentialListopt = (List) getRhsSym(4); + //#line 1356 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + List Conjunction = (List) getRhsSym(5); + //#line 1358 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + Expr placeClause = nf.Call(pos(), nf.Self(pos()), nf.Id(pos(), "at"), PlaceType); + setResult(nf.DepParameterExpr(pos(), ExistentialListopt, CollectionUtil.append(Conjunction, Collections.singletonList(placeClause)))); + break; + } + + // + // Rule 64: DepParameters ::= ! { ExistentialListopt Conjunction } + // + case 64: { + //#line 1364 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1362 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + List ExistentialListopt = (List) getRhsSym(3); + //#line 1362 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + List Conjunction = (List) getRhsSym(4); + //#line 1364 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + Expr placeClause = nf.Call(pos(), nf.Self(pos()), nf.Id(pos(), "at"), nf.AmbHereThis(pos())); + setResult(nf.DepParameterExpr(pos(), ExistentialListopt, CollectionUtil.append(Conjunction, Collections.singletonList(placeClause)))); + break; + } + + // + // Rule 65: TypeParamsWithVariance ::= [ TypeParamWithVarianceList ] + // + case 65: { + //#line 1372 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1370 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List TypeParamWithVarianceList = (List) getRhsSym(2); - //#line 1360 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1372 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(TypeParamWithVarianceList); break; } // - // Rule 64: TypeParameters ::= [ TypeParameterList ] + // Rule 66: TypeParameters ::= [ TypeParameterList ] // - case 64: { - //#line 1366 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1364 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 66: { + //#line 1378 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1376 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List TypeParameterList = (List) getRhsSym(2); - //#line 1366 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1378 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(TypeParameterList); break; } // - // Rule 65: FormalParameters ::= ( FormalParameterListopt ) + // Rule 67: FormalParameters ::= ( FormalParameterListopt ) // - case 65: { - //#line 1371 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1369 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 67: { + //#line 1383 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1381 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List FormalParameterListopt = (List) getRhsSym(2); - //#line 1371 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1383 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(FormalParameterListopt); break; } // - // Rule 66: Conjunction ::= Expression + // Rule 68: Conjunction ::= Expression // - case 66: { - //#line 1377 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1375 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 68: { + //#line 1389 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1387 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expression = (Expr) getRhsSym(1); - //#line 1377 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1389 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" List l = new ArrayList(); l.add(Expression); setResult(l); @@ -2126,90 +2150,90 @@ } // - // Rule 67: Conjunction ::= Conjunction , Expression + // Rule 69: Conjunction ::= Conjunction , Expression // - case 67: { - //#line 1384 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1382 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 69: { + //#line 1396 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1394 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List Conjunction = (List) getRhsSym(1); - //#line 1382 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1394 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expression = (Expr) getRhsSym(3); - //#line 1384 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1396 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" Conjunction.add(Expression); break; } // - // Rule 68: SubtypeConstraint ::= Type$t1 <: Type$t2 + // Rule 70: SubtypeConstraint ::= Type$t1 <: Type$t2 // - case 68: { - //#line 1390 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1388 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 70: { + //#line 1402 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1400 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" TypeNode t1 = (TypeNode) getRhsSym(1); - //#line 1388 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1400 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" TypeNode t2 = (TypeNode) getRhsSym(3); - //#line 1390 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1402 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.SubtypeTest(pos(), t1, t2, false)); break; } // - // Rule 69: SubtypeConstraint ::= Type$t1 :> Type$t2 + // Rule 71: SubtypeConstraint ::= Type$t1 :> Type$t2 // - case 69: { - //#line 1395 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1393 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 71: { + //#line 1407 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1405 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" TypeNode t1 = (TypeNode) getRhsSym(1); - //#line 1393 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1405 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" TypeNode t2 = (TypeNode) getRhsSym(3); - //#line 1395 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1407 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.SubtypeTest(pos(), t2, t1, false)); break; } // - // Rule 70: WhereClause ::= DepParameters + // Rule 72: WhereClause ::= DepParameters // - case 70: { - //#line 1401 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1399 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 72: { + //#line 1413 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1411 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" DepParameterExpr DepParameters = (DepParameterExpr) getRhsSym(1); - //#line 1401 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1413 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(DepParameters); break; } // - // Rule 71: ExistentialListopt ::= $Empty + // Rule 73: ExistentialListopt ::= $Empty // - case 71: { - //#line 1407 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + case 73: { + //#line 1419 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1407 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1419 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new ArrayList()); break; } // - // Rule 72: ExistentialListopt ::= ExistentialList ; + // Rule 74: ExistentialListopt ::= ExistentialList ; // - case 72: { - //#line 1412 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1410 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 74: { + //#line 1424 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1422 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List ExistentialList = (List) getRhsSym(1); - //#line 1412 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1424 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(ExistentialList); break; } // - // Rule 73: ExistentialList ::= FormalParameter + // Rule 75: ExistentialList ::= FormalParameter // - case 73: { - //#line 1418 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1416 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 75: { + //#line 1430 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1428 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" X10Formal FormalParameter = (X10Formal) getRhsSym(1); - //#line 1418 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1430 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" List l = new TypedList(new LinkedList(), Formal.class, false); l.add(FormalParameter.flags(nf.FlagsNode(pos(), Flags.FINAL))); setResult(l); @@ -2217,41 +2241,41 @@ } // - // Rule 74: ExistentialList ::= ExistentialList ; FormalParameter + // Rule 76: ExistentialList ::= ExistentialList ; FormalParameter // - case 74: { - //#line 1425 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1423 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 76: { + //#line 1437 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1435 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List ExistentialList = (List) getRhsSym(1); - //#line 1423 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1435 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" X10Formal FormalParameter = (X10Formal) getRhsSym(3); - //#line 1425 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1437 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" ExistentialList.add(FormalParameter.flags(nf.FlagsNode(pos(), Flags.FINAL))); break; } // - // Rule 77: NormalClassDeclaration ::= ClassModifiersopt class Identifier TypeParamsWithVarianceopt Propertiesopt WhereClauseopt Superopt Interfacesopt ClassBody + // Rule 79: NormalClassDeclaration ::= ClassModifiersopt class Identifier TypeParamsWithVarianceopt Propertiesopt WhereClauseopt Superopt Interfacesopt ClassBody // - case 77: { - //#line 1436 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1434 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 79: { + //#line 1448 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1446 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List ClassModifiersopt = (List) getRhsSym(1); - //#line 1434 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1446 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(3); - //#line 1434 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1446 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List TypeParamsWithVarianceopt = (List) getRhsSym(4); - //#line 1434 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1446 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List Propertiesopt = (List) getRhsSym(5); - //#line 1434 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1446 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(6); - //#line 1434 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1446 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" TypeNode Superopt = (TypeNode) getRhsSym(7); - //#line 1434 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1446 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List Interfacesopt = (List) getRhsSym(8); - //#line 1434 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1446 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" ClassBody ClassBody = (ClassBody) getRhsSym(9); - //#line 1436 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1448 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" checkTypeName(Identifier); List TypeParametersopt = TypeParamsWithVarianceopt; List/*<PropertyDecl>*/ props = Propertiesopt; @@ -2266,27 +2290,27 @@ } // - // Rule 78: ValueClassDeclaration ::= ClassModifiersopt value Identifier TypeParamsWithVarianceopt Propertiesopt WhereClauseopt Superopt Interfacesopt ClassBody + // Rule 80: ValueClassDeclaration ::= ClassModifiersopt value Identifier TypeParamsWithVarianceopt Propertiesopt WhereClauseopt Superopt Interfacesopt ClassBody // - case 78: { - //#line 1451 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1449 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 80: { + //#line 1463 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1461 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List ClassModifiersopt = (List) getRhsSym(1); - //#line 1449 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1461 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(3); - //#line 1449 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1461 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List TypeParamsWithVarianceopt = (List) getRhsSym(4); - //#line 1449 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1461 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List Propertiesopt = (List) getRhsSym(5); - //#line 1449 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1461 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(6); - //#line 1449 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1461 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" TypeNode Superopt = (TypeNode) getRhsSym(7); - //#line 1449 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1461 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List Interfacesopt = (List) getRhsSym(8); - //#line 1449 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1461 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" ClassBody ClassBody = (ClassBody) getRhsSym(9); - //#line 1451 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1463 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" checkTypeName(Identifier); List TypeParametersopt = TypeParamsWithVarianceopt; List props = Propertiesopt; @@ -2300,27 +2324,27 @@ } // - // Rule 79: ValueClassDeclaration ::= ClassModifiersopt struct Identifier TypeParamsWithVarianceopt Propertiesopt WhereClauseopt Superopt Interfacesopt ClassBody + // Rule 81: ValueClassDeclaration ::= ClassModifiersopt struct Identifier TypeParamsWithVarianceopt Propertiesopt WhereClauseopt Superopt Interfacesopt ClassBody // - case 79: { - //#line 1465 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1463 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 81: { + //#line 1477 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1475 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List ClassModifiersopt = (List) getRhsSym(1); - //#line 1463 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1475 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(3); - //#line 1463 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1475 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List TypeParamsWithVarianceopt = (List) getRhsSym(4); - //#line 1463 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1475 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List Propertiesopt = (List) getRhsSym(5); - //#line 1463 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1475 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(6); - //#line 1463 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1475 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" TypeNode Superopt = (TypeNode) getRhsSym(7); - //#line 1463 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1475 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List Interfacesopt = (List) getRhsSym(8); - //#line 1463 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1475 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" ClassBody ClassBody = (ClassBody) getRhsSym(9); - //#line 1465 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1477 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" checkTypeName(Identifier); List TypeParametersopt = TypeParamsWithVarianceopt; List props = Propertiesopt; @@ -2334,25 +2358,25 @@ } // - // Rule 80: ConstructorDeclaration ::= ConstructorModifiersopt def this TypeParametersopt FormalParameters WhereClauseopt ResultTypeopt Throwsopt ConstructorBody + // Rule 82: ConstructorDeclaration ::= ConstructorModifiersopt def this TypeParametersopt FormalParameters WhereClauseopt ResultTypeopt Throwsopt ConstructorBody // - case 80: { - //#line 1479 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1477 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 82: { + //#line 1491 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1489 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List ConstructorModifiersopt = (List) getRhsSym(1); - //#line 1477 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1489 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List TypeParametersopt = (List) getRhsSym(4); - //#line 1477 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1489 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List FormalParameters = (List) getRhsSym(5); - //#line 1477 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1489 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(6); - //#line 1477 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1489 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" TypeNode ResultTypeopt = (TypeNode) getRhsSym(7); - //#line 1477 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1489 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List Throwsopt = (List) getRhsSym(8); - //#line 1477 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1489 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Block ConstructorBody = (Block) getRhsSym(9); - //#line 1479 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1491 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" ConstructorDecl cd = nf.X10ConstructorDecl(pos(), extractFlags(ConstructorModifiersopt), nf.Id(pos(3), "this"), @@ -2368,84 +2392,84 @@ } // - // Rule 81: Super ::= extends ClassType + // Rule 83: Super ::= extends ClassType // - case 81: { - //#line 1495 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1493 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 83: { + //#line 1507 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1505 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" TypeNode ClassType = (TypeNode) getRhsSym(2); - //#line 1495 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1507 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(ClassType); break; } // - // Rule 82: FieldKeyword ::= val + // Rule 84: FieldKeyword ::= val // - case 82: { - //#line 1501 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + case 84: { + //#line 1513 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1501 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1513 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(Collections.singletonList(nf.FlagsNode(pos(), Flags.FINAL))); break; } // - // Rule 83: FieldKeyword ::= var + // Rule 85: FieldKeyword ::= var // - case 83: { - //#line 1506 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + case 85: { + //#line 1518 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1506 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1518 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(Collections.singletonList(nf.FlagsNode(pos(), Flags.NONE))); break; } // - // Rule 84: FieldKeyword ::= const + // Rule 86: FieldKeyword ::= const // - case 84: { - //#line 1511 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + case 86: { + //#line 1523 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1511 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1523 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(Collections.singletonList(nf.FlagsNode(pos(), Flags.FINAL.Static()))); break; } // - // Rule 85: VarKeyword ::= val + // Rule 87: VarKeyword ::= val // - case 85: { - //#line 1519 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + case 87: { + //#line 1531 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1519 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1531 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(Collections.singletonList(nf.FlagsNode(pos(), Flags.FINAL))); break; } // - // Rule 86: VarKeyword ::= var + // Rule 88: VarKeyword ::= var // - case 86: { - //#line 1524 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + case 88: { + //#line 1536 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1524 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1536 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(Collections.singletonList(nf.FlagsNode(pos(), Flags.NONE))); break; } // - // Rule 87: FieldDeclaration ::= FieldModifiersopt FieldKeyword FieldDeclarators ; + // Rule 89: FieldDeclaration ::= FieldModifiersopt FieldKeyword FieldDeclarators ; // - case 87: { - //#line 1531 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1529 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 89: { + //#line 1543 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1541 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List FieldModifiersopt = (List) getRhsSym(1); - //#line 1529 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1541 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List FieldKeyword = (List) getRhsSym(2); - //#line 1529 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1541 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List FieldDeclarators = (List) getRhsSym(3); - //#line 1531 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1543 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" FlagsNode fn = extractFlags(FieldModifiersopt, FieldKeyword); List l = new TypedList(new LinkedList(), ClassMember.class, false); @@ -2469,15 +2493,15 @@ } // - // Rule 88: FieldDeclaration ::= FieldModifiersopt FieldDeclarators ; + // Rule 90: FieldDeclaration ::= FieldModifiersopt FieldDeclarators ; // - case 88: { - //#line 1555 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1553 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 90: { + //#line 1567 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1565 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List FieldModifiersopt = (List) getRhsSym(1); - //#line 1553 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1565 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List FieldDeclarators = (List) getRhsSym(2); - //#line 1555 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1567 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" List FieldKeyword = Collections.singletonList(nf.FlagsNode(pos(), Flags.FINAL)); FlagsNode fn = extractFlags(FieldModifiersopt, FieldKeyword); @@ -2502,68 +2526,68 @@ } // - // Rule 118: IfThenStatement ::= if ( Expression ) Statement + // Rule 120: IfThenStatement ::= if ( Expression ) Statement // - case 118: { - //#line 1614 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1612 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 120: { + //#line 1626 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1624 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expression = (Expr) getRhsSym(3); - //#line 1612 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1624 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Stmt Statement = (Stmt) getRhsSym(5); - //#line 1614 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1626 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.If(pos(), Expression, Statement)); break; } // - // Rule 119: IfThenElseStatement ::= if ( Expression ) Statement$s1 else Statement$s2 + // Rule 121: IfThenElseStatement ::= if ( Expression ) Statement$s1 else Statement$s2 // - case 119: { - //#line 1620 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1618 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 121: { + //#line 1632 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1630 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expression = (Expr) getRhsSym(3); - //#line 1618 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1630 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Stmt s1 = (Stmt) getRhsSym(5); - //#line 1618 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1630 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Stmt s2 = (Stmt) getRhsSym(7); - //#line 1620 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1632 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.If(pos(), Expression, s1, s2)); break; } // - // Rule 120: EmptyStatement ::= ; + // Rule 122: EmptyStatement ::= ; // - case 120: { - //#line 1626 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + case 122: { + //#line 1638 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1626 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1638 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Empty(pos())); break; } // - // Rule 121: LabeledStatement ::= Identifier : LoopStatement + // Rule 123: LabeledStatement ::= Identifier : LoopStatement // - case 121: { - //#line 1632 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1630 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 123: { + //#line 1644 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1642 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(1); - //#line 1630 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1642 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Stmt LoopStatement = (Stmt) getRhsSym(3); - //#line 1632 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1644 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Labeled(pos(), Identifier, LoopStatement)); break; } // - // Rule 127: ExpressionStatement ::= StatementExpression ; + // Rule 129: ExpressionStatement ::= StatementExpression ; // - case 127: { - //#line 1644 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1642 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 129: { + //#line 1656 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1654 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr StatementExpression = (Expr) getRhsSym(1); - //#line 1644 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1656 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" boolean eval = true; if (StatementExpression instanceof X10Call) { X10Call c = (X10Call) StatementExpression; @@ -2586,85 +2610,85 @@ } // - // Rule 135: AssertStatement ::= assert Expression ; + // Rule 137: AssertStatement ::= assert Expression ; // - case 135: { - //#line 1675 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1673 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 137: { + //#line 1687 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1685 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expression = (Expr) getRhsSym(2); - //#line 1675 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1687 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Assert(pos(), Expression)); break; } // - // Rule 136: AssertStatement ::= assert Expression$expr1 : Expression$expr2 ; + // Rule 138: AssertStatement ::= assert Expression$expr1 : Expression$expr2 ; // - case 136: { - //#line 1680 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1678 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 138: { + //#line 1692 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1690 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr expr1 = (Expr) getRhsSym(2); - //#line 1678 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1690 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr expr2 = (Expr) getRhsSym(4); - //#line 1680 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1692 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Assert(pos(), expr1, expr2)); break; } // - // Rule 137: SwitchStatement ::= switch ( Expression ) SwitchBlock + // Rule 139: SwitchStatement ::= switch ( Expression ) SwitchBlock // - case 137: { - //#line 1686 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1684 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 139: { + //#line 1698 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1696 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expression = (Expr) getRhsSym(3); - //#line 1684 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1696 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List SwitchBlock = (List) getRhsSym(5); - //#line 1686 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1698 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Switch(pos(), Expression, SwitchBlock)); break; } // - // Rule 138: SwitchBlock ::= { SwitchBlockStatementGroupsopt SwitchLabelsopt } + // Rule 140: SwitchBlock ::= { SwitchBlockStatementGroupsopt SwitchLabelsopt } // - case 138: { - //#line 1692 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1690 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 140: { + //#line 1704 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1702 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List SwitchBlockStatementGroupsopt = (List) getRhsSym(2); - //#line 1690 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1702 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List SwitchLabelsopt = (List) getRhsSym(3); - //#line 1692 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1704 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" SwitchBlockStatementGroupsopt.addAll(SwitchLabelsopt); setResult(SwitchBlockStatementGroupsopt); break; } // - // Rule 140: SwitchBlockStatementGroups ::= SwitchBlockStatementGroups SwitchBlockStatementGroup + // Rule 142: SwitchBlockStatementGroups ::= SwitchBlockStatementGroups SwitchBlockStatementGroup // - case 140: { - //#line 1700 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1698 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 142: { + //#line 1712 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1710 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List SwitchBlockStatementGroups = (List) getRhsSym(1); - //#line 1698 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1710 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List SwitchBlockStatementGroup = (List) getRhsSym(2); - //#line 1700 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1712 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" SwitchBlockStatementGroups.addAll(SwitchBlockStatementGroup); // setResult(SwitchBlockStatementGroups); break; } // - // Rule 141: SwitchBlockStatementGroup ::= SwitchLabels BlockStatements + // Rule 143: SwitchBlockStatementGroup ::= SwitchLabels BlockStatements // - case 141: { - //#line 1707 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1705 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 143: { + //#line 1719 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1717 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List SwitchLabels = (List) getRhsSym(1); - //#line 1705 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1717 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List BlockStatements = (List) getRhsSym(2); - //#line 1707 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1719 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" List l = new TypedList(new LinkedList(), SwitchElement.class, false); l.addAll(SwitchLabels); l.add(nf.SwitchBlock(pos(), BlockStatements)); @@ -2673,13 +2697,13 @@ } // - // Rule 142: SwitchLabels ::= SwitchLabel + // Rule 144: SwitchLabels ::= SwitchLabel // - case 142: { - //#line 1716 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1714 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 144: { + //#line 1728 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1726 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Case SwitchLabel = (Case) getRhsSym(1); - //#line 1716 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1728 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" List l = new TypedList(new LinkedList(), Case.class, false); l.add(SwitchLabel); setResult(l); @@ -2687,97 +2711,97 @@ } // - // Rule 143: SwitchLabels ::= SwitchLabels SwitchLabel + // Rule 145: SwitchLabels ::= SwitchLabels SwitchLabel // - case 143: { - //#line 1723 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1721 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 145: { + //#line 1735 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1733 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List SwitchLabels = (List) getRhsSym(1); - //#line 1721 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1733 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Case SwitchLabel = (Case) getRhsSym(2); - //#line 1723 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1735 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" SwitchLabels.add(SwitchLabel); //setResult(SwitchLabels); break; } // - // Rule 144: SwitchLabel ::= case ConstantExpression : + // Rule 146: SwitchLabel ::= case ConstantExpression : // - case 144: { - //#line 1730 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1728 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 146: { + //#line 1742 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1740 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr ConstantExpression = (Expr) getRhsSym(2); - //#line 1730 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1742 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Case(pos(), ConstantExpression)); break; } // - // Rule 145: SwitchLabel ::= default : + // Rule 147: SwitchLabel ::= default : // - case 145: { - //#line 1735 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + case 147: { + //#line 1747 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1735 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1747 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Default(pos())); break; } // - // Rule 146: WhileStatement ::= while ( Expression ) Statement + // Rule 148: WhileStatement ::= while ( Expression ) Statement // - case 146: { - //#line 1741 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1739 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 148: { + //#line 1753 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1751 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expression = (Expr) getRhsSym(3); - //#line 1739 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1751 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Stmt Statement = (Stmt) getRhsSym(5); - //#line 1741 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1753 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.While(pos(), Expression, Statement)); break; } // - // Rule 147: DoStatement ::= do Statement while ( Expression ) ; + // Rule 149: DoStatement ::= do Statement while ( Expression ) ; // - case 147: { - //#line 1747 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1745 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 149: { + //#line 1759 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1757 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Stmt Statement = (Stmt) getRhsSym(2); - //#line 1745 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1757 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expression = (Expr) getRhsSym(5); - //#line 1747 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1759 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Do(pos(), Statement, Expression)); break; } // - // Rule 150: BasicForStatement ::= for ( ForInitopt ; Expressionopt ; ForUpdateopt ) Statement + // Rule 152: BasicForStatement ::= for ( ForInitopt ; Expressionopt ; ForUpdateopt ) Statement // - case 150: { - //#line 1756 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1754 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 152: { + //#line 1768 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + ... [truncated message content] |
From: <vj...@us...> - 2009-09-12 23:32:12
|
Revision: 11206 http://x10.svn.sourceforge.net/x10/?rev=11206&view=rev Author: vj0 Date: 2009-09-12 23:32:02 +0000 (Sat, 12 Sep 2009) Log Message: ----------- Completed moving over the rest of XRX code to use ! annotations. * Ensured that the method guard is added to the environment when descending into children of a method definition, provided that the guard is already known. Without this caveat, one gets into an infinite regression. See LocalArray.x10 -- it now requires that its accessors be called only from dist.onePlace. Thus while checking the body of a method, the conditions in the guard of the method are assumed to be true. * Changed the X10Call_c code so that if the call is resolved to a closure call, then this new call is recursively type-checked. This ensures that local checks are performed on the receiver of this call as well. This handles the case of type-checking this.raw(i), where raw is a Rail. The code in X10Call_c was resolving the call to this.raw.apply(i) and returning, without performing checks on the receiver. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java trunk/x10.compiler/src/x10/ast/X10Call_c.java trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java trunk/x10.constraints/src/x10/constraint/XConstraint_c.java trunk/x10.runtime/src-x10/x10/array/BaseArray.x10 trunk/x10.runtime/src-x10/x10/array/BaseDist.x10 trunk/x10.runtime/src-x10/x10/array/BaseRegion.x10 trunk/x10.runtime/src-x10/x10/array/DistArray.x10 trunk/x10.runtime/src-x10/x10/array/FastArray.x10 trunk/x10.runtime/src-x10/x10/array/LocalArray.x10 trunk/x10.runtime/src-x10/x10/array/MatBuilder.x10 trunk/x10.runtime/src-x10/x10/array/PolyMat.x10 trunk/x10.runtime/src-x10/x10/array/PolyScanner.x10 trunk/x10.runtime/src-x10/x10/array/PolyXform.x10 trunk/x10.runtime/src-x10/x10/array/RectRegion.x10 trunk/x10.runtime/src-x10/x10/array/UnionRegion.x10 trunk/x10.runtime/src-x10/x10/array/ValRow.x10 trunk/x10.runtime/src-x10/x10/array/VarRow.x10 trunk/x10.runtime/src-x10/x10/array/Xform.x10 trunk/x10.runtime/src-x10/x10/io/File.x10 trunk/x10.runtime/src-x10/x10/io/FileReader.x10 trunk/x10.runtime/src-x10/x10/io/FileWriter.x10 trunk/x10.runtime/src-x10/x10/io/PutbackReader.x10 trunk/x10.runtime/src-x10/x10/io/Reader.x10 trunk/x10.runtime/src-x10/x10/io/StringWriter.x10 trunk/x10.runtime/src-x10/x10/io/Writer.x10 trunk/x10.runtime/src-x10/x10/lang/Box.x10 trunk/x10.runtime/src-x10/x10/lang/MultipleExceptions.x10 trunk/x10.runtime/src-x10/x10/lang/Point.x10 trunk/x10.runtime/src-x10/x10/lang/Rail.x10 trunk/x10.runtime/src-x10/x10/lang/Region.x10 trunk/x10.runtime/src-x10/x10/lang/System.x10 trunk/x10.runtime/src-x10/x10/runtime/Activity.x10 trunk/x10.runtime/src-x10/x10/runtime/ClockPhases.x10 trunk/x10.runtime/src-x10/x10/runtime/FinishStates.x10 trunk/x10.runtime/src-x10/x10/runtime/Future_c.x10 trunk/x10.runtime/src-x10/x10/runtime/Pool.x10 trunk/x10.runtime/src-x10/x10/runtime/RemoteFinish.x10 trunk/x10.runtime/src-x10/x10/runtime/RootFinish.x10 trunk/x10.runtime/src-x10/x10/runtime/Runtime.x10 trunk/x10.runtime/src-x10/x10/runtime/Thread.x10 trunk/x10.runtime/src-x10/x10/runtime/Worker.x10 trunk/x10.runtime/src-x10/x10/util/ArrayList.x10 trunk/x10.runtime/src-x10/x10/util/HashMap.x10 trunk/x10.runtime/src-x10/x10/util/RailBuilder.x10 trunk/x10.runtime/src-x10/x10/util/Random.x10 trunk/x10.runtime/src-x10/x10/util/StringBuilder.x10 trunk/x10.runtime/src-x10/x10/util/ValRailBuilder.x10 Modified: trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java 2009-09-12 23:32:02 UTC (rev 11206) @@ -110,7 +110,7 @@ if (placeIsPlace) { term = ts.xtypeTranslator().trans(pc, place, xc); if (term == null) { - term = XConstraint_c.genVar(); + term = XConstraint_c.genUQV(); } try { pt = XConstrainedTerm.instantiate(d, term); @@ -124,7 +124,7 @@ if (placeIsRef) { XTerm src = ts.xtypeTranslator().trans(pc, place, xc); if (src == null) { - src = XConstraint_c.genVar(); + src = XConstraint_c.genUQV(); } try { d= d.substitute(src, d.self()); Modified: trunk/x10.compiler/src/x10/ast/X10Call_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Call_c.java 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.compiler/src/x10/ast/X10Call_c.java 2009-09-12 23:32:02 UTC (rev 11206) @@ -336,7 +336,7 @@ } catch (SemanticException e) { if (cc != null) - return cc; + return cc.typeCheck(tc); throw e; } } @@ -388,7 +388,7 @@ } catch (SemanticException e2) { if (cc != null) - return cc; + return cc.typeCheck(tc); throw e; } } @@ -455,6 +455,7 @@ Receiver target = target(); + // Method invocations on structs and values are always permitted if (! ts.isSubtype(target.type(), ts.Ref(), xc)) return; Modified: trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2009-09-12 23:32:02 UTC (rev 11206) @@ -65,6 +65,7 @@ import polyglot.types.UnknownType; import polyglot.util.CodeWriter; import polyglot.util.CollectionUtil; +import polyglot.util.InternalCompilerError; import polyglot.util.Position; import polyglot.util.TypedList; import polyglot.visit.ContextVisitor; @@ -111,7 +112,7 @@ * */ public class X10MethodDecl_c extends MethodDecl_c implements X10MethodDecl { - // The representation of the : Constraint in the parameter list. + // The representation of the guard on the method definition DepParameterExpr guard; List<TypeParamNode> typeParameters; @@ -260,6 +261,13 @@ if (vc != null || tc != null) { c = c.pushBlock(); + try { + if (vc.known()) + c= ((X10Context) c).pushAdditionalConstraint(vc.get()); + } catch (SemanticException z) { + throw + new InternalCompilerError("Unexpected inconsistent guard" + z); + } // ((X10Context) c).setCurrentConstraint(vc.get()); // ((X10Context) c).setCurrentTypeConstraint(tc.get()); } Modified: trunk/x10.constraints/src/x10/constraint/XConstraint_c.java =================================================================== --- trunk/x10.constraints/src/x10/constraint/XConstraint_c.java 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.constraints/src/x10/constraint/XConstraint_c.java 2009-09-12 23:32:02 UTC (rev 11206) @@ -1122,7 +1122,7 @@ return genEQV(true); } - public static XEQV genVar() { + public static XEQV genUQV() { return genEQV(false); } Modified: trunk/x10.runtime/src-x10/x10/array/BaseArray.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/BaseArray.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/array/BaseArray.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -51,7 +51,7 @@ } } - public static def makeVar1[T](rail: Rail[T]): Array[T]{rank==1&&rect&&zeroBased} { + public static def makeVar1[T](rail: Rail[T]!): Array[T]{rank==1&&rect&&zeroBased} { val r = Region.makeRectangular(0, rail.length-1); return makeVar[T](r, ((p:Point)=>rail(p(0))) as Box[(Point)=>T]) as Array[T]{rank==1 && rect && zeroBased}; // XXXX Modified: trunk/x10.runtime/src-x10/x10/array/BaseDist.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/BaseDist.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/array/BaseDist.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -258,7 +258,7 @@ // // XXX should allow places to be in any order?? - protected static def isUnique(places: Rail[Place]): boolean { + protected static def isUnique(places: Rail[Place]!): boolean { if (places.length!=Place.MAX_PLACES) return false; for (var i: int = 0; i<places.length; i++) { @@ -268,14 +268,14 @@ return true; } - protected static def isConstant(places: Rail[Place]): boolean { + protected static def isConstant(places: Rail[Place]!): boolean { for (p:Place in places) if (p!=places(0)) return false; return true; } - protected static def onePlace(places: Rail[Place]): Place { + protected static def onePlace(places: Rail[Place]!): Place { return places(0); } @@ -303,7 +303,7 @@ protected val regions: ValRail[Region]; private val regionMap: ValRail[Region]; - protected def this(r: Region, ps: Rail[Place], rs: Rail[Region]): BaseDist{self.region==r} { + protected def this(r: Region, ps: Rail[Place]!, rs: Rail[Region]!): BaseDist{self.region==r} { super(r, isUnique(ps), isConstant(ps), onePlace(ps)); Modified: trunk/x10.runtime/src-x10/x10/array/BaseRegion.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/BaseRegion.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/array/BaseRegion.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -74,7 +74,7 @@ public static def makeLowerTriangular1(rowMin: int, colMin: int, size: int): Region(2) = PolyRegion.makeLowerTriangular2(rowMin, colMin, size); - public static def make1(regions: Rail[Region/*(1)*/]): RectRegion(regions.length) { // XTENLANG-4 + public static def make1(regions: Rail[Region]!): RectRegion(regions.length) { // XTENLANG-4 var r: Region = regions(0); for (var i: int = 1; i<regions.length; i++) r = r.product(regions(i)); Modified: trunk/x10.runtime/src-x10/x10/array/DistArray.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/DistArray.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/array/DistArray.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -92,7 +92,7 @@ return v; } - def this(dist: Dist, val init: Box[(Point)=>T]): DistArray[T]{self.dist==dist} { + def this(dist: Dist, init: Box[(Point)=>T]): DistArray[T]{self.dist==dist} { super(dist); val plsInit:()=>LocalState[T]! = () => { @@ -118,16 +118,15 @@ public safe def restriction(d: Dist) { if (d.constant) - return new LocalArray[T](this, d as Dist{constant}); + return new LocalArray[T](this, d as Dist{constant, here==self.onePlace}); else return new DistArray[T](this, d); } def this(a: DistArray[T], d: Dist) { super(d); - - localHandle = PlaceLocalStorage.createDistributedObject[LocalState[T]](d, - () => a.localHandle.get()); + localHandle = PlaceLocalStorage.createDistributedObject[LocalState[T]](d, + () => a.localHandle.get()); } } Modified: trunk/x10.runtime/src-x10/x10/array/FastArray.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/FastArray.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/array/FastArray.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -22,7 +22,7 @@ private val raw: Rail[T]; private val layout: RectLayout; - final public def raw() = raw as Rail[T]{self.at(here)}; + final public def raw() = raw as Rail[T]!; final protected def layout(): RectLayout { return layout; @@ -46,14 +46,14 @@ @Native("c++", "(*(#0)->FMGL(raw))[-(#0)->FMGL(offset0) + (#1)]") final public safe def apply(i0: int): T { var offset:int = i0; - return raw(-offset0 + offset); + return raw()(-offset0 + offset); } @Native("c++", "(*(#0)->FMGL(raw))[-(#0)->FMGL(offset1) + (#1) * (#0)->FMGL(delta1) + (#2)]") final public safe def apply(i0: int, i1: int): T { var offset:int = i0; offset = offset*delta1 + i1; - return raw(-offset1 + offset); + return raw()(-offset1 + offset); } @Native("c++", "(*(#0)->FMGL(raw))[-(#0)->FMGL(offset2) + ((#1) * (#0)->FMGL(delta1) + (#2)) * (#0)->FMGL(delta2) + (#3)]") @@ -61,7 +61,7 @@ var offset:int = i0; offset = offset*delta1 + i1; offset = offset*delta2 + i2; - return raw(-offset2 + offset); + return raw()(-offset2 + offset); } @Native("c++", "(*(#0)->FMGL(raw))[-(#0)->FMGL(offset3) + (((#1) * (#0)->FMGL(delta1) + (#2)) * (#0)->FMGL(delta2) + (#3)) * (#0)->FMGL(delta3) + (#4)]") @@ -70,7 +70,7 @@ offset = offset*delta1 + i1; offset = offset*delta2 + i2; offset = offset*delta3 + i3; - return raw(-offset3 + offset); + return raw()(-offset3 + offset); } // Modified: trunk/x10.runtime/src-x10/x10/array/LocalArray.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/LocalArray.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/array/LocalArray.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -11,37 +11,35 @@ final value class LocalArray[T] extends BaseArray[T] { - // may want to say Rail[T]{self.at(dist.onePlace)} - private val raw: Rail[T]; + private val raw: Rail[T]{self.at(dist.onePlace)}; private val layout: RectLayout; - final protected def raw(): Rail[T]{self.at(here)} = raw; final protected def layout() = layout; - + final protected def raw() = raw; // // high-performance methods here to facilitate inlining // // NB: local array, so don't do place checking // - final public safe def apply(i0: int): T { + final public safe def apply(i0: int){here==this.dist.onePlace}: T { if (checkBounds) checkBounds(i0); - return raw()(layout.offset(i0)); + return raw(layout.offset(i0)); } - final public safe def apply(i0: int, i1: int): T { + final public safe def apply(i0: int, i1: int){here==this.dist.onePlace}: T { if (checkBounds) checkBounds(i0, i1); - return raw()(layout.offset(i0,i1)); + return raw(layout.offset(i0,i1)); } - final public safe def apply(i0: int, i1: int, i2: int): T { + final public safe def apply(i0: int, i1: int, i2: int){here==this.dist.onePlace}: T { if (checkBounds) checkBounds(i0, i1, i2); - return raw()(layout.offset(i0,i1,i2)); + return raw(layout.offset(i0,i1,i2)); } - final public safe def apply(i0: int, i1: int, i2: int, i3: int): T { + final public safe def apply(i0: int, i1: int, i2: int, i3: int){here==this.dist.onePlace}: T { if (checkBounds) checkBounds(i0, i1, i2, i3); - return raw()(layout.offset(i0,i1,i2,i3)); + return raw(layout.offset(i0,i1,i2,i3)); } @@ -51,27 +49,27 @@ // NB: local array, so don't do place checking // - final public safe def set(v: T, i0: int): T { + final public safe def set(v: T, i0: int){here==this.dist.onePlace}: T { if (checkBounds) checkBounds(i0); - raw()(layout.offset(i0)) = v; + raw(layout.offset(i0)) = v; return v; } - final public safe def set(v: T, i0: int, i1: int): T { + final public safe def set(v: T, i0: int, i1: int){here==this.dist.onePlace}: T { if (checkBounds) checkBounds(i0, i1); - raw()(layout.offset(i0,i1)) = v; + raw(layout.offset(i0,i1)) = v; return v; } - final public safe def set(v: T, i0: int, i1: int, i2: int): T { + final public safe def set(v: T, i0: int, i1: int, i2: int){here==this.dist.onePlace}: T { if (checkBounds) checkBounds(i0, i1, i2); - raw()(layout.offset(i0,i1,i2)) = v; + raw(layout.offset(i0,i1,i2)) = v; return v; } - final public safe def set(v: T, i0: int, i1: int, i2: int, i3: int): T { + final public safe def set(v: T, i0: int, i1: int, i2: int, i3: int){here==this.dist.onePlace}: T { if (checkBounds) checkBounds(i0, i1, i2, i3); - raw()(layout.offset(i0,i1,i2,i3)) = v; + raw(layout.offset(i0,i1,i2,i3)) = v; return v; } @@ -144,18 +142,20 @@ */ public safe def restriction(d: Dist): Array[T] { - return new LocalArray[T](this, d as Dist{constant}); + + val dd = d as Dist{constant,here==self.onePlace}; + return new LocalArray[T](this, dd); } - def this(a: BaseArray[T], d: Dist{constant}) { + def this(a: BaseArray[T], d: Dist{constant}){here == d.onePlace} { super(d); if (d.region.isEmpty()) { this.layout = layout(d.region); this.raw = Rail.makeVar[T](0); } else { - this.layout = at (d.onePlace) a.layout(); - this.raw = at (d.onePlace) a.raw(); + this.layout = a.layout(); + this.raw = a.raw(); } } Modified: trunk/x10.runtime/src-x10/x10/array/MatBuilder.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/MatBuilder.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/array/MatBuilder.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -7,7 +7,7 @@ public class MatBuilder { - protected val mat: ArrayList[Row]{self.at(this)}; + protected val mat: ArrayList[Row]!; protected val cols: int; public def this(cols: nat) { @@ -54,7 +54,7 @@ } private safe def need(n:int) = need(n, this.mat, this.cols); - private static safe def need(n:int, mat:ArrayList[Row]{self.at(here)}, cols:int) { + private static safe def need(n:int, mat:ArrayList[Row]!, cols:int) { while (mat.size()<n) mat.add(new VarRow(cols)); } Modified: trunk/x10.runtime/src-x10/x10/array/PolyMat.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/PolyMat.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/array/PolyMat.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -82,7 +82,7 @@ return this; val pmb = new PolyMatBuilder(rank); - var removed:Rail[boolean]{self.at(here)} = Rail.makeVar[boolean](rows, (nat)=>false); // XTENLANG-39 workaround + var removed:Rail[boolean]! = Rail.makeVar[boolean](rows, (nat)=>false); // XTENLANG-39 workaround for (var i: int = 0; i<rows; i++) { val r = this(i); Modified: trunk/x10.runtime/src-x10/x10/array/PolyScanner.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/PolyScanner.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/array/PolyScanner.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -331,15 +331,15 @@ */ public def $for(body: (p0:int)=>void) { - loop((p:Rail[int]) => {body(p(0));}); + loop((p:Rail[int]!) => {body(p(0));}); } public def $for(body: (p0:int, p1:int)=>void) { - loop((p:Rail[int]) => {body(p(0), p(1));}); + loop((p:Rail[int]!) => {body(p(0), p(1));}); } public def $for(body: (p0:int, p1:int, p2:int)=>void) { - loop((p:Rail[int]) => {body(p(0), p(1), p(2));}); + loop((p:Rail[int]!) => {body(p(0), p(1), p(2));}); } public def loop(body:(Rail[int])=>void) { Modified: trunk/x10.runtime/src-x10/x10/array/PolyXform.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/PolyXform.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/array/PolyXform.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -9,9 +9,9 @@ property(E, T); } - public operator this * (that:Xform{self.at(here)}):Xform { + public operator this * (that:Xform!):Xform { if (that instanceof PolyXform) { - val p = that as PolyXform{self.at(here)}; + val p = that as PolyXform!; return new PolyXform(this.E||p.E, this.T*p.T); } else { throw new UnsupportedOperationException(this.className() + ".xform(" + that.className() + ")"); Modified: trunk/x10.runtime/src-x10/x10/array/RectRegion.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/RectRegion.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/array/RectRegion.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -48,7 +48,7 @@ max3 = pm.rank>=4 && pm.isBounded()? pm.rectMax()(3) : 0; } - public static def make1(val min: Rail[int], val max: Rail[int]): Region{self.rank==min.length&&self.rect} { // XTENLANG-4 + public static def make1(val min: Rail[int]!, val max: Rail[int]!): Region{self.rank==min.length&&self.rect} { // XTENLANG-4 if (max.length!=min.length) throw U.illegal("min and max must have same length"); @@ -129,11 +129,11 @@ // parameters private val rank: int; - private val min: ValRail[int]{self.at(this)}; - private val max: ValRail[int]{self.at(this)}; + private val min: ValRail[int]!; + private val max: ValRail[int]!; // state - private val x: Rail[int]{self.at(this)}; + private val x: Rail[int]!; private var k: int; def this(val r: RectRegion): It { Modified: trunk/x10.runtime/src-x10/x10/array/UnionRegion.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/UnionRegion.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/array/UnionRegion.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -35,14 +35,14 @@ // constructors // - protected def this(rs: PolyRegionListBuilder{self.at(here)}): UnionRegion(rs.rank) { + protected def this(rs: PolyRegionListBuilder!): UnionRegion(rs.rank) { super(rs.rank, false, false); this.regions = rs.toValRail() as ValRail[PolyRegion(rank)]; //(rs as PolyRegionListBuilder(rank)).toValRail(); cache = new Cache(this, false); } - public static def make(rs: PolyRegionListBuilder{self.at(here)}): Region(rs.rank) { + public static def make(rs: PolyRegionListBuilder!): Region(rs.rank) { if (rs.size()==0) return Region.makeEmpty(rs.rank); else if (rs.size()==1) Modified: trunk/x10.runtime/src-x10/x10/array/ValRow.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/ValRow.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/array/ValRow.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -16,7 +16,7 @@ this.row = row; } - public def this(row: Rail[int]) { + public def this(row: Rail[int]!) { this(row.length, (i:nat) => row(i)); } Modified: trunk/x10.runtime/src-x10/x10/array/VarRow.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/VarRow.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/array/VarRow.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -19,7 +19,7 @@ row = Rail.makeVar[int](cols); } - def row() = row as Rail[int]{self.at(here)}; + def row() = row as Rail[int]!; public safe def apply(i:nat) = row()(i); public safe def set(v:int, i:nat) = (row()(i) = v); Modified: trunk/x10.runtime/src-x10/x10/array/Xform.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/Xform.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/array/Xform.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -64,5 +64,5 @@ } // compose transforms - abstract public operator this * (that:Xform{self.at(here)}): Xform; + abstract public operator this * (that:Xform!): Xform; } Modified: trunk/x10.runtime/src-x10/x10/io/File.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/io/File.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/io/File.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -109,7 +109,7 @@ public const SEPARATOR: Char = '/'; public const PATH_SEPARATOR: Char = ':'; - val parent: File{self.at(this)}; + val parent: File!; val name: String; val absolute: Boolean; @@ -132,7 +132,7 @@ } } - public def this(p: File{self.at(here)}, n: String) { + public def this(p: File!, n: String) { assert p != null; parent = p; name = n; @@ -149,14 +149,14 @@ public def printer() throws IOException = new Printer(openWrite()); public def getName(): String = name; - public def getParentFile(): File{self.at(this)} = parent; + public def getParentFile(): File! = parent; public def getPath(): String = parent == null ? name : (parent.getPath() + SEPARATOR + name); public def isAbsolute(): Boolean = absolute; protected def nativeFile() = new NativeFile(getPath()); - public def getAbsoluteFile(): File{self.at(here)} = new File(nativeFile().getAbsolutePath()); - public def getCanonicalFile(): File{self.at(here)} throws IOException = new File(nativeFile().getCanonicalPath()); + public def getAbsoluteFile(): File! = new File(nativeFile().getAbsolutePath()); + public def getCanonicalFile(): File! throws IOException = new File(nativeFile().getCanonicalPath()); // incomplete def toURL(): URL; // incomplete def toURI(): URI; Modified: trunk/x10.runtime/src-x10/x10/io/FileReader.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/io/FileReader.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/io/FileReader.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -20,7 +20,7 @@ public native def this(String); } - public def this(file: File{self.at(here)}) throws IOException { + public def this(file: File!) throws IOException { super(new FileInputStream(file.getPath())); this.file = file; } Modified: trunk/x10.runtime/src-x10/x10/io/FileWriter.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/io/FileWriter.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/io/FileWriter.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -25,7 +25,7 @@ return new FileOutputStream(path); } - public def this(file: File{self.at(here)}) throws IOException { + public def this(file: File!) throws IOException { super(make(file.getPath())); this.file = file; } Modified: trunk/x10.runtime/src-x10/x10/io/PutbackReader.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/io/PutbackReader.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/io/PutbackReader.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -13,7 +13,7 @@ public value PutbackReader extends FilterReader { val putback: GrowableRail[Byte]; - def putback() = putback as GrowableRail[Byte]{self.at(here)}; + def putback() = putback as GrowableRail[Byte]!; public def this(r: Reader) { super(r); putback = new GrowableRail[Byte](); Modified: trunk/x10.runtime/src-x10/x10/io/Reader.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/io/Reader.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/io/Reader.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -45,10 +45,11 @@ public def readDouble(): Double throws IOException = Marshal.DOUBLE.read(this); public def readLine(): String throws IOException = Marshal.LINE.read(this); - public final def read[T](m: Marshal[T]{self.at(here)}): T throws IOException = m.read(this); + public final def read[T](m: Marshal[T]!): T throws IOException = m.read(this); - public final def read[T](m: Marshal[T]{self.at(here)}, a: Rail[T]): Void throws IOException = read[T](m, a, 0, a.length); - public final def read[T](m: Marshal[T]{self.at(here)}, a: Rail[T]{self.at(here)}, off: Int, len: Int): Void throws IOException { + public final def read[T](m: Marshal[T]!, a: Rail[T]): Void throws IOException + = read[T](m, a, 0, a.length); + public final def read[T](m: Marshal[T]!, a: Rail[T]!, off: Int, len: Int): Void throws IOException { for (var i: Int = off; i < off+len; i++) { a(i) = read[T](m); } Modified: trunk/x10.runtime/src-x10/x10/io/StringWriter.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/io/StringWriter.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/io/StringWriter.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -14,7 +14,7 @@ public value StringWriter extends Writer { val b: StringBuilder; - def b() = b as StringBuilder{self.at(here)}; + def b() = b as StringBuilder!; public def this() { this.b = new StringBuilder(); } public def write(x: Byte): Void { b().add((x as Byte) as Char); } Modified: trunk/x10.runtime/src-x10/x10/io/Writer.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/io/Writer.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/io/Writer.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -55,7 +55,7 @@ } } - public def write(buf: Rail[Byte], off: Int, len: Int): Void throws IOException { + public def write(buf: Rail[Byte]!, off: Int, len: Int): Void throws IOException { for (var i: Int = off; i < off+len; i++) { write(buf(i)); } Modified: trunk/x10.runtime/src-x10/x10/lang/Box.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Box.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/lang/Box.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -16,7 +16,7 @@ @Native("c++", "x10aux::equals(#0,#1)") public def equals(x: Value): Boolean { if (value instanceof Ref) { - val v: Ref{self.at(here)} = value; + val v: Ref! = value; return v.equals(x); } if (x instanceof T) { @@ -32,7 +32,7 @@ return false; } if (value instanceof Ref) { - val v: Ref{self.at(here)} = value; + val v: Ref! = value; return v.equals(x); } if (x instanceof T) { Modified: trunk/x10.runtime/src-x10/x10/lang/MultipleExceptions.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/MultipleExceptions.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/lang/MultipleExceptions.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -18,7 +18,7 @@ */ public value MultipleExceptions(exceptions: ValRail[Throwable]) extends RuntimeException { - public def this(stack: Stack[Throwable]{self.at(here)}) { + public def this(stack: Stack[Throwable]!) { val s = new Stack[Throwable](); // flatten MultipleExceptions in the stack for (t in stack.toValRail()) { Modified: trunk/x10.runtime/src-x10/x10/lang/Point.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Point.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/lang/Point.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -44,7 +44,7 @@ * Constructs a Point from a Rail[int] */ - public static def make(cs: Rail[int]): Point(cs.length) { + public static def make(cs: Rail[int]!): Point(cs.length) { // (i:nat)=>cs(i) is workaround for XTENLANG-32 // val a: ValRail[int](cs.length) = Rail.makeVal[int](cs.length, (i:nat)=>cs(i)); val a = Rail.makeVal[int](cs.length, (i:nat)=>cs(i)); Modified: trunk/x10.runtime/src-x10/x10/lang/Rail.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Rail.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/lang/Rail.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -26,7 +26,7 @@ @Native("java", "x10.core.RailFactory.<#2>makeVarRail(#3, #4, #5)") @Native("c++", "x10::lang::Rail<#1 >::make(#4, #5)") - public native static safe def makeVar[S](length: nat, init: (nat) => S): Rail[S]{self.length==length,self.at(here)}; + public native static safe def makeVar[S](length: nat, init: (nat) => S): Rail[S]!{self.length==length}; @Native("java", "x10.core.RailFactory.<#2>makeValRail(#3, #4)") @Native("c++", "x10::lang::ValRail<#1 >::make(#4)") @@ -34,15 +34,15 @@ @Native("java", "x10.core.RailFactory.<#2>makeVarRail(#3, #4)") @Native("c++", "x10::lang::Rail<#1 >::make(#4)") - public native static safe def makeVar[S](length: nat): Rail[S]{self.length==length,self.at(here)}; + public native static safe def makeVar[S](length: nat): Rail[S]!{self.length==length}; @Native("java", "x10.core.RailFactory.<#2>makeRailFromValRail(#3, #4)") @Native("c++", "x10::lang::Rail<#1 >::make(#4)") - public native static safe def make[U](r: ValRail[U]): Rail[U]{self.length==r.length,self.at(here)}; + public native static safe def make[U](r: ValRail[U]): Rail[U]!{self.length==r.length}; @Native("java", "x10.core.RailFactory.<#2>makeRailFromValRail(#3, #4)") @Native("c++", "x10::lang::Rail<#1 >::make(#4)") - public native static safe operator [U](r: ValRail[U]): Rail[U]{self.length==r.length,self.at(here)}; + public native static safe operator [U](r: ValRail[U]): Rail[U]!{self.length==r.length}; @Native("java", "#0.get(#1)") @Native("c++", "(*#0)[#1]") Modified: trunk/x10.runtime/src-x10/x10/lang/Region.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Region.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/lang/Region.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -94,8 +94,8 @@ * product of the specified rank-1 regions. */ - public static def make(regions: ValRail[Region/*(1)*/]): RectRegion(regions.length) - = BaseRegion.make1(regions as Rail[Region/*(1)*/]); + public static def make(regions: ValRail[Region]): RectRegion(regions.length) + = BaseRegion.make1(regions as Rail[Region]); // Modified: trunk/x10.runtime/src-x10/x10/lang/System.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/System.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/lang/System.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -43,7 +43,7 @@ // FIXME: this ought to be in ValRail but @Native system does not allow this static def copyTo[T] (src:ValRail[T], src_off:Int, - dst_place:Place, dst_finder:()=>Rail[T]{self.at(here)}, + dst_place:Place, dst_finder:()=>Rail[T]!, len:Int) { // could be further optimised to send only the part of the valrail needed at (dst_place) { @@ -120,7 +120,7 @@ } // FIXME: this ought to be in Rail but @Native system does not allow this - static def copyFrom[T] (dst:Rail[T]{self.at(here)}, dst_off:Int, src:ValRail[T], src_off:Int, len:Int) { + static def copyFrom[T] (dst:Rail[T]!, dst_off:Int, src:ValRail[T], src_off:Int, len:Int) { // source is always local // semantics allows an async per rail element inside a single finish // this version is optimised to not use any asynchrony Modified: trunk/x10.runtime/src-x10/x10/runtime/Activity.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/runtime/Activity.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/runtime/Activity.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -14,7 +14,7 @@ * @author tardieu */ class Activity { - val finishState:FinishState{self.at(this)}; + val finishState:FinishState!; val safe:Boolean; // the finish state governing the execution of this activity @@ -27,13 +27,13 @@ * The mapping from registered clocks to phases for this activity. * Lazily created. */ - var clockPhases:ClockPhases{self.at(this)}; + var clockPhases:ClockPhases!; /** * The finish states for the finish statements currently executed by this activity. * Lazily created. */ - var finishStack:Stack[FinishState{self.at(this)}]{self.at(this)}; + var finishStack:Stack[FinishState!]!; /** * Create activity. Modified: trunk/x10.runtime/src-x10/x10/runtime/ClockPhases.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/runtime/ClockPhases.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/runtime/ClockPhases.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -14,7 +14,7 @@ * @author tardieu */ class ClockPhases extends HashMap[Clock_c,Int] { - def register(clocks:ValRail[Clock]{self.at(here)}, phases:ValRail[Int]{self.at(here)}):Void { + def register(clocks:ValRail[Clock], phases:ValRail[Int]):Void { for(var i:Int = 0; i < clocks.length; i++) this.put(clocks(i) as Clock_c, phases(i)); } Modified: trunk/x10.runtime/src-x10/x10/runtime/FinishStates.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/runtime/FinishStates.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/runtime/FinishStates.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -19,15 +19,15 @@ */ class FinishStates { - private val map = new HashMap[RID, FinishState{self.at(this)}](); + private val map = new HashMap[RID, FinishState!](); private val count = new AtomicInteger(0); private val lock = new Lock(); - def put(finishState:FinishState{self.at(here)}):Void { + def put(finishState:FinishState!):Void { if (finishState.rid().id == -1) { lock.lock(); if (finishState.rid().id == -1) { - val rootFinish = finishState as RootFinish{self.at(here)}; + val rootFinish = finishState as RootFinish!; rootFinish.rid = new RID(here, count.getAndIncrement()); map.put(rootFinish.rid, rootFinish); } @@ -35,7 +35,7 @@ } } - def get(rid:RID):FinishState{self.at(here)} { + def get(rid:RID):FinishState! { lock.lock(); val finishState = map.getOrElse(rid, null); if (null != finishState) { @@ -55,7 +55,7 @@ return finishState as RootFinish; } - def removeRoot(rootFinish:RootFinish{self.at(here)}):Void{ + def removeRoot(rootFinish:RootFinish!):Void{ if (rootFinish.rid.id != -1) { lock.lock(); map.remove(rootFinish.rid); Modified: trunk/x10.runtime/src-x10/x10/runtime/Future_c.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/runtime/Future_c.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/runtime/Future_c.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -35,10 +35,10 @@ result = new GrowableRail[T](); } - private def result()= result as GrowableRail[T]{self.at(here)}; - public def forced():boolean = at (latch.location) latch(); + private def result()= result as GrowableRail[T]!; + public def forced():boolean = at (latch.location) latch(); - public def apply():T = force(); + public def apply():T = force(); public def force():T { return at (latch.location) { Modified: trunk/x10.runtime/src-x10/x10/runtime/Pool.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/runtime/Pool.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/runtime/Pool.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -14,7 +14,7 @@ * @author tardieu */ public class Pool implements ()=>Void { - private val latch:Latch{self.at(this)}; + private val latch:Latch!; private var size:Int; // the number of workers in the pool private var spares:Int = 0; // the number of spare workers in the pool @@ -27,16 +27,16 @@ private const MAX = 1000; // the workers in the pool - private val workers:Rail[Worker{self.at(this)}]{self.at(this)}; + private val workers:Rail[Worker!]!; // the threads in the pool - private val threads:Rail[Thread{self.at(this)}]; + private val threads:Rail[Thread!]!; - def this(latch:Latch{self.at(here)}, size:Int) { + def this(latch:Latch!, size:Int) { this.latch = latch; this.size = size; - val workers = Rail.makeVar[Worker{self.at(here)}](MAX); - val threads = Rail.makeVar[Thread{self.at(here)}](size); + val workers = Rail.makeVar[Worker!](MAX); + val threads = Rail.makeVar[Thread!](size); // worker for the master thread val master = new Worker(latch, 0); @@ -83,8 +83,7 @@ NativeRuntime.println("TOO MANY THREADS... ABORTING"); System.exit(1); } - // vj: This cast should not be needed. - val worker = new Worker(latch as Latch{self.at(here)}, i); + val worker = new Worker(latch as Latch!, i); workers(i) = worker; val thread = new Thread(worker.apply.(), "thread-" + i); thread.worker(worker); @@ -112,8 +111,8 @@ } // scan workers for activity to steal - def scan(random:Random{self.at(here)}, latch:Latch, block:Boolean):Activity{self.at(here)} { - var activity:Activity{self.at(here)}= null; + def scan(random:Random!, latch:Latch!, block:Boolean):Activity! { + var activity:Activity! = null; var next:Int = random.nextInt(size); for (;;) { NativeRuntime.event_probe(); Modified: trunk/x10.runtime/src-x10/x10/runtime/RemoteFinish.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/runtime/RemoteFinish.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/runtime/RemoteFinish.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -19,7 +19,7 @@ * The Exception Stack is used to collect exceptions * issued when activities associated with this finish state terminate abruptly. */ - private var exceptions:Stack[Throwable]{self.at(this)}; + private var exceptions:Stack[Throwable]!; /** * The monitor is used to serialize updates to the finish state. @@ -29,7 +29,7 @@ /** * Keep track of the number of activities associated with this finish state. */ - private val counts = Rail.makeVar[Int](Place.MAX_PLACES, (Int)=>0) as Rail[Int]{self.at(this)}; + private val counts = Rail.makeVar[Int](Place.MAX_PLACES, (Int)=>0) as Rail[Int]!; private var count:AtomicInteger = new AtomicInteger(0); Modified: trunk/x10.runtime/src-x10/x10/runtime/RootFinish.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/runtime/RootFinish.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/runtime/RootFinish.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -14,9 +14,9 @@ * @author tardieu */ class RootFinish extends Latch implements FinishState { - private val counts:Rail[Int]{self.at(this)}; + private val counts:Rail[Int]!; - private var exceptions:Stack[Throwable]{self.at(this)}; + private var exceptions:Stack[Throwable]!; var rid:RID = new RID(here, -1); @@ -48,7 +48,7 @@ } } - def notify(rail:ValRail[Int]{self.at(here)}):Void { + def notify(rail:ValRail[Int]!):Void { var b:Boolean = true; lock(); for(var i:Int=0; i<Place.MAX_PLACES; i++) { @@ -59,7 +59,7 @@ unlock(); } - def notify(rail:ValRail[Int]{self.at(here)}, t:Throwable):Void { + def notify(rail:ValRail[Int]!, t:Throwable):Void { pushException(t); notify(rail); } Modified: trunk/x10.runtime/src-x10/x10/runtime/Runtime.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/runtime/Runtime.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/runtime/Runtime.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -28,7 +28,7 @@ // instance fields // per process members - private val pool:Pool{self.at(this)}; + private val pool:Pool!; // per place members private val monitor = new Monitor(); @@ -36,7 +36,7 @@ // constructor - private def this(pool:Pool{self.at(here)}):Runtime { + private def this(pool:Pool!):Runtime { this.pool = pool; } @@ -48,17 +48,17 @@ /** * Return the current runtime */ - private static def runtime() = runtime.get() as Runtime{self.at(here)}; + private static def runtime() = runtime.get() as Runtime!; /** * Return the current worker */ - private static def worker():Worker{self.at(here)} = Thread.currentThread().worker(); + private static def worker():Worker! = Thread.currentThread().worker(); /** * Return the current activity */ - private static def activity():Activity{self.at(here)} + private static def activity():Activity! = worker().activity(); /** @@ -90,7 +90,7 @@ pool(); if (!NativeRuntime.local(Place.MAX_PLACES - 1)) { for (var i:Int=1; i<Place.MAX_PLACES; i++) { - NativeRuntime.runAt(i, ()=>(worker().latch as Latch{self.at(here)}).release()); + NativeRuntime.runAt(i, ()=>{ val w=worker(); w.latch.release()}); } } rootFinish.waitForFinish(false); @@ -109,9 +109,9 @@ runtime().pool.release(); } - static def findRoot(rid:RID) = runtime().finishStates.findRoot(rid) as RootFinish{self.at(here)}; + static def findRoot(rid:RID) = runtime().finishStates.findRoot(rid) as RootFinish!; - static def removeRoot(rootFinish:RootFinish{self.at(here)}) { + static def removeRoot(rootFinish:RootFinish!) { runtime().finishStates.removeRoot(rootFinish); } @@ -273,7 +273,7 @@ /** * Return the clock phases for the current activity */ - static def clockPhases():ClockPhases{self.at(here)} { + static def clockPhases():ClockPhases! { val a = activity(); if (null == a.clockPhases) a.clockPhases = new ClockPhases(); @@ -291,7 +291,7 @@ /** * Return the innermost finish state for the current activity */ - private static def currentState(): FinishState{self.at(here)} { + private static def currentState(): FinishState! { val a = activity(); if (null == a.finishStack || a.finishStack.isEmpty()) return a.finishState; @@ -305,7 +305,7 @@ public static def startFinish():Void { val a = activity(); if (null == a.finishStack) - a.finishStack = new Stack[FinishState{self.at(here)}](); + a.finishStack = new Stack[FinishState!](); a.finishStack.push(new RootFinish()); } @@ -319,7 +319,7 @@ val a = activity(); val finishState = a.finishStack.pop(); finishState.notifySubActivityTermination(); - (finishState as RootFinish{self.at(here)}).waitForFinish(safe()); + (finishState as RootFinish!).waitForFinish(safe()); } /** @@ -336,13 +336,13 @@ } - static def scan(random:Random{self.at(here)}, latch:Latch, block:Boolean):Activity{self.at(here)} { + static def scan(random:Random!, latch:Latch!, block:Boolean):Activity! { return runtime().pool.scan(random, latch, block); } // submit an activity to the pool - private static def execute(activity:Activity{self.at(here)}):Void { + private static def execute(activity:Activity!):Void { NativeRuntime.runAtLocal(runtime().pool.location.id, ()=>worker().push(activity)); } @@ -357,11 +357,11 @@ } // run pending activities while waiting on condition - static def join(latch:Latch) { + static def join(latch:Latch!) { NativeRuntime.runAtLocal(runtime().pool.location.id, ()=>worker().join(latch)); } - static def run(activity:Activity{self.at(here)}):Void { + static def run(activity:Activity!):Void { NativeRuntime.runAtLocal(activity.location.id, activity.run.()); } } Modified: trunk/x10.runtime/src-x10/x10/runtime/Thread.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/runtime/Thread.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/runtime/Thread.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -35,7 +35,7 @@ @Native("java", "#0.currentThread()") @Native("c++", "x10::runtime::Thread::currentThread()") - public static native def currentThread():Thread{self.at(here)}; + public static native def currentThread():Thread!; @Native("java", "#0.start()") @Native("c++", "(#0)->start()") @@ -63,11 +63,11 @@ @Native("java", "((x10.runtime.Worker)(#0.worker()))") @Native("c++", "x10::runtime::Thread::currentThread()->worker()") - public native def worker():Worker{self.at(here)}; + public native def worker():Worker!; @Native("java", "#0.worker(#1)") @Native("c++", "(#0)->worker(#1)") - public native def worker(worker:Worker{self.at(here)}):void; + public native def worker(worker:Worker!):void; @Native("java", "#0.getName()") @Native("c++", "(#0)->getName()") Modified: trunk/x10.runtime/src-x10/x10/runtime/Worker.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/runtime/Worker.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/runtime/Worker.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -14,22 +14,22 @@ * @author tardieu */ final class Worker implements ()=>Void { - val latch:Latch{self.at(this)}; + val latch:Latch!; // release the latch to stop the worker // bound on loop iterations to help j9 jit const BOUND = 100; // activity (about to be) executed by this worker - private var activity:Activity{self.at(this)} = null; + private var activity:Activity! = null; // pending activities private val queue = new Deque(); // random number generator for this worker - private val random:Random{self.at(this)}; + private val random:Random!; - def this(latch:Latch{self.at(here)}, p:Int) { + def this(latch:Latch!, p:Int) { this.latch = latch; random = new Random(p + (p << 8) + (p << 16) + (p << 24)); } @@ -43,13 +43,13 @@ def activity() = activity; // poll activity from the bottom of the deque - private def poll() = queue.poll() as Activity{self.at(here)}; + private def poll() = queue.poll() as Activity!; // steal activity from the top of the deque - def steal() = queue.steal() as Activity{self.at(here)}; + def steal() = queue.steal() as Activity!; // push activity at the bottom of the deque - def push(activity:Activity{self.at(here)}):Void = queue.push(activity); + def push(activity:Activity!):Void = queue.push(activity); // run pending activities public def apply():Void { @@ -64,14 +64,14 @@ } // run activities while waiting on finish - def join(latch:Latch):Void { + def join(latch:Latch!):Void { val tmp = activity; // save current activity while (loop(latch, false)); activity = tmp; // restore current activity } // inner loop to help j9 jit - private def loop(latch:Latch, block:Boolean):Boolean { + private def loop(latch:Latch!, block:Boolean):Boolean { for (var i:Int = 0; i < BOUND; i++) { if (latch()) return false; activity = poll(); Modified: trunk/x10.runtime/src-x10/x10/util/ArrayList.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/util/ArrayList.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/util/ArrayList.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -5,7 +5,7 @@ public class ArrayList[T] extends AbstractCollection[T] implements List[T] { - private var a: GrowableRail[T]{self.at(this)}; + private var a: GrowableRail[T]!; public static def make[T](c: Container[T]) { val a = new ArrayList[T](); @@ -139,7 +139,7 @@ private static class It[S] implements ListIterator[S] { private var i: int; - private val al: ArrayList[S]{self.at(this)}; + private val al: ArrayList[S]!; def this(al: ArrayList[S]) { this(al, -1); @@ -215,7 +215,7 @@ // quick&dirty sort // - private def qsort(a: GrowableRail[T], lo: int, hi: int, cmp: (T,T)=>Int) { + private def qsort(a: GrowableRail[T]!, lo: int, hi: int, cmp: (T,T)=>Int) { if (hi <= lo) return; var l: int = lo - 1; var h: int = hi; @@ -230,7 +230,7 @@ qsort(a, l+1, hi, cmp); } - private def exch(a: GrowableRail[T]{self.at(here)}, i: int, j: int): void { + private def exch(a: GrowableRail[T]!, i: int, j: int): void { val temp = a(i); a(i) = a(j); a(j) = temp; Modified: trunk/x10.runtime/src-x10/x10/util/HashMap.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/util/HashMap.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/util/HashMap.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -28,7 +28,7 @@ } /** The actual table, must be of size 2**n */ - var table: Rail[HashEntry[K,V]{self.at(this)}]{self.at(this)}; + var table: Rail[HashEntry[K,V]!]!; /** Number of non-null, non-removed entries in the table. */ var size: Int; @@ -60,7 +60,7 @@ assert (sz & -sz) == sz; assert sz >= MIN_SIZE; - table = Rail.makeVar[HashEntry[K,V]{self.at(this)}](sz); + table = Rail.makeVar[HashEntry[K,V]!](sz); mask = sz - 1; size = 0; occupation = 0; @@ -95,7 +95,7 @@ return e.value; } - protected def getEntry(k: K): HashEntry[K,V]{self.at(here)} { + protected def getEntry(k: K): HashEntry[K,V]! { if (size == 0) return null; @@ -170,7 +170,7 @@ public def rehash(): void { val t = table; val oldSize = size; - table = Rail.makeVar[HashEntry[K,V]{self.at(this)}](t.length*2); + table = Rail.makeVar[HashEntry[K,V]!](t.length*2); mask = table.length - 1; size = 0; occupation = 0; @@ -216,7 +216,7 @@ } protected static class EntriesIterator[-Key,Value] implements Iterator[HashEntry[Key,Value]] { - val map: HashMap[Key,Value]{self.at(this)}; + val map: HashMap[Key,Value]!; var i: Int; def this(map: HashMap[Key,Value]) { this.map = map; this.i = 0; } @@ -249,12 +249,12 @@ public def size() = size; protected static class KeySet[-Key,Value] extends AbstractCollection[Key] implements Set[Key] { - val map: HashMap[Key,Value]{self.at(this)}; + val map: HashMap[Key,Value]!; - def this(map: HashMap[Key,Value]{self.at(here)}) { this.map = map; } + def this(map: HashMap[Key,Value]!) { this.map = map; } public def iterator(): Iterator[Key] { - return new MapIterator[HashEntry[Key,Value],Key](map.entriesIterator(), (e: HashEntry[Key,Value]{self.at(here)}) => e.key); + return new MapIterator[HashEntry[Key,Value],Key](map.entriesIterator(), (e: HashEntry[Key,Value]!) => e.key); } public def contains(k: Key) { @@ -268,9 +268,9 @@ } protected static class EntrySet[-Key,Value] extends AbstractCollection[Map.Entry[Key,Value]] implements Set[Map.Entry[Key,Value]] { - val map: HashMap[Key,Value]{self.at(this)}; + val map: HashMap[Key,Value]!; - def this(map: HashMap[Key,Value]{self.at(here)}) { this.map = map; } + def this(map: HashMap[Key,Value]!) { this.map = map; } public def iterator(): Iterator[Map.Entry[Key,Value]] { return new MapIterator[HashEntry[Key,Value],Map.Entry[Key,Value]](map.entriesIterator(), (e: HashEntry[Key,Value]) => e as Map.Entry[Key,Value]); Modified: trunk/x10.runtime/src-x10/x10/util/RailBuilder.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/util/RailBuilder.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/util/RailBuilder.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -1,7 +1,7 @@ package x10.util; public class RailBuilder[T] implements Builder[T,Rail[T]] { - val buf: GrowableRail[T]{self.at(this)}; + val buf: GrowableRail[T]!; public def this() { buf = new GrowableRail[T](); Modified: trunk/x10.runtime/src-x10/x10/util/Random.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/util/Random.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/util/Random.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -54,7 +54,7 @@ return x; } - public def nextBytes(buf: Rail[Byte]{self.at(here)}): Void { + public def nextBytes(buf: Rail[Byte]!): Void { var i: int = 0; while (true) { var x: int = nextInt(); @@ -125,7 +125,7 @@ private const M: int = 397; private var index: int; - private var MT: Rail[int]; + private var MT: Rail[int]!; public proto def init(seed: long): Void { val mt = Rail.makeVar[int](N); @@ -156,7 +156,7 @@ return MT(index++); } - private static def twist(MT:Rail[int]{self.at(here)}): void { + private static def twist(MT:Rail[int]!): void { var i: int = 0; var s: int; for (; i < N - M; i++) { Modified: trunk/x10.runtime/src-x10/x10/util/StringBuilder.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/util/StringBuilder.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/util/StringBuilder.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -3,7 +3,7 @@ import x10.compiler.Native; public class StringBuilder implements Builder[Object,String] { - val buf: ValRailBuilder[Char]{self.at(here)}; + val buf: ValRailBuilder[Char]!; public def this() { buf = new ValRailBuilder[Char](); Modified: trunk/x10.runtime/src-x10/x10/util/ValRailBuilder.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/util/ValRailBuilder.x10 2009-09-12 14:32:43 UTC (rev 11205) +++ trunk/x10.runtime/src-x10/x10/util/ValRailBuilder.x10 2009-09-12 23:32:02 UTC (rev 11206) @@ -1,7 +1,7 @@ package x10.util; public class ValRailBuilder[T] implements Builder[T,ValRail[T]] { - val buf: GrowableRail[T]{self.at(this)}; + val buf: GrowableRail[T]!; public def this() { buf = new GrowableRail[T](); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vj...@us...> - 2009-09-13 17:47:22
|
Revision: 11208 http://x10.svn.sourceforge.net/x10/?rev=11208&view=rev Author: vj0 Date: 2009-09-13 17:47:14 +0000 (Sun, 13 Sep 2009) Log Message: ----------- Support for struct constructors. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/X10AmbTypeNode_c.java trunk/x10.compiler/src/x10/ast/X10Call_c.java trunk/x10.compiler/src/x10/ast/X10CanonicalTypeNode_c.java trunk/x10.compiler/src/x10/ast/X10Disamb_c.java trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java trunk/x10.compiler/src/x10/ast/X10New_c.java trunk/x10.compiler/src/x10/parser/X10Parser.java trunk/x10.compiler/src/x10/parser/X10Parserprs.java trunk/x10.compiler/src/x10/parser/X10Parsersym.java trunk/x10.compiler/src/x10/parser/x10.g trunk/x10.compiler/src/x10/types/X10ConstructorInstance.java trunk/x10.compiler/src/x10/types/X10ConstructorInstance_c.java trunk/x10.compiler/src/x10/types/X10Context_c.java trunk/x10.compiler/src/x10/types/X10ParsedClassType_c.java trunk/x10.compiler/src/x10/types/X10TypeMixin.java trunk/x10.runtime/src-x10/x10/runtime/FinishState.x10 trunk/x10.runtime/src-x10/x10/runtime/Lock.x10 trunk/x10.runtime/src-x10/x10/runtime/RID.x10 trunk/x10.runtime/src-x10/x10/runtime/RootFinish.x10 trunk/x10.runtime/src-x10/x10/util/concurrent/atomic/AtomicInteger.x10 Added Paths: ----------- trunk/x10.compiler/src/x10/visit/TryTypeChecker.java trunk/x10.compiler/src/x10/visit/TryVisitorI.java trunk/x10.tests/examples/Constructs/Call/StructCall.x10 trunk/x10.tests/examples/Constructs/Call/StructCall2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Call/StructCall3_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Call/StructCall_MustFailCompile.x10 Modified: trunk/x10.compiler/src/x10/ast/X10AmbTypeNode_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10AmbTypeNode_c.java 2009-09-13 02:24:30 UTC (rev 11207) +++ trunk/x10.compiler/src/x10/ast/X10AmbTypeNode_c.java 2009-09-13 17:47:14 UTC (rev 11208) @@ -37,8 +37,10 @@ import x10.extension.X10Del_c; import x10.types.MacroType; import x10.types.X10Context; +import x10.types.X10Flags; import x10.types.X10ParsedClassType; import x10.types.X10Type; +import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; /** @@ -166,9 +168,16 @@ if (n instanceof TypeNode) { TypeNode tn = (TypeNode) n; LazyRef<Type> sym = (LazyRef<Type>) type; - sym.update(tn.type()); + X10Type t2 = (X10Type) tn.type(); + if (X10Flags.toX10Flags(t2.flags()).isStruct()) { + + if (flags == null || ! X10Flags.toX10Flags(flags).isStruct()) { + t2 = X10TypeMixin.makeRef(t2); + } + } + sym.update(t2); - if (tn.type() instanceof X10ParsedClassType) { + if (t2 instanceof X10ParsedClassType) { X10ParsedClassType ct = (X10ParsedClassType) tn.type(); if (ct.x10Def().typeParameters().size() != 0) { throw new SemanticException("Invalid type " + ct + "; incorrect number of type arguments.", position()); Modified: trunk/x10.compiler/src/x10/ast/X10Call_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Call_c.java 2009-09-13 02:24:30 UTC (rev 11207) +++ trunk/x10.compiler/src/x10/ast/X10Call_c.java 2009-09-13 17:47:14 UTC (rev 11208) @@ -11,17 +11,22 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Map; import polyglot.ast.Call_c; +import polyglot.ast.ClassBody; import polyglot.ast.Expr; import polyglot.ast.Id; import polyglot.ast.Local; +import polyglot.ast.New; import polyglot.ast.Node; import polyglot.ast.NodeFactory; import polyglot.ast.Receiver; import polyglot.ast.Special; import polyglot.ast.TypeNode; import polyglot.ast.Variable; +import polyglot.frontend.Job; +import polyglot.main.Report; import polyglot.types.ClassDef; import polyglot.types.ClassType; import polyglot.types.CodeDef; @@ -42,12 +47,17 @@ import polyglot.types.UnknownType; import polyglot.util.CollectionUtil; import polyglot.util.ErrorInfo; +import polyglot.util.InternalCompilerError; import polyglot.util.Pair; import polyglot.util.Position; import polyglot.visit.ContextVisitor; +import polyglot.visit.ErrorHandlingVisitor; import polyglot.visit.NodeVisitor; +import polyglot.visit.TypeBuilder; +import polyglot.visit.TypeChecker; import x10.constraint.XLocal; import x10.constraint.XRoot; +import x10.parser.X10ParsedName; import x10.types.ParameterType; import x10.types.X10ClassType; import x10.types.X10Context; @@ -60,6 +70,7 @@ import x10.types.X10TypeSystem; import x10.types.X10TypeSystem_c; import x10.types.XTypeTranslator; +import x10.visit.TryTypeChecker; /** * A method call wrapper to rewrite getLocation() calls on primitives @@ -175,9 +186,72 @@ : superFindMethod(tc, (X10Context) xc.pop(), matcher, typeArgs, argTypes); return result; } + +/** + * First try for a struct constructor, and then look for a static method. + * @param tc + * @param typeArgs + * @param argTypes + * @param args + * @return + * @throws SemanticException + */ - protected Node typeCheckNullTarget(ContextVisitor tc, List<Type> typeArgs, List<Type> argTypes) throws SemanticException { + protected Node typeCheckNullTarget(ContextVisitor tc, List<Type> typeArgs, List<Type> argTypes, + List<Expr> args) throws SemanticException { + if (typeArgs == null || typeArgs.size()==0) { + // This could possibly be an invocation of a constructor for a struct. + try { + X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); + X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); + Context c = tc.context(); + + + TypeBuilder tb = new TypeBuilder(tc.job(), ts, nf); + TypeNode tn = new X10ParsedName(nf, ts, position(), name()).toType(); + tn = (TypeNode) tn.visit(tb); + // First ensure that there is a type associated with tn. + tn = (TypeNode) tn.disambiguate(tc); + ((AddFlags) tn).addFlags(X10Flags.STRUCT); + + X10New_c call = (X10New_c) nf.New(position(), null, tn, args, null); + call.setStructConstructorCall(); + + call = (X10New_c) call.visit(tb); + + + /*I would like to just do this: + call = (X10New_c) call.visit(tc); + Unfortunately, it catches and queues SemanticExceptions it may generate. + We need to catch those exceptions and ignore them. + So we have to do what the visit protocol does, + but ensure that SemanticExceptions flow through. + */ + TryTypeChecker tc1 = new TryTypeChecker((TypeChecker) tc); + + call = (X10New_c) call.tryVisit(tc1); + if (tc1.errorQueue().errorCount() == 0) { + + if (! (ts.isStructType(call.type()))) { + StructType ct = call.constructorInstance().def().container().get(); + throw new SemanticException("Cannot use struct constructors for non-struct class " + ct, + call.position()); + } + + return call; + } + } catch (SemanticException z) { + // This may have caused some errors to print out. + } + } + // Otherwise try and find the usual null target method. + return typeCheckNullTargetForMethod(tc, typeArgs, argTypes); + } + + + protected Node typeCheckNullTargetForMethod(ContextVisitor tc, List<Type> typeArgs, List<Type> argTypes) throws SemanticException { + X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); NodeFactory nf = tc.nodeFactory(); X10Context c = (X10Context) tc.context(); @@ -189,10 +263,8 @@ Pair<MethodInstance, List<Expr>> p = findMethod(tc, ts.MethodMatcher(null, name.id(), typeArgs, argTypes, c), typeArgs, argTypes); X10MethodInstance mi = (X10MethodInstance) p.fst(); List<Expr> args = p.snd(); + X10TypeSystem xts = (X10TypeSystem) ts; - - X10TypeSystem xts = (X10TypeSystem) ts; - Receiver r; if (mi.flags().isStatic()) { Type container = findContainer(ts, mi); @@ -244,10 +316,6 @@ return null; } - /** - * Rewrite getLocation() to Here for value types and operator calls for - * array types, otherwise leave alone. - */ public Node typeCheck(ContextVisitor tc) throws SemanticException { X10NodeFactory xnf = (X10NodeFactory) tc.nodeFactory(); X10TypeSystem xts = (X10TypeSystem) tc.typeSystem(); @@ -261,7 +329,7 @@ X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); - Expr f; + Expr f = null; if (target() != null) f = nf.Field(new Position(target().position(), name().position()), target(), name()); else @@ -307,9 +375,6 @@ } } - - - ///////////////////////////////////////////////////////////////////// // Inline the super call here and handle type arguments. ///////////////////////////////////////////////////////////////////// @@ -329,15 +394,20 @@ if (this.target == null) { try { - X10Call_c n = (X10Call_c) this.typeCheckNullTarget(tc, typeArgs, argTypes); + Node n = this.typeCheckNullTarget(tc, typeArgs, argTypes, arguments); if (cc != null) - throw new SemanticException("Ambiguous call; both " + n.methodInstance() + " and closure match.", position()); + throw new SemanticException("Ambiguous call; both " + + ((n instanceof X10New) + ? ((X10New) n).constructorInstance().toString() + : ((X10Call) n).methodInstance().toString()) + + " and closure match.", position()); return n; } catch (SemanticException e) { if (cc != null) return cc.typeCheck(tc); - throw e; + throw new SemanticException("Method or static constructor not found for " + + ((X10TypeSystem) tc.typeSystem()).MethodMatcher(null, name.id(), typeArgs, argTypes, c)); } } @@ -365,11 +435,14 @@ } catch (SemanticException e) { try { - if (name == Name.make("equals") && argTypes.size() == 1 && typeArgs.size() == 0 && xts.isParameterType(targetType) && xts.isParameterType(argTypes.get(0))) { + if (name == Name.make("equals") && argTypes.size() == 1 && typeArgs.size() == 0 + && xts.isParameterType(targetType) && xts.isParameterType(argTypes.get(0))) { // Check that both equals(Ref) and equals(Value) are present - mi = (X10MethodInstance) xts.findMethod(targetType, xts.MethodMatcher(targetType, name, typeArgs, Collections.singletonList(xts.Ref()), c)); - mi = null; - mi = (X10MethodInstance) xts.findMethod(targetType, xts.MethodMatcher(targetType, name, typeArgs, Collections.singletonList(xts.Value()), c)); + mi = (X10MethodInstance) xts.findMethod(targetType, + xts.MethodMatcher(targetType, name, typeArgs, Collections.singletonList(xts.Ref()), c)); + mi = null; + mi = (X10MethodInstance) xts.findMethod(targetType, + xts.MethodMatcher(targetType, name, typeArgs, Collections.singletonList(xts.Value()), c)); mi = (X10MethodInstance) mi.formalTypes(Collections.singletonList(X10TypeMixin.baseType(targetType))); LocalInstance d = mi.formalNames().get(0); mi = (X10MethodInstance) mi.formalNames(Collections.singletonList(d.type(X10TypeMixin.baseType(targetType)))); @@ -389,6 +462,7 @@ catch (SemanticException e2) { if (cc != null) return cc.typeCheck(tc); + throw e; } } Modified: trunk/x10.compiler/src/x10/ast/X10CanonicalTypeNode_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10CanonicalTypeNode_c.java 2009-09-13 02:24:30 UTC (rev 11207) +++ trunk/x10.compiler/src/x10/ast/X10CanonicalTypeNode_c.java 2009-09-13 17:47:14 UTC (rev 11208) @@ -99,8 +99,8 @@ t = ts.expandMacros(t); X10Type xt = (X10Type) t; if (flags != null) { - X10Flags xflags = (X10Flags) flags; - X10Flags f = (X10Flags) xt.flags(); + X10Flags xflags = X10Flags.toX10Flags(flags); + X10Flags f = X10Flags.toX10Flags( xt.flags()); if (f == null) f = (X10Flags) X10Flags.toX10Flags(Flags.NONE); xt = xt.setFlags(flags); Modified: trunk/x10.compiler/src/x10/ast/X10Disamb_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Disamb_c.java 2009-09-13 02:24:30 UTC (rev 11207) +++ trunk/x10.compiler/src/x10/ast/X10Disamb_c.java 2009-09-13 17:47:14 UTC (rev 11208) @@ -177,11 +177,11 @@ // no variable found. try types. if (typeOK()) { try { - Named n = c.find(ts.TypeMatcher(name.id())); - if (n instanceof Type) { - Type type = (Type) n; - return makeTypeNode(type); - } + Named n = c.find(ts.TypeMatcher(name.id())); + if (n instanceof Type) { + Type type = (Type) n; + return makeTypeNode(type); + } } catch (NoClassException e1) { if (!name.id().toString().equals(e1.getClassName())) { // hmm, something else must have gone wrong Modified: trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2009-09-13 02:24:30 UTC (rev 11207) +++ trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2009-09-13 17:47:14 UTC (rev 11208) @@ -124,9 +124,6 @@ this.typeParameters = TypedList.copyAndCheck(typeParams, TypeParamNode.class, true); } - - - protected MethodDef createMethodDef(TypeSystem ts, ClassDef ct, Flags flags) { X10MethodDef mi = (X10MethodDef) super.createMethodDef(ts, ct, flags); mi.setThisVar(((X10ClassDef) ct).thisVar()); @@ -350,7 +347,6 @@ NodeFactory nf = tc.nodeFactory(); X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); if (((X10TypeSystem) tc.typeSystem()).isStructType(mi.container().get())) { - // System.err.println("X10MethodDecl_c: Golden. Setting flag for " + this + " to global final."); Flags xf = X10Flags.toX10Flags(mi.flags()).Global().Final(); mi.setFlags(xf); n = (X10MethodDecl_c) n.flags(n.flags().flags(xf)); Modified: trunk/x10.compiler/src/x10/ast/X10New_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10New_c.java 2009-09-13 02:24:30 UTC (rev 11207) +++ trunk/x10.compiler/src/x10/ast/X10New_c.java 2009-09-13 17:47:14 UTC (rev 11208) @@ -61,6 +61,8 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.X10TypeSystem_c; +import x10.visit.TryTypeChecker; +import x10.visit.TryVisitorI; /** * new C[T](e) @@ -73,6 +75,10 @@ this.typeArguments = TypedList.copyAndCheck(typeArguments, TypeNode.class, true); } + boolean isStructConstructorCall = false; + public void setStructConstructorCall() { + isStructConstructorCall = true; + } @Override public Node visitChildren(NodeVisitor v) { Expr qualifier = (Expr) visitChild(this.qualifier, v); @@ -454,7 +460,6 @@ typeCheckNested(tc); Type t = tn.type(); - // t = ((X10Type) t).setFlags(X10Flags.ROOTED); X10ClassType ct = (X10ClassType) X10TypeMixin.baseType(t); X10ConstructorInstance ci=null; @@ -469,6 +474,10 @@ ClassDef currentClassDef = c.currentClassDef(); ci = (X10ConstructorInstance) xts.findConstructor(ct, xts.ConstructorMatcher(ct, Collections.EMPTY_LIST, argTypes, c)); + if (xts.isStructType(ci.returnType()) && ! isStructConstructorCall) { + // Ths is an invocation of the class automatically constructed from a struct decl. + ci = ci.toRefCI(); + } } else { ConstructorDef dci = xts.defaultConstructor(this.position(), @@ -543,14 +552,18 @@ if (xci == null) return (X10ConstructorInstance) this.ci; Type type = xci.returnType(); + X10TypeSystem ts = (X10TypeSystem) tc.typeSystem(); // Add self.location == here to the return type. - XTerm selfVar = X10TypeMixin.selfVar(type); - X10TypeSystem xts = (X10TypeSystem) tc.typeSystem(); - X10Context xc = (X10Context) tc.context(); - XTerm locVar = xts.locVar(selfVar, xc); - type = X10TypeMixin.addBinding(type, locVar, xc.currentPlaceTerm()); - + if (! ts.isStructType(type)) { + XTerm selfVar = X10TypeMixin.selfVar(type); + X10TypeSystem xts = (X10TypeSystem) tc.typeSystem(); + X10Context xc = (X10Context) tc.context(); + XTerm locVar = xts.locVar(selfVar, xc); + type = X10TypeMixin.addBinding(type, locVar, xc.currentPlaceTerm()); + } + + if (body != null) { // If creating an anonymous class, we need to adjust the return type // to be based on anonType rather than on the supertype. @@ -563,4 +576,15 @@ return xci; // return (X10New_c) this.constructorInstance(xci).type(type); } + + /** + * This should be implemented by any node that wants to be visited by a TryVisitor. + * @param n + * @return + * @throws SemanticException + */ + public Node tryVisit(TryVisitorI n) throws SemanticException { + return n.tryVisitEdge(null, this); + } + } Modified: trunk/x10.compiler/src/x10/parser/X10Parser.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10Parser.java 2009-09-13 02:24:30 UTC (rev 11207) +++ trunk/x10.compiler/src/x10/parser/X10Parser.java 2009-09-13 17:47:14 UTC (rev 11208) @@ -2404,72 +2404,86 @@ } // - // Rule 84: FieldKeyword ::= val + // Rule 84: Super ::= extends struct ClassType // case 84: { - //#line 1513 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1512 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1510 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + TypeNode ClassType = (TypeNode) getRhsSym(3); + //#line 1512 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + AddFlags tn = (AddFlags) ClassType; + tn.addFlags(X10Flags.STRUCT); + setResult(tn); + break; + } + + // + // Rule 85: FieldKeyword ::= val + // + case 85: { + //#line 1520 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1513 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1520 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(Collections.singletonList(nf.FlagsNode(pos(), Flags.FINAL))); break; } // - // Rule 85: FieldKeyword ::= var + // Rule 86: FieldKeyword ::= var // - case 85: { - //#line 1518 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + case 86: { + //#line 1525 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1518 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1525 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(Collections.singletonList(nf.FlagsNode(pos(), Flags.NONE))); break; } // - // Rule 86: FieldKeyword ::= const + // Rule 87: FieldKeyword ::= const // - case 86: { - //#line 1523 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + case 87: { + //#line 1530 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1523 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1530 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(Collections.singletonList(nf.FlagsNode(pos(), Flags.FINAL.Static()))); break; } // - // Rule 87: VarKeyword ::= val + // Rule 88: VarKeyword ::= val // - case 87: { - //#line 1531 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + case 88: { + //#line 1538 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1531 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1538 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(Collections.singletonList(nf.FlagsNode(pos(), Flags.FINAL))); break; } // - // Rule 88: VarKeyword ::= var + // Rule 89: VarKeyword ::= var // - case 88: { - //#line 1536 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + case 89: { + //#line 1543 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1536 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1543 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(Collections.singletonList(nf.FlagsNode(pos(), Flags.NONE))); break; } // - // Rule 89: FieldDeclaration ::= FieldModifiersopt FieldKeyword FieldDeclarators ; + // Rule 90: FieldDeclaration ::= FieldModifiersopt FieldKeyword FieldDeclarators ; // - case 89: { - //#line 1543 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1541 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 90: { + //#line 1550 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1548 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List FieldModifiersopt = (List) getRhsSym(1); - //#line 1541 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1548 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List FieldKeyword = (List) getRhsSym(2); - //#line 1541 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1548 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List FieldDeclarators = (List) getRhsSym(3); - //#line 1543 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1550 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" FlagsNode fn = extractFlags(FieldModifiersopt, FieldKeyword); List l = new TypedList(new LinkedList(), ClassMember.class, false); @@ -2493,15 +2507,15 @@ } // - // Rule 90: FieldDeclaration ::= FieldModifiersopt FieldDeclarators ; + // Rule 91: FieldDeclaration ::= FieldModifiersopt FieldDeclarators ; // - case 90: { - //#line 1567 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1565 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 91: { + //#line 1574 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1572 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List FieldModifiersopt = (List) getRhsSym(1); - //#line 1565 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1572 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List FieldDeclarators = (List) getRhsSym(2); - //#line 1567 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1574 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" List FieldKeyword = Collections.singletonList(nf.FlagsNode(pos(), Flags.FINAL)); FlagsNode fn = extractFlags(FieldModifiersopt, FieldKeyword); @@ -2526,68 +2540,68 @@ } // - // Rule 120: IfThenStatement ::= if ( Expression ) Statement + // Rule 121: IfThenStatement ::= if ( Expression ) Statement // - case 120: { - //#line 1626 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1624 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 121: { + //#line 1633 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1631 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expression = (Expr) getRhsSym(3); - //#line 1624 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1631 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Stmt Statement = (Stmt) getRhsSym(5); - //#line 1626 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1633 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.If(pos(), Expression, Statement)); break; } // - // Rule 121: IfThenElseStatement ::= if ( Expression ) Statement$s1 else Statement$s2 + // Rule 122: IfThenElseStatement ::= if ( Expression ) Statement$s1 else Statement$s2 // - case 121: { - //#line 1632 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1630 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 122: { + //#line 1639 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1637 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expression = (Expr) getRhsSym(3); - //#line 1630 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1637 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Stmt s1 = (Stmt) getRhsSym(5); - //#line 1630 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1637 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Stmt s2 = (Stmt) getRhsSym(7); - //#line 1632 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1639 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.If(pos(), Expression, s1, s2)); break; } // - // Rule 122: EmptyStatement ::= ; + // Rule 123: EmptyStatement ::= ; // - case 122: { - //#line 1638 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + case 123: { + //#line 1645 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1638 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1645 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Empty(pos())); break; } // - // Rule 123: LabeledStatement ::= Identifier : LoopStatement + // Rule 124: LabeledStatement ::= Identifier : LoopStatement // - case 123: { - //#line 1644 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1642 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 124: { + //#line 1651 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1649 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(1); - //#line 1642 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1649 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Stmt LoopStatement = (Stmt) getRhsSym(3); - //#line 1644 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1651 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Labeled(pos(), Identifier, LoopStatement)); break; } // - // Rule 129: ExpressionStatement ::= StatementExpression ; + // Rule 130: ExpressionStatement ::= StatementExpression ; // - case 129: { - //#line 1656 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1654 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 130: { + //#line 1663 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1661 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr StatementExpression = (Expr) getRhsSym(1); - //#line 1656 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1663 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" boolean eval = true; if (StatementExpression instanceof X10Call) { X10Call c = (X10Call) StatementExpression; @@ -2610,85 +2624,85 @@ } // - // Rule 137: AssertStatement ::= assert Expression ; + // Rule 138: AssertStatement ::= assert Expression ; // - case 137: { - //#line 1687 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1685 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 138: { + //#line 1694 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1692 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expression = (Expr) getRhsSym(2); - //#line 1687 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1694 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Assert(pos(), Expression)); break; } // - // Rule 138: AssertStatement ::= assert Expression$expr1 : Expression$expr2 ; + // Rule 139: AssertStatement ::= assert Expression$expr1 : Expression$expr2 ; // - case 138: { - //#line 1692 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1690 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 139: { + //#line 1699 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1697 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr expr1 = (Expr) getRhsSym(2); - //#line 1690 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1697 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr expr2 = (Expr) getRhsSym(4); - //#line 1692 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1699 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Assert(pos(), expr1, expr2)); break; } // - // Rule 139: SwitchStatement ::= switch ( Expression ) SwitchBlock + // Rule 140: SwitchStatement ::= switch ( Expression ) SwitchBlock // - case 139: { - //#line 1698 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1696 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 140: { + //#line 1705 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1703 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expression = (Expr) getRhsSym(3); - //#line 1696 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1703 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List SwitchBlock = (List) getRhsSym(5); - //#line 1698 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1705 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Switch(pos(), Expression, SwitchBlock)); break; } // - // Rule 140: SwitchBlock ::= { SwitchBlockStatementGroupsopt SwitchLabelsopt } + // Rule 141: SwitchBlock ::= { SwitchBlockStatementGroupsopt SwitchLabelsopt } // - case 140: { - //#line 1704 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1702 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 141: { + //#line 1711 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1709 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List SwitchBlockStatementGroupsopt = (List) getRhsSym(2); - //#line 1702 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1709 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List SwitchLabelsopt = (List) getRhsSym(3); - //#line 1704 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1711 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" SwitchBlockStatementGroupsopt.addAll(SwitchLabelsopt); setResult(SwitchBlockStatementGroupsopt); break; } // - // Rule 142: SwitchBlockStatementGroups ::= SwitchBlockStatementGroups SwitchBlockStatementGroup + // Rule 143: SwitchBlockStatementGroups ::= SwitchBlockStatementGroups SwitchBlockStatementGroup // - case 142: { - //#line 1712 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1710 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 143: { + //#line 1719 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1717 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List SwitchBlockStatementGroups = (List) getRhsSym(1); - //#line 1710 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1717 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List SwitchBlockStatementGroup = (List) getRhsSym(2); - //#line 1712 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1719 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" SwitchBlockStatementGroups.addAll(SwitchBlockStatementGroup); // setResult(SwitchBlockStatementGroups); break; } // - // Rule 143: SwitchBlockStatementGroup ::= SwitchLabels BlockStatements + // Rule 144: SwitchBlockStatementGroup ::= SwitchLabels BlockStatements // - case 143: { - //#line 1719 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1717 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 144: { + //#line 1726 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1724 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List SwitchLabels = (List) getRhsSym(1); - //#line 1717 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1724 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List BlockStatements = (List) getRhsSym(2); - //#line 1719 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1726 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" List l = new TypedList(new LinkedList(), SwitchElement.class, false); l.addAll(SwitchLabels); l.add(nf.SwitchBlock(pos(), BlockStatements)); @@ -2697,13 +2711,13 @@ } // - // Rule 144: SwitchLabels ::= SwitchLabel + // Rule 145: SwitchLabels ::= SwitchLabel // - case 144: { - //#line 1728 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1726 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 145: { + //#line 1735 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1733 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Case SwitchLabel = (Case) getRhsSym(1); - //#line 1728 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1735 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" List l = new TypedList(new LinkedList(), Case.class, false); l.add(SwitchLabel); setResult(l); @@ -2711,97 +2725,97 @@ } // - // Rule 145: SwitchLabels ::= SwitchLabels SwitchLabel + // Rule 146: SwitchLabels ::= SwitchLabels SwitchLabel // - case 145: { - //#line 1735 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1733 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 146: { + //#line 1742 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1740 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List SwitchLabels = (List) getRhsSym(1); - //#line 1733 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1740 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Case SwitchLabel = (Case) getRhsSym(2); - //#line 1735 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1742 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" SwitchLabels.add(SwitchLabel); //setResult(SwitchLabels); break; } // - // Rule 146: SwitchLabel ::= case ConstantExpression : + // Rule 147: SwitchLabel ::= case ConstantExpression : // - case 146: { - //#line 1742 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1740 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 147: { + //#line 1749 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1747 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr ConstantExpression = (Expr) getRhsSym(2); - //#line 1742 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1749 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Case(pos(), ConstantExpression)); break; } // - // Rule 147: SwitchLabel ::= default : + // Rule 148: SwitchLabel ::= default : // - case 147: { - //#line 1747 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + case 148: { + //#line 1754 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1747 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1754 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Default(pos())); break; } // - // Rule 148: WhileStatement ::= while ( Expression ) Statement + // Rule 149: WhileStatement ::= while ( Expression ) Statement // - case 148: { - //#line 1753 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1751 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 149: { + //#line 1760 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1758 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expression = (Expr) getRhsSym(3); - //#line 1751 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1758 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Stmt Statement = (Stmt) getRhsSym(5); - //#line 1753 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1760 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.While(pos(), Expression, Statement)); break; } // - // Rule 149: DoStatement ::= do Statement while ( Expression ) ; + // Rule 150: DoStatement ::= do Statement while ( Expression ) ; // - case 149: { - //#line 1759 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1757 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 150: { + //#line 1766 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1764 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Stmt Statement = (Stmt) getRhsSym(2); - //#line 1757 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1764 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expression = (Expr) getRhsSym(5); - //#line 1759 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1766 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Do(pos(), Statement, Expression)); break; } // - // Rule 152: BasicForStatement ::= for ( ForInitopt ; Expressionopt ; ForUpdateopt ) Statement + // Rule 153: BasicForStatement ::= for ( ForInitopt ; Expressionopt ; ForUpdateopt ) Statement // - case 152: { - //#line 1768 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1766 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 153: { + //#line 1775 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1773 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List ForInitopt = (List) getRhsSym(3); - //#line 1766 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1773 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expressionopt = (Expr) getRhsSym(5); - //#line 1766 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1773 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List ForUpdateopt = (List) getRhsSym(7); - //#line 1766 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1773 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Stmt Statement = (Stmt) getRhsSym(9); - //#line 1768 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1775 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.For(pos(), ForInitopt, Expressionopt, ForUpdateopt, Statement)); break; } // - // Rule 154: ForInit ::= LocalVariableDeclaration + // Rule 155: ForInit ::= LocalVariableDeclaration // - case 154: { - //#line 1775 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1773 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 155: { + //#line 1782 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1780 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List LocalVariableDeclaration = (List) getRhsSym(1); - //#line 1775 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1782 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" List l = new TypedList(new LinkedList(), ForInit.class, false); l.addAll(LocalVariableDeclaration); //setResult(l); @@ -2809,13 +2823,13 @@ } // - // Rule 156: StatementExpressionList ::= StatementExpression + // Rule 157: StatementExpressionList ::= StatementExpression // - case 156: { - //#line 1785 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1783 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 157: { + //#line 1792 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1790 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr StatementExpression = (Expr) getRhsSym(1); - //#line 1785 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1792 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" List l = new TypedList(new LinkedList(), Eval.class, false); l.add(nf.Eval(pos(), StatementExpression)); setResult(l); @@ -2823,105 +2837,105 @@ } // - // Rule 157: StatementExpressionList ::= StatementExpressionList , StatementExpression + // Rule 158: StatementExpressionList ::= StatementExpressionList , StatementExpression // - case 157: { - //#line 1792 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1790 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 158: { + //#line 1799 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1797 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List StatementExpressionList = (List) getRhsSym(1); - //#line 1790 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1797 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr StatementExpression = (Expr) getRhsSym(3); - //#line 1792 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1799 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" StatementExpressionList.add(nf.Eval(pos(), StatementExpression)); break; } // - // Rule 158: BreakStatement ::= break Identifieropt ; + // Rule 159: BreakStatement ::= break Identifieropt ; // - case 158: { - //#line 1798 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1796 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 159: { + //#line 1805 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1803 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Id Identifieropt = (Id) getRhsSym(2); - //#line 1798 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1805 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Break(pos(), Identifieropt)); break; } // - // Rule 159: ContinueStatement ::= continue Identifieropt ; + // Rule 160: ContinueStatement ::= continue Identifieropt ; // - case 159: { - //#line 1804 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1802 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 160: { + //#line 1811 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1809 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Id Identifieropt = (Id) getRhsSym(2); - //#line 1804 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1811 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Continue(pos(), Identifieropt)); break; } // - // Rule 160: ReturnStatement ::= return Expressionopt ; + // Rule 161: ReturnStatement ::= return Expressionopt ; // - case 160: { - //#line 1810 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1808 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 161: { + //#line 1817 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1815 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expressionopt = (Expr) getRhsSym(2); - //#line 1810 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1817 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Return(pos(), Expressionopt)); break; } // - // Rule 161: ThrowStatement ::= throw Expression ; + // Rule 162: ThrowStatement ::= throw Expression ; // - case 161: { - //#line 1816 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1814 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 162: { + //#line 1823 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1821 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expression = (Expr) getRhsSym(2); - //#line 1816 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1823 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Throw(pos(), Expression)); break; } // - // Rule 162: TryStatement ::= try Block Catches + // Rule 163: TryStatement ::= try Block Catches // - case 162: { - //#line 1822 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1820 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 163: { + //#line 1829 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1827 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Block Block = (Block) getRhsSym(2); - //#line 1820 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1827 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List Catches = (List) getRhsSym(3); - //#line 1822 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1829 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Try(pos(), Block, Catches)); break; } // - // Rule 163: TryStatement ::= try Block Catchesopt Finally + // Rule 164: TryStatement ::= try Block Catchesopt Finally // - case 163: { - //#line 1827 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1825 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 164: { + //#line 1834 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1832 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Block Block = (Block) getRhsSym(2); - //#line 1825 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1832 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List Catchesopt = (List) getRhsSym(3); - //#line 1825 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1832 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Block Finally = (Block) getRhsSym(4); - //#line 1827 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1834 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Try(pos(), Block, Catchesopt, Finally)); break; } // - // Rule 164: Catches ::= CatchClause + // Rule 165: Catches ::= CatchClause // - case 164: { - //#line 1833 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1831 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 165: { + //#line 1840 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1838 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Catch CatchClause = (Catch) getRhsSym(1); - //#line 1833 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1840 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" List l = new TypedList(new LinkedList(), Catch.class, false); l.add(CatchClause); setResult(l); @@ -2929,84 +2943,84 @@ } // - // Rule 165: Catches ::= Catches CatchClause + // Rule 166: Catches ::= Catches CatchClause // - case 165: { - //#line 1840 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1838 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 166: { + //#line 1847 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1845 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List Catches = (List) getRhsSym(1); - //#line 1838 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1845 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Catch CatchClause = (Catch) getRhsSym(2); - //#line 1840 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1847 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" Catches.add(CatchClause); //setResult(Catches); break; } // - // Rule 166: CatchClause ::= catch ( FormalParameter ) Block + // Rule 167: CatchClause ::= catch ( FormalParameter ) Block // - case 166: { - //#line 1847 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1845 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 167: { + //#line 1854 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1852 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" X10Formal FormalParameter = (X10Formal) getRhsSym(3); - //#line 1845 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 1852 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Block Block = (Block) getRhsSym(5); - //#line 1847 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1854 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Catch(pos(), FormalParameter, Block)); break; } // - // Rule 167: Finally ::= finally Block + // Rule 168: Finally ::= finally Block // - case 167: { - //#line 1853 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1851 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 168: { + //#line 1860 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1858 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Block Block = (Block) getRhsSym(2); - //#line 1853 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1860 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(Block); break; } // - // Rule 168: NowStatement ::= now ( Clock ) Statement + // Rule 169: NowStatement ::= now ( Clock ) Statement // - case 168: { - //#line 1859 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 1857 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + case 169: { + //#line 1866 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 1864 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Clock = (Expr) getRhsSym(3); - //#line 1857 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + /... [truncated message content] |
From: <vj...@us...> - 2009-09-20 14:15:47
|
Revision: 11263 http://x10.svn.sourceforge.net/x10/?rev=11263&view=rev Author: vj0 Date: 2009-09-20 14:15:38 +0000 (Sun, 20 Sep 2009) Log Message: ----------- Fixed XTENLANG-364. That is, removed syntactic support for type parameters for closures. Note that several closure tests related to guards are still failing. Will be fixed in future code revision. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/Closure.java trunk/x10.compiler/src/x10/ast/ClosureCall.java trunk/x10.compiler/src/x10/ast/ClosureCall_c.java trunk/x10.compiler/src/x10/ast/Closure_c.java trunk/x10.compiler/src/x10/ast/FunctionTypeNode_c.java trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java trunk/x10.compiler/src/x10/ast/X10Boxed_c.java trunk/x10.compiler/src/x10/ast/X10Call_c.java trunk/x10.compiler/src/x10/ast/X10Formal_c.java trunk/x10.compiler/src/x10/ast/X10NodeFactory.java trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java trunk/x10.compiler/src/x10/ast/X10Unary_c.java trunk/x10.compiler/src/x10/parser/X10Parser.java trunk/x10.compiler/src/x10/parser/X10Parserprs.java trunk/x10.compiler/src/x10/parser/X10Parsersym.java trunk/x10.compiler/src/x10/parser/x10.g trunk/x10.compiler/src/x10/visit/Desugarer.java trunk/x10.compiler/src/x10/visit/Inliner.java trunk/x10.compiler/src/x10/visit/X10PrettyPrinterVisitor.java trunk/x10.runtime/src-x10/x10/array/PolyScanner.x10 trunk/x10.runtime/src-x10/x10/array/RectRegion.x10 trunk/x10.runtime/src-x10/x10/array/UnionRegion.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall0b_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall1a_MustFailCompile.x10 Added Paths: ----------- trunk/x10.tests/examples/Constructs/Closures/ClosureCall0a_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall1b_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall1c_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall1d_MustFailCompile.x10 Removed Paths: ------------- trunk/x10.tests/examples/Constructs/Closures/ClosureCall0a.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall1b.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall1c.x10 trunk/x10.tests/examples/Constructs/Closures/ClosureCall1d.x10 Modified: trunk/x10.compiler/src/x10/ast/Closure.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Closure.java 2009-09-20 09:32:18 UTC (rev 11262) +++ trunk/x10.compiler/src/x10/ast/Closure.java 2009-09-20 14:15:38 UTC (rev 11263) @@ -22,8 +22,8 @@ public interface Closure extends Expr, CodeBlock { - List<TypeParamNode> typeParameters(); - Closure typeParameters(List<TypeParamNode> typeParams); + // List<TypeParamNode> typeParameters(); + // Closure typeParameters(List<TypeParamNode> typeParams); /** The closure's formal parameters. * @return A list of {@link polyglot.ast.Formal Formal} Modified: trunk/x10.compiler/src/x10/ast/ClosureCall.java =================================================================== --- trunk/x10.compiler/src/x10/ast/ClosureCall.java 2009-09-20 09:32:18 UTC (rev 11262) +++ trunk/x10.compiler/src/x10/ast/ClosureCall.java 2009-09-20 14:15:38 UTC (rev 11263) @@ -30,8 +30,8 @@ */ ClosureCall target(Expr target); - List<TypeNode> typeArgs(); - ClosureCall typeArgs(List<TypeNode> typeArgs); + // List<TypeNode> typeArgs(); + // ClosureCall typeArgs(List<TypeNode> typeArgs); /** Get the method instance of the call. */ public X10MethodInstance closureInstance(); Modified: trunk/x10.compiler/src/x10/ast/ClosureCall_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/ClosureCall_c.java 2009-09-20 09:32:18 UTC (rev 11262) +++ trunk/x10.compiler/src/x10/ast/ClosureCall_c.java 2009-09-20 14:15:38 UTC (rev 11263) @@ -62,18 +62,18 @@ public class ClosureCall_c extends Expr_c implements ClosureCall { protected Expr target; - protected List<TypeNode> typeArgs; + // protected List<TypeNode> typeArgs; protected List<Expr> arguments; protected X10MethodInstance ci; - public ClosureCall_c(Position pos, Expr target, List<TypeNode> typeArgs, List<Expr> arguments) { + public ClosureCall_c(Position pos, Expr target, /*List<TypeNode> typeArgs,*/ List<Expr> arguments) { super(pos); assert target != null; - assert typeArgs != null; + //assert typeArgs != null; assert arguments != null; this.target= target; - this.typeArgs = TypedList.copyAndCheck(typeArgs, TypeNode.class, true); +// this.typeArgs = TypedList.copyAndCheck(typeArgs, TypeNode.class, true); this.arguments = TypedList.copyAndCheck(arguments, Expr.class, true); } @@ -117,13 +117,13 @@ if (!(target instanceof Closure)) { return ((Term) target); } - return listChild(typeArgs, listChild(arguments, null)); + return listChild(arguments, null); } @Override public List<Term> acceptCFG(CFGBuilder v, List<Term> succs) { List<Term> args = new ArrayList<Term>(); - args.addAll(typeArgs); +// args.addAll(typeArgs); args.addAll(arguments); if (!(target instanceof Closure)) { // Don't visit a literal closure here @@ -182,28 +182,30 @@ } /** Get the actual arguments of the call. */ - public List<TypeNode> typeArgs() { + /* public List<TypeNode> typeArgs() { return this.typeArgs; } - + */ /** Set the actual arguments of the call. */ - public ClosureCall typeArgs(List<TypeNode> typeArgs) { + /* public ClosureCall typeArgs(List<TypeNode> typeArgs) { assert typeArgs != null; ClosureCall_c n= (ClosureCall_c) copy(); n.typeArgs= TypedList.copyAndCheck(typeArgs, TypeNode.class, true); return n; - } + }*/ public List<TypeNode> typeArguments() { - return typeArgs(); + return Collections.EMPTY_LIST; // typeArgs(); } /** Reconstruct the call. */ - protected ClosureCall_c reconstruct(Expr target, List<TypeNode> typeArgs, List<Expr> arguments) { - if (target != this.target || !CollectionUtil.allEqual(typeArgs, this.typeArgs) || !CollectionUtil.allEqual(arguments, this.arguments)) { + protected ClosureCall_c reconstruct(Expr target, /*List<TypeNode> typeArgs,*/ List<Expr> arguments) { + if (target != this.target + // || !CollectionUtil.allEqual(typeArgs, this.typeArgs) + || !CollectionUtil.allEqual(arguments, this.arguments)) { ClosureCall_c n= (ClosureCall_c) copy(); n.target= target; - n.typeArgs= TypedList.copyAndCheck(typeArgs, TypeNode.class, true); + // n.typeArgs= TypedList.copyAndCheck(typeArgs, TypeNode.class, true); n.arguments= TypedList.copyAndCheck(arguments, Expr.class, true); return n; } @@ -213,9 +215,9 @@ /** Visit the children of the call. */ public Node visitChildren(NodeVisitor v) { Expr target= (Expr) visitChild(this.target, v); - List typeArgs= visitList(this.typeArgs, v); +// List typeArgs= visitList(this.typeArgs, v); List arguments= visitList(this.arguments, v); - return reconstruct(target, typeArgs, arguments); + return reconstruct(target, /*typeArgs,*/ arguments); } public Node buildTypes(TypeBuilder tb) throws SemanticException { @@ -255,12 +257,13 @@ } */ - List<Type> typeArgs = new ArrayList<Type>(this.typeArgs.size()); +List<Type> typeArgs = Collections.EMPTY_LIST; + //new ArrayList<Type>(this.typeArgs.size()); - for (TypeNode tn : this.typeArgs) { +/* for (TypeNode tn : this.typeArgs) { typeArgs.add(tn.type()); } - + */ List<Type> actualTypes = new ArrayList<Type>(this.arguments.size()); for (Expr ei : arguments) { actualTypes.add(ei.type()); @@ -305,7 +308,8 @@ // if (! targetType.isSubtype(ct)) // throw new SemanticException("Invalid closure call; target does not implement " + ct + ".", position()); X10NodeFactory nf = (X10NodeFactory) tc.nodeFactory(); - X10Call_c n = (X10Call_c) nf.X10Call(position(), target(), nf.Id(position(), mi.name().toString()), typeArgs(), args); + X10Call_c n = (X10Call_c) nf.X10Call(position(), target(), + nf.Id(position(), mi.name().toString()), Collections.EMPTY_LIST, args); n = (X10Call_c) n.methodInstance(mi); n = (X10Call_c) n.type(mi.returnType()); return n; Modified: trunk/x10.compiler/src/x10/ast/Closure_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Closure_c.java 2009-09-20 09:32:18 UTC (rev 11262) +++ trunk/x10.compiler/src/x10/ast/Closure_c.java 2009-09-20 14:15:38 UTC (rev 11263) @@ -65,7 +65,7 @@ import x10.types.X10TypeSystem; public class Closure_c extends Expr_c implements Closure { - List<TypeParamNode> typeParameters; + // List<TypeParamNode> typeParameters; List<Formal> formals; TypeNode returnType; List<TypeNode> throwTypes; @@ -82,9 +82,10 @@ super(pos); } - public Closure_c(Position pos, List<TypeParamNode> typeParams, List<Formal> formals, TypeNode returnType, DepParameterExpr guard, List<TypeNode> throwTypes, Block body) { + public Closure_c(Position pos, List<Formal> formals, + TypeNode returnType, DepParameterExpr guard, List<TypeNode> throwTypes, Block body) { super(pos); - this.typeParameters = TypedList.copyAndCheck(typeParams, TypeParamNode.class, true); +// this.typeParameters = TypedList.copyAndCheck(typeParams, TypeParamNode.class, true); this.formals = TypedList.copyAndCheck(formals, Formal.class, true); this.returnType = returnType; this.guard = guard; @@ -92,19 +93,21 @@ this.body = body; } - public List<TypeParamNode> typeParameters() { + /* public List<TypeParamNode> typeParameters() { return typeParameters; } + */ public Closure position(Position pos) { Closure_c n = (Closure_c) copy(); n.position=pos; return n; } - public Closure typeParameters(List<TypeParamNode> typeParams) { + /* public Closure typeParameters(List<TypeParamNode> typeParams) { Closure_c n = (Closure_c) copy(); n.typeParameters=TypedList.copyAndCheck(typeParams, TypeParamNode.class, true); return n; } + */ public List<Formal> formals() { return formals; @@ -186,10 +189,14 @@ } /** Reconstruct the closure. */ - protected Closure_c reconstruct(List<TypeParamNode> typeParams, List<Formal> formals, DepParameterExpr guard, TypeNode returnType, List<TypeNode> throwTypes, Block body) { - if (! CollectionUtil.allEqual(typeParams, this.typeParameters) || !CollectionUtil.allEqual(formals, this.formals) || returnType != this.returnType || guard != this.guard || ! CollectionUtil.allEqual(throwTypes, this.throwTypes) || body != this.body) { + protected Closure_c reconstruct(/*List<TypeParamNode> typeParams,*/ List<Formal> formals, DepParameterExpr guard, TypeNode returnType, List<TypeNode> throwTypes, Block body) { + if (/*! CollectionUtil.allEqual(typeParams, this.typeParameters) ||*/ + !CollectionUtil.allEqual(formals, this.formals) + || returnType != this.returnType + || guard != this.guard + || ! CollectionUtil.allEqual(throwTypes, this.throwTypes) || body != this.body) { Closure_c n = (Closure_c) copy(); - n.typeParameters = TypedList.copyAndCheck(typeParams, TypeParamNode.class, true); + // n.typeParameters = TypedList.copyAndCheck(typeParams, TypeParamNode.class, true); n.formals = TypedList.copyAndCheck(formals, Formal.class, true); n.guard = guard; n.returnType = returnType; @@ -203,7 +210,7 @@ /** Visit the children of the expression. */ @SuppressWarnings("unchecked") public Node visitChildren(NodeVisitor v) { - List<TypeParamNode> typeParams = visitList(this.typeParameters, v); + //List<TypeParamNode> typeParams = visitList(this.typeParameters, v); List<Formal> formals = visitList(this.formals, v); DepParameterExpr guard = (DepParameterExpr) visitChild(this.guard, v); @@ -211,7 +218,7 @@ List<TypeNode> throwTypes = visitList(this.throwTypes, v); Block body = (Block) visitChild(this.body, v); - return reconstruct(typeParams, formals, guard, returnType, throwTypes, body); + return reconstruct(/*typeParams,*/ formals, guard, returnType, throwTypes, body); } public Node buildTypesOverride(TypeBuilder tb) throws SemanticException { @@ -243,14 +250,16 @@ thisVar = ct.thisVar(); } - ClosureDef mi = ts.closureDef(position(), Types.ref(ct.asType()), - Types.ref(code.asInstance()), returnType.typeRef(), - Collections.<Ref<? extends Type>>emptyList(), - Collections.<Ref<? extends Type>>emptyList(), - thisVar, - Collections.<LocalDef>emptyList(), null, null, Collections.<Ref<? extends Type>>emptyList()); - // System.err.println("Closure_c: Golden! TypeBuilder: return type for " + this + " is " - // + returnType + " with ref "+ returnType.typeRef()); + ClosureDef mi = ts.closureDef(position(), + Types.ref(ct.asType()), + Types.ref(code.asInstance()), + returnType.typeRef(), + Collections.<Ref<? extends Type>>emptyList(), + thisVar, + Collections.<LocalDef>emptyList(), + null, + //null, + Collections.<Ref<? extends Type>>emptyList()); if (returnType() instanceof UnknownTypeNode) { mi.inferReturnType(true); } @@ -259,21 +268,19 @@ // since closures don't have names, we'll never have to resolve the signature. Just push the code context. TypeBuilder tb2 = tb.pushCode(mi); - // System.err.println("Closure_c: Golden! TypeBuilder: visiting children of " + this ); - Closure_c n = (Closure_c) this.del().visitChildren(tb2); - //System.err.println("Closure_c: Golden! TypeBuilder: done visiting children of " + this); - + if (n.guard() != null) { mi.setGuard(n.guard().valueConstraint()); - mi.setTypeGuard(n.guard().typeConstraint()); + + //mi.setTypeGuard(n.guard().typeConstraint()); } - List<Ref<? extends Type>> typeParameters = new ArrayList<Ref<? extends Type>>(n.typeParameters().size()); + /* List<Ref<? extends Type>> typeParameters = new ArrayList<Ref<? extends Type>>(n.typeParameters().size()); for (TypeParamNode tpn : n.typeParameters()) { typeParameters.add(Types.ref(tpn.type())); } - +*/ List<Ref<? extends Type>> formalTypes = new ArrayList<Ref<? extends Type>>(n.formals().size()); for (Formal f : n.formals()) { formalTypes.add(f.type().typeRef()); @@ -291,7 +298,7 @@ mi.setFormalNames(formalNames); mi.setReturnType(n.returnType().typeRef()); - mi.setTypeParameters(typeParameters); + // mi.setTypeParameters(Collections.EMPTY_LIST); mi.setFormalTypes(formalTypes); mi.setThrowTypes(throwTypes); @@ -323,9 +330,10 @@ if (child != body()) { // Push formals so they're in scope in the types of the other formals. c = c.pushBlock(); - for (TypeParamNode f : typeParameters) { + /* for (TypeParamNode f : typeParameters) { f.addDecls(c); } + */ for (Formal f : formals) { f.addDecls(c); } @@ -404,7 +412,8 @@ } public Term firstChild() { - return listChild(typeParameters(), listChild(formals(), returnType)); + return //listChild(/*typeParameters(), + listChild(formals(), returnType); } /** @@ -416,13 +425,14 @@ */ @Override public List<Term> acceptCFG(CFGBuilder v, List<Term> succs) { - if (formals().isEmpty()) { + /* if (formals().isEmpty()) { v.visitCFGList(typeParameters(), returnType, ENTRY); } else { v.visitCFGList(typeParameters(), formals.get(0), ENTRY); - v.visitCFGList(formals(), returnType, ENTRY); - } + + }*/ + v.visitCFGList(formals(), returnType, ENTRY); // If building the CFG for the enclosing code, don't thread // in the closure body. Otherwise, we're building the CFG @@ -466,7 +476,8 @@ public String toString() { StringBuilder sb= new StringBuilder(); - if (! typeParameters.isEmpty()) { + + /*if (! typeParameters.isEmpty()) { sb.append("["); for(Iterator iter= typeParameters.iterator(); iter.hasNext(); ) { TypeParamNode tpn= (TypeParamNode) iter.next(); @@ -474,7 +485,7 @@ if (iter.hasNext()) sb.append(", "); } sb.append("]"); - } + }*/ sb.append(" ("); for(Iterator iter= formals.iterator(); iter.hasNext(); ) { Formal formal= (Formal) iter.next(); Modified: trunk/x10.compiler/src/x10/ast/FunctionTypeNode_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/FunctionTypeNode_c.java 2009-09-20 09:32:18 UTC (rev 11262) +++ trunk/x10.compiler/src/x10/ast/FunctionTypeNode_c.java 2009-09-20 14:15:38 UTC (rev 11263) @@ -86,11 +86,13 @@ throw new SemanticException("Function types with throws clauses are currently unsupported.", position()); if (guard != null) throw new SemanticException("Function types with guards are currently unsupported.", position()); - + if (typeParams.size() != 0) + throw new SemanticException("Function types with type parameters are currently unsupported.", position()); Type result = ts.closureType(position(), returnType.typeRef(), - typeParams, formalTypes, formalNames, + // typeParams, + formalTypes, formalNames, guard != null ? guard.valueConstraint() : null, - guard != null ? guard.typeConstraint() : null, + // guard != null ? guard.typeConstraint() : null, throwTypes); // Context c = ar.context(); Modified: trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java 2009-09-20 09:32:18 UTC (rev 11262) +++ trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java 2009-09-20 14:15:38 UTC (rev 11263) @@ -46,7 +46,7 @@ protected Expr place; public PlacedClosure_c(Position p, Expr place, TypeNode returnType, Block body) { - super(p, Collections.EMPTY_LIST, Collections.EMPTY_LIST, returnType, null, + super(p, Collections.EMPTY_LIST, returnType, null, Collections.EMPTY_LIST, body); this.place = place; } Modified: trunk/x10.compiler/src/x10/ast/X10Boxed_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Boxed_c.java 2009-09-20 09:32:18 UTC (rev 11262) +++ trunk/x10.compiler/src/x10/ast/X10Boxed_c.java 2009-09-20 14:15:38 UTC (rev 11263) @@ -245,12 +245,12 @@ Block body = nf.Block(position(), nf.LocalClassDecl(position(), Xdecl), nf.Return(position(), n)); - Closure closure = nf.Closure(position(), Collections.EMPTY_LIST, Collections.singletonList(xformal), null, nf.CanonicalTypeNode(position(), Types.ref(toType)), Collections.EMPTY_LIST, body); + Closure closure = nf.Closure(position(), Collections.singletonList(xformal), null, nf.CanonicalTypeNode(position(), Types.ref(toType)), Collections.EMPTY_LIST, body); closure = (Closure) this.visitChild(closure, tb); closure = (Closure) this.visitChild(closure, sr); closure = (Closure) this.visitChild(closure, tc2); - return check(nf.ClosureCall(position(), check(closure, tc), Collections.EMPTY_LIST, Collections.singletonList(e)), tc); + return check(nf.ClosureCall(position(), check(closure, tc), Collections.singletonList(e)), tc); } } Modified: trunk/x10.compiler/src/x10/ast/X10Call_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Call_c.java 2009-09-20 09:32:18 UTC (rev 11262) +++ trunk/x10.compiler/src/x10/ast/X10Call_c.java 2009-09-20 14:15:38 UTC (rev 11263) @@ -353,7 +353,8 @@ } if (e != null) { - ClosureCall ccx = nf.ClosureCall(position(), e, typeArguments(), arguments()); + assert typeArguments().size() == 0; + ClosureCall ccx = nf.ClosureCall(position(), e, arguments()); X10MethodInstance ci = (X10MethodInstance) ts.createMethodInstance(position(), new ErrorRef_c<MethodDef>(ts, position(), "Cannot get MethodDef before type-checking closure call.")); ccx = ccx.closureInstance(ci); Node n = ccx; @@ -393,22 +394,23 @@ } if (this.target == null) { - try { - Node n = this.typeCheckNullTarget(tc, typeArgs, argTypes, arguments); - if (cc != null) - throw new SemanticException("Ambiguous call; both " + - ((n instanceof X10New) - ? ((X10New) n).constructorInstance().toString() - : ((X10Call) n).methodInstance().toString()) - + " and closure match.", position()); - return n; - } - catch (SemanticException e) { - if (cc != null) - return cc.typeCheck(tc); - throw new SemanticException("Method or static constructor not found for " + - ((X10TypeSystem) tc.typeSystem()).MethodMatcher(null, name.id(), typeArgs, argTypes, c)); - } + Node n = null; + try { + n=this.typeCheckNullTarget(tc, typeArgs, argTypes, arguments); + } + catch (SemanticException e) { + if (cc != null) + return cc.typeCheck(tc); + throw new SemanticException("Method or static constructor not found for " + + ((X10TypeSystem) tc.typeSystem()).MethodMatcher(null, name.id(), typeArgs, argTypes, c)); + } + if (cc != null) + throw new SemanticException("Ambiguous call; both " + + ((n instanceof X10New) + ? ((X10New) n).constructorInstance().toString() + : ((X10Call) n).methodInstance().toString()) + + " and closure " + cc + " match.", position()); + return n; } if (target instanceof TypeNode) { Modified: trunk/x10.compiler/src/x10/ast/X10Formal_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Formal_c.java 2009-09-20 09:32:18 UTC (rev 11262) +++ trunk/x10.compiler/src/x10/ast/X10Formal_c.java 2009-09-20 14:15:38 UTC (rev 11263) @@ -321,7 +321,7 @@ // int arglist(i) = name[i]; Formal var = vars.get(i); Expr index = x10nf.IntLit(var.position(), IntLit.INT, i).type(ts.Int()); - Expr init = x10nf.ClosureCall(var.position(), arrayBase, Collections.EMPTY_LIST, Collections.singletonList(index)); + Expr init = x10nf.ClosureCall(var.position(), arrayBase, Collections.singletonList(index)); if (bli != null) { init = (Expr) init.disambiguate(tc).typeCheck(tc).checkConstants(tc); } Modified: trunk/x10.compiler/src/x10/ast/X10NodeFactory.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10NodeFactory.java 2009-09-20 09:32:18 UTC (rev 11262) +++ trunk/x10.compiler/src/x10/ast/X10NodeFactory.java 2009-09-20 14:15:38 UTC (rev 11263) @@ -144,9 +144,11 @@ Expr RegionMaker(Position pos, Expr left, Expr right); AssignPropertyCall AssignPropertyCall(Position pos, List<TypeNode> typeArgs, List<Expr> argList); - Closure Closure(Position pos, List<TypeParamNode> typeParams, List<Formal> formals, DepParameterExpr guard, TypeNode returnType, List<TypeNode> throwTypes, Block body); + Closure Closure(Position pos, List<Formal> formals, DepParameterExpr guard, TypeNode returnType, + List<TypeNode> throwTypes, Block body); - ClosureCall ClosureCall(Position position, Expr closure, List<TypeNode> typeArgs, List<Expr> args); + ClosureCall ClosureCall(Position position, Expr closure, List<Expr> args); + ClosureCall ClosureCall(Position position, Expr closure, List<TypeNode> typeargs, List<Expr> args); AnnotationNode AnnotationNode(Position pos, TypeNode tn); Modified: trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2009-09-20 09:32:18 UTC (rev 11262) +++ trunk/x10.compiler/src/x10/ast/X10NodeFactory_c.java 2009-09-20 14:15:38 UTC (rev 11263) @@ -809,9 +809,9 @@ return X10ConstructorCall(pos, kind, outer, Collections.EMPTY_LIST, args); } - public Closure Closure(Position pos, List<TypeParamNode> typeParams, List<Formal> formals, + public Closure Closure(Position pos, List<Formal> formals, DepParameterExpr guard, TypeNode returnType, List<TypeNode> throwTypes, Block body) { - Closure n = new Closure_c(pos, typeParams, formals, returnType, guard, throwTypes, body); + Closure n = new Closure_c(pos, formals, returnType, guard, throwTypes, body); X10ExtFactory_c ext_fac = (X10ExtFactory_c) extFactory(); n = (Closure) n.ext(ext_fac.extClosureImpl()); X10DelFactory_c del_fac = (X10DelFactory_c) delFactory(); @@ -820,15 +820,20 @@ } public Closure Closure(Closure c, Position pos) { - return Closure(pos, c.typeParameters(), c.formals(), c.guard(), c.returnType(), c.throwTypes(), + return Closure(pos, c.formals(), c.guard(), c.returnType(), c.throwTypes(), c.body()); } - public ClosureCall ClosureCall(Position pos, Expr closure, List<TypeNode> typeArgs, List<Expr> args) { - ClosureCall n = new ClosureCall_c(pos, closure, typeArgs, args); + public ClosureCall ClosureCall(Position pos, Expr closure, /*List<TypeNode> typeArgs,*/ List<Expr> args) { + ClosureCall n = new ClosureCall_c(pos, closure, args); n = (ClosureCall) n.ext(extFactory().extExpr()); n = (ClosureCall) n.del(delFactory().delExpr()); return n; } + public ClosureCall ClosureCall(Position pos, Expr closure, List<TypeNode> typeArgs, List<Expr> args) { + assert typeArgs==null || typeArgs.size()==0 : "Closures do not have type args."; + return ClosureCall(pos, closure, args); + + } public AnnotationNode AnnotationNode(Position pos, TypeNode tn) { AnnotationNode n = new AnnotationNode_c(pos, tn); Modified: trunk/x10.compiler/src/x10/ast/X10Unary_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Unary_c.java 2009-09-20 09:32:18 UTC (rev 11262) +++ trunk/x10.compiler/src/x10/ast/X10Unary_c.java 2009-09-20 14:15:38 UTC (rev 11263) @@ -120,7 +120,7 @@ ClosureCall e = (ClosureCall) expr; target = e.target(); args = e.arguments(); - typeArgs = e.typeArgs(); + typeArgs = Collections.EMPTY_LIST; // e.typeArgs(); } else if (expr instanceof X10Call) { X10Call e = (X10Call) expr; Modified: trunk/x10.compiler/src/x10/parser/X10Parser.java =================================================================== --- trunk/x10.compiler/src/x10/parser/X10Parser.java 2009-09-20 09:32:18 UTC (rev 11262) +++ trunk/x10.compiler/src/x10/parser/X10Parser.java 2009-09-20 14:15:38 UTC (rev 11263) @@ -3470,24 +3470,22 @@ } // - // Rule 205: ClosureExpression ::= TypeParametersopt FormalParameters WhereClauseopt ResultTypeopt Throwsopt => ClosureBody + // Rule 205: ClosureExpression ::= FormalParameters WhereClauseopt ResultTypeopt Throwsopt => ClosureBody // case 205: { - //#line 2118 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2116 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" - List TypeParametersopt = (List) getRhsSym(1); - //#line 2116 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" - List FormalParameters = (List) getRhsSym(2); - //#line 2116 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" - DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(3); - //#line 2116 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" - TypeNode ResultTypeopt = (TypeNode) getRhsSym(4); - //#line 2116 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" - List Throwsopt = (List) getRhsSym(5); - //#line 2116 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" - Block ClosureBody = (Block) getRhsSym(7); - //#line 2118 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - setResult(nf.Closure(pos(), TypeParametersopt, FormalParameters, WhereClauseopt, + //#line 2117 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2115 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + List FormalParameters = (List) getRhsSym(1); + //#line 2115 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + DepParameterExpr WhereClauseopt = (DepParameterExpr) getRhsSym(2); + //#line 2115 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + TypeNode ResultTypeopt = (TypeNode) getRhsSym(3); + //#line 2115 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + List Throwsopt = (List) getRhsSym(4); + //#line 2115 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + Block ClosureBody = (Block) getRhsSym(6); + //#line 2117 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + setResult(nf.Closure(pos(), FormalParameters, WhereClauseopt, ResultTypeopt == null ? nf.UnknownTypeNode(pos()) : ResultTypeopt, Throwsopt, ClosureBody)); break; } @@ -3496,10 +3494,10 @@ // Rule 206: LastExpression ::= Expression // case 206: { - //#line 2125 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2123 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2124 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2122 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr Expression = (Expr) getRhsSym(1); - //#line 2125 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2124 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.X10Return(pos(), Expression, true)); break; } @@ -3508,10 +3506,10 @@ // Rule 207: ClosureBody ::= CastExpression // case 207: { - //#line 2131 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2129 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2130 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2128 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr CastExpression = (Expr) getRhsSym(1); - //#line 2131 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2130 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Block(pos(), nf.X10Return(pos(), CastExpression, true))); break; } @@ -3520,14 +3518,14 @@ // Rule 208: ClosureBody ::= Annotationsopt { BlockStatementsopt LastExpression } // case 208: { - //#line 2136 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2134 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2135 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2133 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List Annotationsopt = (List) getRhsSym(1); - //#line 2134 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2133 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List BlockStatementsopt = (List) getRhsSym(3); - //#line 2134 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2133 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Stmt LastExpression = (Stmt) getRhsSym(4); - //#line 2136 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2135 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" List<Stmt> l = new ArrayList<Stmt>(); l.addAll(BlockStatementsopt); l.add(LastExpression); @@ -3541,12 +3539,12 @@ // Rule 209: ClosureBody ::= Annotationsopt Block // case 209: { - //#line 2146 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2144 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2145 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2143 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List Annotationsopt = (List) getRhsSym(1); - //#line 2144 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2143 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Block Block = (Block) getRhsSym(2); - //#line 2146 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2145 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" Block b = Block; b = (Block) ((X10Ext) b.ext()).annotations(Annotationsopt); setResult(b); @@ -3557,12 +3555,12 @@ // Rule 210: AtExpression ::= at PlaceExpressionSingleList ClosureBody // case 210: { - //#line 2155 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2153 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2154 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2152 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr PlaceExpressionSingleList = (Expr) getRhsSym(2); - //#line 2153 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2152 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Block ClosureBody = (Block) getRhsSym(3); - //#line 2155 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2154 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.AtExpr(pos(), PlaceExpressionSingleList, nf.UnknownTypeNode(pos()), ClosureBody)); break; } @@ -3571,10 +3569,10 @@ // Rule 211: AsyncExpression ::= async ClosureBody // case 211: { - //#line 2161 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2159 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2160 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2158 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Block ClosureBody = (Block) getRhsSym(2); - //#line 2161 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2160 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Call(pos(), nf.Future(pos(), nf.Here(pos(getLeftSpan())), nf.UnknownTypeNode(pos()), ClosureBody), nf.Id(pos(), "force"))); break; } @@ -3583,12 +3581,12 @@ // Rule 212: AsyncExpression ::= async PlaceExpressionSingleList ClosureBody // case 212: { - //#line 2166 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2164 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2165 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2163 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr PlaceExpressionSingleList = (Expr) getRhsSym(2); - //#line 2164 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2163 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Block ClosureBody = (Block) getRhsSym(3); - //#line 2166 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2165 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Call(pos(), nf.Future(pos(), PlaceExpressionSingleList, nf.UnknownTypeNode(pos()), ClosureBody), nf.Id(pos(), "force"))); break; } @@ -3597,12 +3595,12 @@ // Rule 213: AsyncExpression ::= async [ Type ] ClosureBody // case 213: { - //#line 2171 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2169 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2170 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2168 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" TypeNode Type = (TypeNode) getRhsSym(3); - //#line 2169 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2168 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Block ClosureBody = (Block) getRhsSym(5); - //#line 2171 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2170 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Call(pos(), nf.Future(pos(), nf.Here(pos(getLeftSpan())), Type, ClosureBody), nf.Id(pos(), "force"))); break; } @@ -3611,14 +3609,14 @@ // Rule 214: AsyncExpression ::= async [ Type ] PlaceExpressionSingleList ClosureBody // case 214: { - //#line 2176 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2174 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2175 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2173 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" TypeNode Type = (TypeNode) getRhsSym(3); - //#line 2174 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2173 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr PlaceExpressionSingleList = (Expr) getRhsSym(5); - //#line 2174 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2173 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Block ClosureBody = (Block) getRhsSym(6); - //#line 2176 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2175 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Call(pos(), nf.Future(pos(), PlaceExpressionSingleList, Type, ClosureBody), nf.Id(pos(), "force"))); break; } @@ -3627,10 +3625,10 @@ // Rule 215: FutureExpression ::= future ClosureBody // case 215: { - //#line 2182 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2180 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2181 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2179 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Block ClosureBody = (Block) getRhsSym(2); - //#line 2182 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2181 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Future(pos(), nf.Here(pos(getLeftSpan())), nf.UnknownTypeNode(pos()), ClosureBody)); break; } @@ -3639,12 +3637,12 @@ // Rule 216: FutureExpression ::= future PlaceExpressionSingleList ClosureBody // case 216: { - //#line 2187 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2185 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2186 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2184 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr PlaceExpressionSingleList = (Expr) getRhsSym(2); - //#line 2185 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2184 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Block ClosureBody = (Block) getRhsSym(3); - //#line 2187 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2186 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Future(pos(), PlaceExpressionSingleList, nf.UnknownTypeNode(pos()), ClosureBody)); break; } @@ -3653,12 +3651,12 @@ // Rule 217: FutureExpression ::= future [ Type ] ClosureBody // case 217: { - //#line 2192 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2190 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2191 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2189 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" TypeNode Type = (TypeNode) getRhsSym(3); - //#line 2190 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2189 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Block ClosureBody = (Block) getRhsSym(5); - //#line 2192 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2191 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Future(pos(), nf.Here(pos(getLeftSpan())), Type, ClosureBody)); break; } @@ -3667,14 +3665,14 @@ // Rule 218: FutureExpression ::= future [ Type ] PlaceExpressionSingleList ClosureBody // case 218: { - //#line 2197 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2195 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2196 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2194 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" TypeNode Type = (TypeNode) getRhsSym(3); - //#line 2195 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2194 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Expr PlaceExpressionSingleList = (Expr) getRhsSym(5); - //#line 2195 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2194 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Block ClosureBody = (Block) getRhsSym(6); - //#line 2197 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2196 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(nf.Future(pos(), PlaceExpressionSingleList, Type, ClosureBody)); break; } @@ -3690,9 +3688,9 @@ // Rule 221: PropertyListopt ::= $Empty // case 221: { - //#line 2208 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2207 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2208 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2207 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new TypedList(new LinkedList(), PropertyDecl.class, false)); break; } @@ -3715,9 +3713,9 @@ // Rule 227: ClassModifiersopt ::= $Empty // case 227: { - //#line 2223 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2222 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2223 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2222 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(Collections.singletonList(nf.FlagsNode(Position.COMPILER_GENERATED, X10Flags.toX10Flags(Flags.NONE)))); break; } @@ -3725,9 +3723,9 @@ // Rule 229: TypeDefModifiersopt ::= $Empty // case 229: { - //#line 2229 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2228 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2229 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2228 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(Collections.singletonList(nf.FlagsNode(Position.COMPILER_GENERATED, X10Flags.toX10Flags(Flags.NONE)))); break; } @@ -3742,9 +3740,9 @@ // Rule 232: Unsafeopt ::= unsafe // case 232: { - //#line 2237 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2236 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2237 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2236 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" // any value distinct from null setResult(this); break; @@ -3754,9 +3752,9 @@ // Rule 233: ClockedClauseopt ::= $Empty // case 233: { - //#line 2244 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2243 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2244 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2243 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new TypedList(new LinkedList(), Expr.class, false)); break; } @@ -3765,10 +3763,10 @@ // Rule 235: identifier ::= IDENTIFIER$ident // case 235: { - //#line 2255 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2253 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2254 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2252 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" IToken ident = (IToken) getRhsIToken(1); - //#line 2255 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2254 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" ident.setKind(X10Parsersym.TK_IDENTIFIER); setResult(id(getRhsFirstTokenIndex(1))); break; @@ -3778,10 +3776,10 @@ // Rule 236: TypeName ::= Identifier // case 236: { - //#line 2262 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2260 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2261 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2259 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(1); - //#line 2262 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2261 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new X10ParsedName(nf, ts, pos(), Identifier)); break; } @@ -3790,12 +3788,12 @@ // Rule 237: TypeName ::= TypeName . Identifier // case 237: { - //#line 2267 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2265 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2266 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2264 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" ParsedName TypeName = (ParsedName) getRhsSym(1); - //#line 2265 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2264 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(3); - //#line 2267 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2266 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new X10ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), @@ -3808,10 +3806,10 @@ // Rule 239: TypeArguments ::= [ TypeArgumentList ] // case 239: { - //#line 2279 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2277 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2278 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2276 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List TypeArgumentList = (List) getRhsSym(2); - //#line 2279 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2278 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(TypeArgumentList); break; } @@ -3820,10 +3818,10 @@ // Rule 240: TypeArgumentList ::= Type // case 240: { - //#line 2286 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2284 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2285 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2283 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" TypeNode Type = (TypeNode) getRhsSym(1); - //#line 2286 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2285 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" List l = new ArrayList(); l.add(Type); setResult(l); @@ -3834,12 +3832,12 @@ // Rule 241: TypeArgumentList ::= TypeArgumentList , Type // case 241: { - //#line 2293 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2291 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2292 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2290 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" List TypeArgumentList = (List) getRhsSym(1); - //#line 2291 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2290 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" TypeNode Type = (TypeNode) getRhsSym(3); - //#line 2293 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2292 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" TypeArgumentList.add(Type); break; } @@ -3848,10 +3846,10 @@ // Rule 242: PackageName ::= Identifier // case 242: { - //#line 2303 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2301 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2302 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2300 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(1); - //#line 2303 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2302 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new X10ParsedName(nf, ts, pos(), Identifier)); break; } @@ -3860,12 +3858,12 @@ // Rule 243: PackageName ::= PackageName . Identifier // case 243: { - //#line 2308 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2306 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2307 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2305 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" ParsedName PackageName = (ParsedName) getRhsSym(1); - //#line 2306 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2305 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(3); - //#line 2308 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2307 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new X10ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), @@ -3878,10 +3876,10 @@ // Rule 244: ExpressionName ::= Identifier // case 244: { - //#line 2324 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2322 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2323 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2321 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(1); - //#line 2324 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2323 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new X10ParsedName(nf, ts, pos(), Identifier)); break; } @@ -3890,12 +3888,12 @@ // Rule 245: ExpressionName ::= AmbiguousName . Identifier // case 245: { - //#line 2329 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2327 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2328 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2326 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" ParsedName AmbiguousName = (ParsedName) getRhsSym(1); - //#line 2327 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2326 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(3); - //#line 2329 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2328 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new X10ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), @@ -3908,10 +3906,10 @@ // Rule 246: MethodName ::= Identifier // case 246: { - //#line 2339 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2337 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2338 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2336 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(1); - //#line 2339 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2338 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new X10ParsedName(nf, ts, pos(), Identifier)); break; } @@ -3920,12 +3918,12 @@ // Rule 247: MethodName ::= AmbiguousName . Identifier // case 247: { - //#line 2344 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2342 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2343 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2341 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" ParsedName AmbiguousName = (ParsedName) getRhsSym(1); - //#line 2342 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2341 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(3); - //#line 2344 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2343 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" setResult(new X10ParsedName(nf, ts, pos(getLeftSpan(), getRightSpan()), @@ -3938,10 +3936,10 @@ // Rule 248: PackageOrTypeName ::= Identifier // case 248: { - //#line 2354 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" - //#line 2352 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" + //#line 2353 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2351 "C:/eclipsews/v9/x10.compiler/src/x10/parser/x10.g" Id Identifier = (Id) getRhsSym(1); - //#line 2354 "C:/eclipsews/v9/lpg.generator/templates/java/btParserTemplateF.gi" + //#line 2353 "C:/eclipsews/v9/lpg.generator/templates... [truncated message content] |
From: <vj...@us...> - 2009-09-21 00:34:41
|
Revision: 11265 http://x10.svn.sourceforge.net/x10/?rev=11265&view=rev Author: vj0 Date: 2009-09-21 00:34:24 +0000 (Mon, 21 Sep 2009) Log Message: ----------- Fixed a curious oversight. It used to be the case that if a method mi implemented a method mj defined in an interface, then no check was made to ensure that the return type of mi was a subtype of the return type of mj. (Not sure how long this has been the case.) This is now fixed. This revealed some type-checking bugs in PolyMat/PolyRegion/LocalArray that have also now been fixed. Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/FunctionTypeNode_c.java trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java trunk/x10.compiler/src/x10/ast/X10LocalAssign_c.java trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java trunk/x10.runtime/src-x10/x10/array/LocalArray.x10 trunk/x10.runtime/src-x10/x10/array/PolyMat.x10 trunk/x10.runtime/src-x10/x10/array/PolyRegion.x10 Modified: trunk/x10.compiler/src/x10/ast/FunctionTypeNode_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/FunctionTypeNode_c.java 2009-09-20 14:27:01 UTC (rev 11264) +++ trunk/x10.compiler/src/x10/ast/FunctionTypeNode_c.java 2009-09-21 00:34:24 UTC (rev 11265) @@ -59,60 +59,60 @@ this.returnType = returnType; this.guard = guard; } - + @Override public Node disambiguate(ContextVisitor ar) throws SemanticException { - X10NodeFactory nf = (X10NodeFactory) ar.nodeFactory(); - X10TypeSystem ts = (X10TypeSystem) ar.typeSystem(); - FunctionTypeNode_c n = this; - List<Ref<? extends Type>> typeParams = new ArrayList<Ref<? extends Type>>(n.typeParameters().size()); - for (TypeParamNode tpn : n.typeParameters()) { - typeParams.add(Types.ref(tpn.type())); - } - List<Ref<? extends Type>> formalTypes = new ArrayList<Ref<? extends Type>>(n.formals().size()); - for (Formal f : n.formals()) { - formalTypes.add(f.type().typeRef()); - } - List<LocalDef> formalNames = new ArrayList<LocalDef>(n.formals().size()); - for (Formal f : n.formals()) { - formalNames.add(f.localDef()); - } - List<Ref<? extends Type>> throwTypes = new ArrayList<Ref<? extends Type>>(n.throwTypes().size()); - for (TypeNode tn : n.throwTypes()) { - throwTypes.add(tn.typeRef()); - } - - if (throwTypes.size() != 0) - throw new SemanticException("Function types with throws clauses are currently unsupported.", position()); - if (guard != null) - throw new SemanticException("Function types with guards are currently unsupported.", position()); - if (typeParams.size() != 0) - throw new SemanticException("Function types with type parameters are currently unsupported.", position()); - Type result = ts.closureType(position(), returnType.typeRef(), - // typeParams, - formalTypes, formalNames, - guard != null ? guard.valueConstraint() : null, - // guard != null ? guard.typeConstraint() : null, - throwTypes); - -// Context c = ar.context(); -// ClassType ct = c.currentClass(); -// CodeDef code = c.currentCode(); -// ClosureDef cd = ts.closureDef(position(), -// Types.ref(ct), -// code == null ? null : Types.ref(code.asInstance()), -// returnType.typeRef(), -// typeParams, -// formalTypes, -// formalNames, -// guard != null ? guard.xconstraint() : null, -// throwTypes); -// -// Type t = cd.asType(); -// Type result = t; + X10NodeFactory nf = (X10NodeFactory) ar.nodeFactory(); + X10TypeSystem ts = (X10TypeSystem) ar.typeSystem(); + FunctionTypeNode_c n = this; + List<Ref<? extends Type>> typeParams = new ArrayList<Ref<? extends Type>>(n.typeParameters().size()); + for (TypeParamNode tpn : n.typeParameters()) { + typeParams.add(Types.ref(tpn.type())); + } + List<Ref<? extends Type>> formalTypes = new ArrayList<Ref<? extends Type>>(n.formals().size()); + for (Formal f : n.formals()) { + formalTypes.add(f.type().typeRef()); + } + List<LocalDef> formalNames = new ArrayList<LocalDef>(n.formals().size()); + for (Formal f : n.formals()) { + formalNames.add(f.localDef()); + } + List<Ref<? extends Type>> throwTypes = new ArrayList<Ref<? extends Type>>(n.throwTypes().size()); + for (TypeNode tn : n.throwTypes()) { + throwTypes.add(tn.typeRef()); + } - ((LazyRef<Type>) typeRef()).update(result); - return nf.CanonicalTypeNode(position(), typeRef()); + if (throwTypes.size() != 0) + throw new SemanticException("Function types with throws clauses are currently unsupported.", position()); + if (guard != null) + throw new SemanticException("Function types with guards are currently unsupported.", position()); + if (typeParams.size() != 0) + throw new SemanticException("Function types with type parameters are currently unsupported.", position()); + Type result = ts.closureType(position(), returnType.typeRef(), + // typeParams, + formalTypes, formalNames, + guard != null ? guard.valueConstraint() : null, + // guard != null ? guard.typeConstraint() : null, + throwTypes); + + // Context c = ar.context(); + // ClassType ct = c.currentClass(); + // CodeDef code = c.currentCode(); + // ClosureDef cd = ts.closureDef(position(), + // Types.ref(ct), + // code == null ? null : Types.ref(code.asInstance()), + // returnType.typeRef(), + // typeParams, + // formalTypes, + // formalNames, + // guard != null ? guard.xconstraint() : null, + // throwTypes); + // + // Type t = cd.asType(); + // Type result = t; + + ((LazyRef<Type>) typeRef()).update(result); + return nf.CanonicalTypeNode(position(), typeRef()); } /* @@ -208,98 +208,98 @@ } public String toString() { - StringBuilder sb = new StringBuilder(); - if (typeParams.size() > 0) { - sb.append("["); - String sep = ""; - for (TypeParamNode p : typeParams) { - sb.append(sep); - sb.append(p); - sep = ", "; + StringBuilder sb = new StringBuilder(); + if (typeParams.size() > 0) { + sb.append("["); + String sep = ""; + for (TypeParamNode p : typeParams) { + sb.append(sep); + sb.append(p); + sep = ", "; + } + sb.append("]"); } - sb.append("]"); - } - sb.append("("); + sb.append("("); String sep = ""; for (Formal p : formals) { - sb.append(sep); - sb.append(p); - sep = ", "; + sb.append(sep); + sb.append(p); + sep = ", "; } - sb.append(")"); - if (guard != null) - sb.append(guard); - sb.append(" => "); - sb.append(returnType); - return sb.toString(); + sb.append(")"); + if (guard != null) + sb.append(guard); + sb.append(" => "); + sb.append(returnType); + return sb.toString(); } public void prettyPrint(CodeWriter w, PrettyPrinter tr) { w.begin(0); - + if (typeParams.size() > 0) { w.write("["); - + w.allowBreak(2, 2, "", 0); w.begin(0); - + for (Iterator<Formal> i = formals.iterator(); i.hasNext();) { Formal f = i.next(); - + print(f, w, tr); - + if (i.hasNext()) { w.write(","); w.allowBreak(0, " "); } } - + w.end(); w.write("]"); w.allowBreak(2, 2, " ", 1); } - + w.write("("); - + w.allowBreak(2, 2, "", 0); w.begin(0); - + for (Iterator<Formal> i = formals.iterator(); i.hasNext();) { Formal f = i.next(); - + print(f, w, tr); - + if (i.hasNext()) { w.write(","); w.allowBreak(0, " "); } } - + w.end(); w.write(")"); w.allowBreak(2, 2, " ", 1); - + if (guard != null) print(guard, w, tr); - + if (!throwTypes().isEmpty()) { w.allowBreak(6); w.write("throws "); - + for (Iterator i = throwTypes().iterator(); i.hasNext();) { TypeNode tn = (TypeNode) i.next(); print(tn, w, tr); - + if (i.hasNext()) { w.write(","); w.allowBreak(4, " "); } } } - + w.write(" => "); print(returnType, w, tr); - + w.end(); } Modified: trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2009-09-20 14:27:01 UTC (rev 11264) +++ trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2009-09-21 00:34:24 UTC (rev 11265) @@ -150,7 +150,7 @@ // TODO: do not strip out dependent clauses of parameter types /** Strip out dependent clauses. */ - public TypeNode simplify(TypeNode tn) { + /* public TypeNode simplify(TypeNode tn) { if (tn == null) return null; return (TypeNode) tn.visit(new NodeVisitor() { @@ -181,7 +181,7 @@ return n; } }); - } + }*/ public DepParameterExpr classInvariant() { return classInvariant; Modified: trunk/x10.compiler/src/x10/ast/X10LocalAssign_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10LocalAssign_c.java 2009-09-20 14:27:01 UTC (rev 11264) +++ trunk/x10.compiler/src/x10/ast/X10LocalAssign_c.java 2009-09-21 00:34:24 UTC (rev 11265) @@ -69,7 +69,8 @@ return n.right(e).type(t); } catch (SemanticException e) { - throw new SemanticException("Cannot assign " + s + " to " + t + ".", + throw new SemanticException("Cannot assign |" + right + "| (of type |" + s + ") to |" + + ((LocalAssign_c) n).local() + "| (of type " + t+").", n.position()); } } Modified: trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java =================================================================== --- trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java 2009-09-20 14:27:01 UTC (rev 11264) +++ trunk/x10.compiler/src/x10/types/X10TypeEnv_c.java 2009-09-21 00:34:24 UTC (rev 11265) @@ -123,7 +123,8 @@ try { // check that mj can override mi, which // includes access protection checks. - checkOverride((MethodInstance) mj.container(ct), (MethodInstance) mi.container(ct)); + checkOverride((MethodInstance) mj.container(ct), + (MethodInstance) mi.container(ct)); // checkOverride(ct, mj, mi); } catch (SemanticException e) { @@ -138,6 +139,7 @@ // the method implementation mj or mi was // declared in ct. So other checks will take // care of access issues + checkOverride(ct, mj, mi); } } } Modified: trunk/x10.runtime/src-x10/x10/array/LocalArray.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/LocalArray.x10 2009-09-20 14:27:01 UTC (rev 11264) +++ trunk/x10.runtime/src-x10/x10/array/LocalArray.x10 2009-09-21 00:34:24 UTC (rev 11265) @@ -22,24 +22,28 @@ // NB: local array, so don't do place checking // - final public safe def apply(i0: int){here==this.dist.onePlace}: T { + final public safe def apply(i0: int): T { + val r = raw() as Rail[T]!; if (checkBounds) checkBounds(i0); - return raw(layout.offset(i0)); + return r(layout.offset(i0)); } - final public safe def apply(i0: int, i1: int){here==this.dist.onePlace}: T { + final public safe def apply(i0: int, i1: int): T { + val r = raw() as Rail[T]!; if (checkBounds) checkBounds(i0, i1); - return raw(layout.offset(i0,i1)); + return r(layout.offset(i0,i1)); } - final public safe def apply(i0: int, i1: int, i2: int){here==this.dist.onePlace}: T { + final public safe def apply(i0: int, i1: int, i2: int): T { + val r = raw() as Rail[T]!; if (checkBounds) checkBounds(i0, i1, i2); - return raw(layout.offset(i0,i1,i2)); + return r(layout.offset(i0,i1,i2)); } - final public safe def apply(i0: int, i1: int, i2: int, i3: int){here==this.dist.onePlace}: T { + final public safe def apply(i0: int, i1: int, i2: int, i3: int): T { + val r = raw() as Rail[T]!; if (checkBounds) checkBounds(i0, i1, i2, i3); - return raw(layout.offset(i0,i1,i2,i3)); + return r(layout.offset(i0,i1,i2,i3)); } @@ -49,27 +53,31 @@ // NB: local array, so don't do place checking // - final public safe def set(v: T, i0: int){here==this.dist.onePlace}: T { + final public safe def set(v: T, i0: int): T { + val r = raw() as Rail[T]!; if (checkBounds) checkBounds(i0); - raw(layout.offset(i0)) = v; + r(layout.offset(i0)) = v; return v; } - final public safe def set(v: T, i0: int, i1: int){here==this.dist.onePlace}: T { + final public safe def set(v: T, i0: int, i1: int): T { + val r = raw() as Rail[T]!; if (checkBounds) checkBounds(i0, i1); - raw(layout.offset(i0,i1)) = v; + r(layout.offset(i0,i1)) = v; return v; } - final public safe def set(v: T, i0: int, i1: int, i2: int){here==this.dist.onePlace}: T { + final public safe def set(v: T, i0: int, i1: int, i2: int): T { + val r = raw() as Rail[T]!; if (checkBounds) checkBounds(i0, i1, i2); - raw(layout.offset(i0,i1,i2)) = v; + r(layout.offset(i0,i1,i2)) = v; return v; } - final public safe def set(v: T, i0: int, i1: int, i2: int, i3: int){here==this.dist.onePlace}: T { + final public safe def set(v: T, i0: int, i1: int, i2: int, i3: int): T { + val r = raw() as Rail[T]!; if (checkBounds) checkBounds(i0, i1, i2, i3); - raw(layout.offset(i0,i1,i2,i3)) = v; + r(layout.offset(i0,i1,i2,i3)) = v; return v; } Modified: trunk/x10.runtime/src-x10/x10/array/PolyMat.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/PolyMat.x10 2009-09-20 14:27:01 UTC (rev 11264) +++ trunk/x10.runtime/src-x10/x10/array/PolyMat.x10 2009-09-21 00:34:24 UTC (rev 11265) @@ -49,7 +49,7 @@ * captures the strongest halfspace. */ - def simplifyParallel(): PolyMat { + def simplifyParallel(): PolyMat{self.rank==this.rank} { if (rows==0) return this; @@ -76,7 +76,7 @@ * be expensive. */ - public def simplifyAll(): PolyMat { + public def simplifyAll(): PolyMat{self.rank==this.rank} { if (isSimplified) return this; @@ -116,7 +116,7 @@ * by eliminating axis k */ - def eliminate(k: int, simplifyDegenerate: boolean): PolyMat { + def eliminate(k: int, simplifyDegenerate: boolean): PolyMat{self.rank==this.rank} { val pmb = new PolyMatBuilder(rank); for (ir:PolyRow in this) { val ia = ir(k); Modified: trunk/x10.runtime/src-x10/x10/array/PolyRegion.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/array/PolyRegion.x10 2009-09-20 14:27:01 UTC (rev 11264) +++ trunk/x10.runtime/src-x10/x10/array/PolyRegion.x10 2009-09-21 00:34:24 UTC (rev 11265) @@ -30,7 +30,7 @@ // value // - public val mat: PolyMat; + public val mat: PolyMat{self.rank==this.rank}; // @@ -85,7 +85,7 @@ val scanner = PolyScanner.make(mat).iterator(); return scanner; }*/ - public def iterator()= PolyScanner.make(mat).iterator(); + public def iterator()= PolyScanner.make(mat).iterator() as Iterator[Point{self.rank==this.rank}]; // @@ -128,7 +128,7 @@ */ public def projection(axis: int): Region(1) { - var pm: PolyMat = mat; + var pm: PolyMat{self.rank==this.rank} = mat; for (var k: int = 0; k<rank; k++) if (k!=axis) pm = pm.eliminate(k, true); @@ -219,7 +219,7 @@ protected def computeBoundingBox(): Region(rank) { val min = Rail.makeVar[int](rank); val max = Rail.makeVar[int](rank); - var pm: PolyMat = mat; + var pm: PolyMat{self.rank==this.rank} = mat; for (var axis: int = 0; axis<rank; axis++) { var x: PolyMat = pm; for (var k: int = axis+1; k<rank; k++) @@ -312,13 +312,13 @@ return new PolyRegion(pm, false); } - protected def this(val pm: PolyMat, hack198:boolean): PolyRegion(pm.rank) { + protected def this(pm: PolyMat, hack198:boolean): PolyRegion(pm.rank) { super(pm.rank, pm.isRect(), pm.isZeroBased()); // simplifyAll catches more (all) stuff, but may be expensive. //this.mat = pm.simplifyParallel(); - this.mat = pm.simplifyAll(); + this.mat = pm.simplifyAll() as PolyMat{self.rank==this.rank}; // safe.. // cache stuff up front cache = new Cache(this, hack198); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <su...@us...> - 2009-09-21 17:55:11
|
Revision: 11270 http://x10.svn.sourceforge.net/x10/?rev=11270&view=rev Author: surs Date: 2009-09-21 17:55:05 +0000 (Mon, 21 Sep 2009) Log Message: ----------- Add x10.dist/lib directory to lib path, so that x10rt_*.a can be found. [important for non-pgas runtimes, such as standalone, mpi]. Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java trunk/x10.dist/bin/x10c++ Modified: trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java =================================================================== --- trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java 2009-09-21 16:58:09 UTC (rev 11269) +++ trunk/x10.compiler/src/x10cpp/postcompiler/CXXCommandBuilder.java 2009-09-21 17:55:05 UTC (rev 11270) @@ -38,6 +38,7 @@ public static final String PLATFORM = System.getenv("X10_PLATFORM")==null?"unknown":System.getenv("X10_PLATFORM"); public static final String X10LANG = System.getenv("X10LANG")==null?"../../../x10.runtime/src-cpp":System.getenv("X10LANG").replace(File.separatorChar, '/'); + public static final String X10DIST = System.getenv("X10DIST")==null?"../../../x10.dist":System.getenv("X10DIST").replace(File.separatorChar, '/'); public static final String MANIFEST = "libx10.mft"; public static final String[] MANIFEST_LOCATIONS = new String[] { @@ -46,7 +47,7 @@ }; protected static final String X10LIB = System.getenv("X10LIB")==null?"../../../pgas2/common/work":System.getenv("X10LIB").replace(File.separatorChar, '/'); - protected static final String X10GC = System.getenv("X10GC")==null?"../../../x10.dist":System.getenv("X10GC").replace(File.separatorChar, '/'); + protected static final String X10GC = System.getenv("X10GC")==null?X10DIST:System.getenv("X10GC").replace(File.separatorChar, '/'); protected static final boolean USE_XLC = PLATFORM.startsWith("aix_") && System.getenv("USE_GCC")==null; private final X10CPPCompilerOptions options; @@ -99,6 +100,7 @@ cxxCmd.add("-I"+X10LANG); cxxCmd.add("-I"+X10LANG+"/gen"); // FIXME: development option cxxCmd.add("-I"+X10LANG+"/include"); // dist + cxxCmd.add("-I"+X10DIST+"/include"); cxxCmd.add("-I."); if (!Configuration.DISABLE_GC && gcEnabled()) { @@ -125,6 +127,7 @@ cxxCmd.add("-L"+X10LIB+"/lib"); cxxCmd.add("-L"+X10LANG); cxxCmd.add("-L"+X10LANG+"/lib"); // dist + cxxCmd.add("-L"+X10DIST+"/lib"); cxxCmd.add("-lx10"); cxxCmd.add("-l"+x10rt.libName()); cxxCmd.add("-ldl"); @@ -234,4 +237,4 @@ return new CXXCommandBuilder(options); } -} \ No newline at end of file +} Modified: trunk/x10.dist/bin/x10c++ =================================================================== --- trunk/x10.dist/bin/x10c++ 2009-09-21 16:58:09 UTC (rev 11269) +++ trunk/x10.dist/bin/x10c++ 2009-09-21 17:55:05 UTC (rev 11270) @@ -18,6 +18,7 @@ # Default to pre-built distribution; do not set X10LANG [ -z "$X10LIB" ] && export X10LIB="$TOP" [ -z "$X10LANG" ] && export X10LANG="$TOP" + [ -z "$X10DIST" ] && export X10DIST="$TOP" [ -z "$X10GC" ] && export X10GC="$TOP" X10="$TOP" else @@ -25,6 +26,7 @@ [ -z "$X10REL" ] && export X10REL="../x10.dist" [ -z "$X10LIB" ] && export X10LIB="$TOP/../pgas2/common/work" [ -z "$X10LANG" ] && export X10LANG="$TOP/../x10.runtime/src-cpp" + [ -z "$X10DIST" ] && export X10DIST="$TOP/../x10.dist" [ -z "$X10GC" ] && export X10GC="$TOP/../x10.runtime/src-cpp/bdwgc/install" X10="$(cd "$TOP/$X10REL" && pwd)" fi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dgr...@us...> - 2009-09-28 13:19:55
|
Revision: 11310 http://x10.svn.sourceforge.net/x10/?rev=11310&view=rev Author: dgrove-oss Date: 2009-09-28 13:19:46 +0000 (Mon, 28 Sep 2009) Log Message: ----------- XTENLANG-523: First round of changes to implement C++ codegen for structs. This commit adds support for a set of core struct functionality: (a) Struct construction and inheritance (b) instance methods and instance fields on structs (c) struct_equals (d) serialization/deserialization (e) assignment/parameter passing/returning of structs The generated C++ code will not compile with g++4.1 at O0 due to bugs in g++. This can be avoided by either compiling at O2 with g++4.1 or by using a newer version of g++ (eg 4.3 or 4.4). Modified Paths: -------------- trunk/x10.compiler/src/x10/util/StreamWrapper.java trunk/x10.compiler/src/x10cpp/types/X10CPPContext_c.java trunk/x10.compiler/src/x10cpp/visit/Emitter.java trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java trunk/x10.runtime/src-cpp/Makefile trunk/x10.runtime/src-cpp/x10/lang/Ref.h trunk/x10.runtime/src-cpp/x10/runtime/PlaceLocalHandle.h trunk/x10.runtime/src-cpp/x10aux/basic_functions.h trunk/x10.runtime/src-cpp/x10aux/place_local.cc trunk/x10.runtime/src-cpp/x10aux/place_local.h trunk/x10.runtime/src-cpp/x10aux/serialization.h trunk/x10.runtime/src-x10/x10/lang/Primitive.x10 trunk/x10.runtime/src-x10/x10/runtime/PlaceLocalHandle.x10 Added Paths: ----------- trunk/x10.runtime/src-cpp/x10/runtime/PlaceLocalHandle.struct_h Removed Paths: ------------- trunk/x10.runtime/src-cpp/x10/lang/Primitive.cc trunk/x10.runtime/src-cpp/x10/lang/Primitive.h Modified: trunk/x10.compiler/src/x10/util/StreamWrapper.java =================================================================== --- trunk/x10.compiler/src/x10/util/StreamWrapper.java 2009-09-28 13:11:11 UTC (rev 11309) +++ trunk/x10.compiler/src/x10/util/StreamWrapper.java 2009-09-28 13:19:46 UTC (rev 11310) @@ -31,6 +31,7 @@ public static final String Header = "h"; public static final String CC = "cc"; public static final String Closures = "inc"; + public static final String Struct = "struct_h"; // Desired API: getNewStream(class, pre/append), setCurrentStream, setHeader, setBody, header, body // 2 streams - header and body Modified: trunk/x10.compiler/src/x10cpp/types/X10CPPContext_c.java =================================================================== --- trunk/x10.compiler/src/x10cpp/types/X10CPPContext_c.java 2009-09-28 13:11:11 UTC (rev 11309) +++ trunk/x10.compiler/src/x10cpp/types/X10CPPContext_c.java 2009-09-28 13:19:46 UTC (rev 11310) @@ -124,11 +124,8 @@ public boolean hasInits = false; - protected boolean generatingStruct; - public boolean generatingStruct() { return generatingStruct; } - public void setGeneratingSturct(boolean b) { generatingStruct = b; } - public ClassifiedStream templateFunctions = null; + public ClassifiedStream structHeader = null; public ArrayList<VarInstance> variables = new ArrayList<VarInstance>(); @@ -219,9 +216,6 @@ } } - - - public Object copy() { X10CPPContext_c res = (X10CPPContext_c) super.copy(); res.variables = new ArrayList<VarInstance>(); // or whatever the initial value is Modified: trunk/x10.compiler/src/x10cpp/visit/Emitter.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/Emitter.java 2009-09-28 13:11:11 UTC (rev 11309) +++ trunk/x10.compiler/src/x10cpp/visit/Emitter.java 2009-09-28 13:19:46 UTC (rev 11310) @@ -240,7 +240,7 @@ // } else if (type.isClass()) { X10ClassType ct = (X10ClassType) type.toClass(); - if (false && ct.isX10Struct()) { // HACK: treating sturcts as values. + if (ct.isX10Struct()) { // Struct types are not boxed up as Refs. They are always generated as just C++ class types // (Note: not pointer to Class, but the actual class). asRef = false; @@ -311,6 +311,17 @@ return name; return make_ref(name); } + + public static String structNameSpace(ClassType classType, boolean fqn) { + return structNameSpace(classType.fullName(), fqn); + } + + public static String structNameSpace(QName qname, boolean fqn) { + String name = fqn ? qname.toString() : qname.name().toString(); + name += "_ns"; + name = translate_mangled_FQN(name); + return name; + } void printArgumentList(CodeWriter w, X10CPPContext_c c) { printArgumentList(w, c, false, true); @@ -484,6 +495,10 @@ } void printHeader(MethodDecl_c n, CodeWriter h, Translator tr, String name, Type ret, boolean qualify) { X10Flags flags = X10Flags.toX10Flags(n.flags().flags()); + X10MethodDef def = (X10MethodDef) n.methodDef(); + X10MethodInstance mi = (X10MethodInstance) def.asInstance(); + X10ClassType container = (X10ClassType) mi.container(); + boolean isStruct = container.isX10Struct(); h.begin(0); @@ -491,7 +506,6 @@ printTemplateSignature(((X10ClassType)n.methodDef().container().get()).typeArguments(), h); } - X10MethodDef def = (X10MethodDef) n.methodDef(); printTemplateSignature(toTypeList(def.typeParameters()), h); if (!qualify) { @@ -522,21 +536,22 @@ } // [DC] there is no benefit to omitting the virtual keyword as we can // statically bind CALLS to final methods and methods that are members of final classes - else if (!flags.isProperty() && !flags.isPrivate()) { - if (!((X10CPPContext_c)tr.context()).generatingStruct()) { - h.write("virtual "); - } + else if (!isStruct && !flags.isProperty() && !flags.isPrivate()) { + h.write("virtual "); } } printType(ret, h); h.allowBreak(2, 2, " ", 1); - if (qualify) - h.write(translateType(n.methodDef().asInstance().container()) + "::"); - //n.print(n.id(), h, tr); + if (!isStruct && qualify) + h.write(translateType(container) + "::"); h.write(mangled_method_name(name)); h.write("("); h.allowBreak(2, 2, "", 0); h.begin(0); + if (isStruct) { + h.write(translateType(container) +" this_"); + if (!n.formals().isEmpty()) h.write(", "); + } for (Iterator i = n.formals().iterator(); i.hasNext(); ) { Formal f = (Formal) i.next(); n.print(f, h, tr); @@ -672,9 +687,9 @@ h.unifiedBreak(0); h.end(); } - + void printHeader(ConstructorDecl_c n, CodeWriter h, Translator tr, - boolean define, String name, String rType) { + boolean define, boolean isMakeMethod, String rType) { Flags flags = n.flags().flags(); X10ClassType container = (X10ClassType) n.constructorDef().container().get(); @@ -689,11 +704,16 @@ String typeName = translateType(container.def().asType()); // not a virtual method, this function is called only when the static type is precise h.write(rType + " "); - if (define) - h.write(typeName + "::"); - h.write(name + "("); + if (define && !container.isX10Struct()) { + h.write(typeName + "::"); + } + h.write((isMakeMethod ? SharedVarsMethods.MAKE : SharedVarsMethods.CONSTRUCTOR) + "("); h.allowBreak(2, 2, "", 0); h.begin(0); + if (container.isX10Struct() && !isMakeMethod) { + h.write(typeName + " *this_"); + if (!n.formals().isEmpty()) h.write(", "); + } for (Iterator i = n.formals().iterator(); i.hasNext(); ) { Formal f = (Formal) i.next(); n.print(f, h, tr); @@ -733,7 +753,7 @@ h.begin(0); // Let us not generate constants - We will have problem in // initializing away from the place where it is declared. - //if (flags.isFinal()) + //if (flags.isFinal()) } // h.write("const "); if (tr.printType()) { assert (n != null); @@ -797,7 +817,7 @@ } - void generateSerializationMethods(ClassType type, StreamWrapper sw) { + void generateValueSerializationMethods(ClassType type, StreamWrapper sw) { // FIXME: Has a lot of string constants. Refactor them // into final variables. // -Krishna. @@ -935,6 +955,74 @@ w.forceNewline(); } + void generateStructSerializationMethods(ClassType type, StreamWrapper sw) { + X10ClassType ct = (X10ClassType) type.toClass(); + X10TypeSystem ts = (X10TypeSystem) type.typeSystem(); + X10CPPContext_c context = (X10CPPContext_c) tr.context(); + ClassifiedStream w = sw.body(); + ClassifiedStream sh = context.structHeader; + String klass = translateType(type); + + sh.forceNewline(); + + // _serialize() + sh.write("static void "+SERIALIZE_METHOD+"("+klass+" this_, "+SERIALIZATION_BUFFER+"& buf, x10aux::addr_map& m);"); + sh.newline(0); sh.forceNewline(); + + printTemplateSignature(ct.typeArguments(), w); + w.write("void "+klass+"::"+SERIALIZE_METHOD+"("+klass+" this_, "+SERIALIZATION_BUFFER+"& buf, x10aux::addr_map& m) {"); + w.newline(4); w.begin(0); + Type parent = type.superClass(); + if (parent != null) { + w.write(translateType(parent)+"::"+SERIALIZE_METHOD+"(this_, buf, m);"); + w.newline(); + } + for (int i = 0; i < type.fields().size(); i++) { + if (i != 0) + w.newline(); + FieldInstance f = (FieldInstance) type.fields().get(i); + if (f.flags().isStatic() || query.isSyntheticField(f.name().toString())) + continue; + String fieldName = mangled_field_name(f.name().toString()); + w.write("buf.write(this_->"+fieldName+",m);"); w.newline(); + } + w.end(); w.newline(); + w.write("}"); + w.newline(); w.forceNewline(); + + // _deserialize() + sh.write("static "+klass+" "+DESERIALIZE_METHOD+"("+DESERIALIZATION_BUFFER+"& buf) {"); + sh.newline(4) ; sh.begin(0); + sh.writeln(klass+" this_;"); + sh.write("this_->"+DESERIALIZE_BODY_METHOD+"(buf);"); sh.newline(); + sh.write("return this_;"); + sh.end(); sh.newline(); + sh.write("}"); sh.newline(); sh.forceNewline(); + + // _deserialize_body() + sh.write("void "+DESERIALIZE_BODY_METHOD+"("+DESERIALIZATION_BUFFER+"& buf);"); sh.newline(0); + printTemplateSignature(ct.typeArguments(), w); + w.write("void "+klass+"::"+DESERIALIZE_BODY_METHOD+"("+DESERIALIZATION_BUFFER+"& buf) {"); + w.newline(4); w.begin(0); + if (parent != null) { + w.write(translateType(parent)+"::"+DESERIALIZE_BODY_METHOD+"(buf);"); + w.newline(); + } + for (int i = 0; i < type.fields().size(); i++) { + if (i != 0) + w.newline(); + FieldInstance f = (FieldInstance) type.fields().get(i); + if (f.flags().isStatic() || query.isSyntheticField(f.name().toString())) + continue; + String fieldName = mangled_field_name(f.name().toString()); + w.write(fieldName+" = buf.read<"+translateType(f.type(),true)+" >();"); + } + w.end(); w.newline(); + w.write("}"); + w.newline(); + w.forceNewline(); + } + public void emitUniqueNS(QName name, ArrayList<String> history, CodeWriter w) { if (name == null) return; if (!history.contains(name.toString())) { @@ -953,6 +1041,12 @@ h.write("namespace "+mangle_to_cpp(name.name().toString())+" { "); } + public static void openStructNamespaces(CodeWriter h, QName name) { + if (name == null) return; + openNamespaces(h, name.qualifier()); + h.write("namespace "+structNameSpace(name, false)+" { "); + } + public static void closeNamespaces(CodeWriter h, QName name) { if (name == null) return; h.write("} "); Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2009-09-28 13:11:11 UTC (rev 11309) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2009-09-28 13:19:46 UTC (rev 11310) @@ -135,6 +135,7 @@ import polyglot.types.TypeSystem; import polyglot.types.Types; import polyglot.types.VarInstance; +import polyglot.util.CodeWriter; import polyglot.util.ErrorInfo; import polyglot.util.InternalCompilerError; import polyglot.util.Position; @@ -376,7 +377,7 @@ } w.newline(); w.forceNewline(); } - w.write("static " + VOID + " " + STATIC_INIT + "();"); + w.write((((X10ClassType)cd.asType()).isX10Struct() ? "" : "static ") + VOID + " " + STATIC_INIT + "();"); w.newline(); w.forceNewline(); w.end(); w.newline(); w.write("};"); @@ -493,7 +494,11 @@ String className = emitter.translateType(currentClass); boolean sawInit = false; emitter.printTemplateSignature(currentClass.typeArguments(), sw); - sw.write(retType + " " + className + "::" + methodName + "() {"); + if (currentClass.isX10Struct()) { + sw.write(retType + " " + methodName + "() {"); + } else { + sw.write(retType + " " + className + "::" + methodName + "() {"); + } sw.newline(4); sw.begin(0); if (staticInits) { sw.write("static bool done = false;"); sw.newline(); @@ -502,8 +507,13 @@ sw.write("_I_(\"Doing static initialisation for class: "+className+"\");"); sw.newline(); if (currentClass.superClass() != null) { X10ClassDef superDef = ((X10ClassType) X10TypeMixin.baseType(currentClass.superClass())).x10Def(); - String superContainer = translate_mangled_FQN(superDef.fullName().toString())+voidTemplateInstantiation(superDef.typeParameters().size()); - sw.write(superContainer + "::" + methodName + "();"); + if (currentClass.isX10Struct()) { + String superContainer = Emitter.structNameSpace(currentClass.superClass().toClass(), true); + sw.write(superContainer + "::" + methodName + "();"); + } else { + String superContainer = translate_mangled_FQN(superDef.fullName().toString())+voidTemplateInstantiation(superDef.typeParameters().size()); + sw.write(superContainer + "::" + methodName + "();"); + } sw.newline(); } } else { @@ -634,11 +644,18 @@ return header.replace('/','_').replace('.','_').replace('$','_').toUpperCase(); } + private String getStructHeader(ClassType ct) { + String classHeader = getHeader(ct); + classHeader = classHeader.substring(0, classHeader.length()-StreamWrapper.Header.length()); + return classHeader+StreamWrapper.Struct; + } + 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()); + if (getCppRep(def) != null) { // emit no c++ code as this is a native rep class return; @@ -649,16 +666,23 @@ ClassifiedStream save_body = sw.body(); ClassifiedStream save_header = sw.header(); ClassifiedStream save_generic = context.templateFunctions; + ClassifiedStream save_structHeader = context.structHeader; // Header stream ClassifiedStream h = sw.getNewStream(StreamWrapper.Header, false); // Stream for generic functions (always in the header, may be empty) ClassifiedStream g = sw.getNewStream(StreamWrapper.Header, false); context.templateFunctions = g; - String impl = StreamWrapper.CC; - if (def.typeParameters().size() != 0) - impl = StreamWrapper.Header; - // Implementation stream (may be after the header) - ClassifiedStream w = sw.getNewStream(impl, false); + // Stream for struct data definition (only if n is a struct) + ClassifiedStream sh = null; + if (isStruct) { + sh = sw.getNewStream(StreamWrapper.Struct); + context.structHeader = sh; + } + + // Implementation stream. + // In generic context, in .h, but after the logical header stream. + // In non-generic context, in .cc + ClassifiedStream w = sw.getNewStream(def.typeParameters().size() != 0 ? StreamWrapper.Header : StreamWrapper.CC, false); // Dependences guard closing stream (comes at the end of the header) ClassifiedStream z = sw.getNewStream(StreamWrapper.Header, false); sw.set(h, w); @@ -678,6 +702,16 @@ g.write("#ifndef "+cguard+"_GENERICS"); g.newline(); g.write("#define "+cguard+"_GENERICS"); g.newline(); + + String sheader = isStruct ? getStructHeader(def.asType()) : ""; + String sguard = isStruct ? getHeaderGuard(sheader) : ""; + if (isStruct) { + sh.write("#ifndef __"+sguard); sh.newline(); + sh.write("#define __"+sguard); sh.newline(); + sh.forceNewline(0); + sh.write("#include <x10rt17.h>"); sh.newline(); + sh.forceNewline(0); + } boolean inTemplate = def.typeParameters().size() != 0; if (inTemplate) { @@ -690,10 +724,8 @@ w.forceNewline(0); w.forceNewline(0); - String pkg = ""; - if (context.package_() != null) - pkg = context.package_().fullName().toString(); - String incfile = tf.integratedOutputName(pkg, n.name().toString(), StreamWrapper.Closures); + String incfile = tf.integratedOutputName(context.package_() == null ? "" : context.package_().fullName().toString(), + n.name().toString(), StreamWrapper.Closures); w.write("#include \""+incfile+"\""); w.newline(); w.forceNewline(0); @@ -702,7 +734,6 @@ w.newline(); } - X10TypeSystem_c xts = (X10TypeSystem_c) tr.typeSystem(); ArrayList<Type> allIncludes = new ArrayList<Type>(); if (n.superClass() != null) { ClassType ct = n.superClass().type().toClass(); @@ -716,6 +747,14 @@ h.write("#undef "+guard+"_NODEPS"); h.newline(); allIncludes.add(ct); } + if (isStruct) { + String header = getStructHeader(ct.toClass()); + String guard = getHeaderGuard(header); + sh.writeln("#define "+guard+"_NODEPS"); + sh.writeln("#include <" + header + ">"); + sh.writeln("#undef "+guard+"_NODEPS"); + } + ArrayList<ClassType> types = new ArrayList<ClassType>(); Set<ClassType> dupes = new HashSet<ClassType>(); dupes.add(ct); @@ -734,10 +773,9 @@ if (icd != def) { String header = getHeader(ct); String guard = getHeaderGuard(header); - h.write("#define "+guard+"_NODEPS"); h.newline(); - h.write("#include <" + header + ">"); - h.newline(); - h.write("#undef "+guard+"_NODEPS"); h.newline(); + h.writeln("#define "+guard+"_NODEPS"); + h.writeln("#include <" + header + ">"); + h.writeln("#undef "+guard+"_NODEPS"); allIncludes.add(ct); } ArrayList<ClassType> types = new ArrayList<ClassType>(); @@ -752,87 +790,64 @@ } } } - - // FIXME: [IP] There is a problem with include ordering. - // We cannot just blindly include a header for every type used - // because of recursive dependences. So we need to do partial - // ordering. For that, we need to include only those headers - // that define classes for which the code needs a full definition. - // Otherwise, just declare a class and include the header in the - // implementation file instead. - // As I can see, the only uses that need a full definition are - // field reads (in static final field initializers) and - // inheritance. So find all class declarations and field - // declarations, and do #include for those headers. - // - // [DC] static final field initialisers should be in the cc file, - // with everything else that needs a full definition (lookups, - // construction, etc) - // - // [DC] generic classes might cause a problem though, as their - // function bodies are in the header. We can still get cycles - // through this approach. We may need two layers of headers or - // something for generic classes, in a manner that reflects the - // (h,cc) pairing for non-generic classes. - - // TODO: sort by namespace and combine things in the same namespace - X10SearchVisitor xTypes = new X10SearchVisitor(X10CanonicalTypeNode_c.class, Closure_c.class); - n.visit(xTypes); - ArrayList<ClassType> types = new ArrayList<ClassType>(); - Set<ClassType> dupes = new HashSet<ClassType>(); - dupes.add(def.asType()); - if (xTypes.found()) { - ArrayList typeNodesAndClosures = xTypes.getMatches(); - for (int i = 0; i < typeNodesAndClosures.size(); i++) { - Node tn = (Node) typeNodesAndClosures.get(i); - if (tn instanceof X10CanonicalTypeNode_c) { - X10CanonicalTypeNode_c t = (X10CanonicalTypeNode_c) tn; - extractAllClassTypes(t.type(), types, dupes); - } else if (tn instanceof Closure_c) { - Closure_c t = (Closure_c) tn; - ClassType c = t.type().toClass(); - assert (c.interfaces().size() == 1); - extractAllClassTypes(c.interfaces().get(0), types, dupes); + + // If any instance fields are struct types, then include the .struct_h + List<FieldInstance> fields = def.asType().fields(); + if (!fields.isEmpty()) { + HashSet<Type> dupes = new HashSet<Type>(); + ClassifiedStream fh = isStruct ? sh : h; + for (FieldInstance fi : fields) { + if (!fi.flags().isStatic()) { + Type fct = fi.type(); + if (!dupes.contains(fct)) { + dupes.add(fct); + if (xts.isStructType(fct)) { + String header = getStructHeader(fct.toClass()); + String guard = getHeaderGuard(header); + fh.writeln("#define "+guard+"_NODEPS"); + fh.writeln("#include <" + header + ">"); + fh.writeln("#undef "+guard+"_NODEPS"); + } + if (isStruct && fct.isClass()) { + // Have to include all types of all instance fields in .struct_h + declareClass(((X10ClassType)fct.toClass()).x10Def(), fh); + } + } } } - } - X10ClassType superClass = (X10ClassType) X10TypeMixin.baseType(def.asType().superClass()); - if (superClass != null) { - for (Name mname : getMethodNames(n.body().members())) { - List<MethodInstance> overriddenOverloads = getOROLMeths(mname, superClass); - for (MethodInstance mi : overriddenOverloads) { - extractAllClassTypes(mi.returnType(), types, dupes); - for (Type t : mi.formalTypes()) - extractAllClassTypes(t, types, dupes); - for (Type t : mi.throwTypes()) - extractAllClassTypes(t, types, dupes); - } - } - } + } + ArrayList<ClassType> types = referencedTypes(n, def); for (ClassType ct : types) { X10ClassDef cd = (X10ClassDef) ct.def(); if (cd == def) continue; if (!allIncludes.contains(ct)) { declareClass(cd, h); + if (xts.isStructType(ct)) { + String header = getHeader(ct); + h.writeln("#include <" + getStructHeader(ct) + ">"); + } allIncludes.add(ct); } } + if (isStruct) { + h.write("#include <"+sheader+">"); h.newline(); h.forceNewline(); + } + if (def.package_() != null) { QName pkgName = def.package_().get().fullName(); Emitter.openNamespaces(h, pkgName); h.newline(0); h.forceNewline(0); + if (isStruct) { + Emitter.openNamespaces(sh, pkgName); + sh.newline(0); + sh.forceNewline(0); + } } - /* [DC] since we don't have nested classes anymore, processClass is never called from - * inside processClass, so this stack device is no-longer needed. - ArrayList<ClassMember> opsd = context.pendingStaticDecls; - assert opsd.isEmpty() : "Should not occur without nested classes"; - */ - /* * Ideally, classProperties would be added to the child context * that will be created for processing the classBody, but there @@ -855,11 +870,36 @@ h.newline(); } - emitter.printHeader(n, h, tr, false); - h.allowBreak(0, " "); + // Open class/namespace bodies + if (isStruct) { + emitter.printHeader(n, sh, tr, false); + sh.allowBreak(0, " "); + sh.write("{"); sh.newline(4); sh.begin(0); + + h.write("namespace "+emitter.structNameSpace(def.asType(), false)); + h.write(" {"); h.newline(4); h.begin(0); + } else { + emitter.printHeader(n, h, tr, false); + h.allowBreak(0, " "); + h.write(" {"); h.newline(4); h.begin(0); + } n.print(n.body(), sw, tr); + // Close class/namespace bodies + if (isStruct) { + sh.end(); + sh.newline(0); + sh.writeln("};"); + h.end(); + h.newline(0); + h.writeln("}"); + } else { + h.end(); + h.newline(0); + h.writeln("};"); + } + ((X10CPPTranslator)tr).setContext(n.enterChildScope(n.body(), context)); // FIXME /* * TODO: [IP] Add comment about dependences between the method calls. @@ -876,11 +916,6 @@ ((X10CPPTranslator)tr).setContext(context); // FIXME - // [DC] disabled, see (commented out) definition of opsd above for details - // context.pendingStaticDecls = opsd; - - h.newline(); - // Write the footer for the class if (def.package_() != null) { QName pkgName = def.package_().get().fullName(); @@ -888,10 +923,21 @@ h.forceNewline(0); Emitter.closeNamespaces(h, pkgName); h.newline(0); + if (isStruct) { + sh.newline(0); + sh.forceNewline(0); + Emitter.closeNamespaces(sh, pkgName); + sh.newline(0); + } } h.write("#endif // " + cguard); h.newline(0); h.forceNewline(0); + if(isStruct) { + sh.write("#endif // " + sguard); sh.newline(0); + sh.forceNewline(0); + } + g.write("#endif // "+cguard+"_GENERICS"); g.newline(); if (inTemplate) { @@ -930,11 +976,72 @@ z.forceNewline(0); context.templateFunctions = save_generic; + context.structHeader = save_structHeader; sw.set(save_header, save_body); } + private ArrayList<ClassType> referencedTypes(X10ClassDecl_c n, X10ClassDef def) { + // FIXME: [IP] There is a problem with include ordering. + // We cannot just blindly include a header for every type used + // because of recursive dependences. So we need to do partial + // ordering. For that, we need to include only those headers + // that define classes for which the code needs a full definition. + // Otherwise, just declare a class and include the header in the + // implementation file instead. + // As I can see, the only uses that need a full definition are + // field reads (in static final field initializers) and + // inheritance. So find all class declarations and field + // declarations, and do #include for those headers. + // + // [DC] static final field initialisers should be in the cc file, + // with everything else that needs a full definition (lookups, + // construction, etc) + // + // [DC] generic classes might cause a problem though, as their + // function bodies are in the header. We can still get cycles + // through this approach. We may need two layers of headers or + // something for generic classes, in a manner that reflects the + // (h,cc) pairing for non-generic classes. + // TODO: sort by namespace and combine things in the same namespace + X10SearchVisitor xTypes = new X10SearchVisitor(X10CanonicalTypeNode_c.class, Closure_c.class); + n.visit(xTypes); + ArrayList<ClassType> types = new ArrayList<ClassType>(); + Set<ClassType> dupes = new HashSet<ClassType>(); + dupes.add(def.asType()); + if (xTypes.found()) { + ArrayList typeNodesAndClosures = xTypes.getMatches(); + for (int i = 0; i < typeNodesAndClosures.size(); i++) { + Node tn = (Node) typeNodesAndClosures.get(i); + if (tn instanceof X10CanonicalTypeNode_c) { + X10CanonicalTypeNode_c t = (X10CanonicalTypeNode_c) tn; + extractAllClassTypes(t.type(), types, dupes); + } else if (tn instanceof Closure_c) { + Closure_c t = (Closure_c) tn; + ClassType c = t.type().toClass(); + assert (c.interfaces().size() == 1); + extractAllClassTypes(c.interfaces().get(0), types, dupes); + } + } + } + X10ClassType superClass = (X10ClassType) X10TypeMixin.baseType(def.asType().superClass()); + if (superClass != null) { + for (Name mname : getMethodNames(n.body().members())) { + List<MethodInstance> overriddenOverloads = getOROLMeths(mname, superClass); + for (MethodInstance mi : overriddenOverloads) { + extractAllClassTypes(mi.returnType(), types, dupes); + for (Type t : mi.formalTypes()) + extractAllClassTypes(t, types, dupes); + for (Type t : mi.throwTypes()) + extractAllClassTypes(t, types, dupes); + } + } + } + return types; + } + + public void visit(LocalClassDecl_c n) { assert (false) : ("Local classes should have been removed by a separate pass"); } @@ -1019,13 +1126,10 @@ if (currentClass.flags().isInterface()) { visitInterfaceBody(n, context, currentClass, superClass, xts); - } else if (xts.isValueType(currentClass, context) || currentClass.isX10Struct()) { // HACK: treating sturcts as values. + } else if (xts.isValueType(currentClass, context)) { visitValueBody(n, context, currentClass, superClass, xts); } else if (currentClass.isX10Struct()) { - assert false : "unreachable code due to structs as values hack"; - context.setGeneratingSturct(true); visitStructBody(n, context, currentClass, superClass, xts); - context.setGeneratingSturct(false); } else { visitClassBody(n, context, currentClass, superClass, xts); } @@ -1038,7 +1142,6 @@ List<ClassMember> members = n.members(); ITable itable = ITable.getITable(currentClass); - h.write("{"); h.newline(4); h.begin(0); h.write("public:"); h.newline(); h.write("RTT_H_DECLS_INTERFACE"); h.newline(); h.forceNewline(); @@ -1114,12 +1217,8 @@ generateStaticInitForClass(currentClass, h, members, className); } - h.end(); sw.end(); sw.newline(); - h.newline(0); - h.write("};"); - h.newline(); emitter.printRTTDefn(currentClass, sw); } @@ -1129,9 +1228,6 @@ X10TypeSystem xts) { ClassifiedStream h = sw.header(); - h.write("{"); - h.newline(4); - h.begin(0); h.write("public:"); h.newline(); h.write("RTT_H_DECLS_CLASS"); @@ -1148,7 +1244,7 @@ if (!members.isEmpty()) { String className = emitter.translateType(currentClass); - h.write(VOID + " " + INSTANCE_INIT + "();"); + h.write(VOID + " " + INSTANCE_INIT + "();"); h.newline(); h.forceNewline(); if (extractInits(currentClass, INSTANCE_INIT, VOID, members, false)) { @@ -1172,18 +1268,10 @@ } generateStaticInitForClass(currentClass, h, members, className); - - if (xts.isValueType(currentClass, context)) { - emitter.generateSerializationMethods(currentClass, sw); - } } - h.end(); sw.end(); sw.newline(); - h.newline(0); - h.write("};"); - h.newline(); emitter.printRTTDefn(currentClass, sw); } @@ -1194,9 +1282,6 @@ ClassifiedStream h = sw.header(); List<ClassMember> members = n.members(); - h.write("{"); - h.newline(4); - h.begin(0); h.write("public:"); h.newline(); h.write("RTT_H_DECLS_CLASS"); @@ -1296,15 +1381,11 @@ generateStaticInitForClass(currentClass, h, members, className); - emitter.generateSerializationMethods(currentClass, sw); + emitter.generateValueSerializationMethods(currentClass, sw); } - h.end(); sw.end(); sw.newline(); - h.newline(0); - h.write("};"); - h.newline(); emitter.printRTTDefn(currentClass, sw); } @@ -1312,17 +1393,15 @@ private void visitStructBody(ClassBody_c n, X10CPPContext_c context, X10ClassType currentClass, X10ClassType superClass, X10TypeSystem xts) { + ClassifiedStream sh = context.structHeader; ClassifiedStream h = sw.header(); - h.write("{"); - h.newline(4); - h.begin(0); - h.write("public:"); - h.newline(); - h.write("RTT_H_DECLS_STRUCT"); - h.newline(); h.forceNewline(); - h.write(Emitter.translateType(currentClass, false)+"* operator->() { return this; }"); - h.newline(); + sh.write("public:"); + sh.newline(); + sh.write("RTT_H_DECLS_STRUCT"); + sh.newline(); sh.forceNewline(); + sh.write(Emitter.translateType(currentClass, false)+"* operator->() { return this; }"); + sh.newline(); sh.forceNewline(); sw.begin(0); for (PropertyDecl p : context.classProperties()) { @@ -1331,22 +1410,24 @@ List<ClassMember> members = n.members(); - generateITablesForClass(currentClass, xts, "", h); + // generateITablesForClass(currentClass, xts, "", sh); //FIXME: itable codegen for structs if (!members.isEmpty()) { String className = emitter.translateType(currentClass); - h.write(VOID + " " + INSTANCE_INIT + "();"); - h.newline(); - h.forceNewline(); + sh.write(VOID + " " + INSTANCE_INIT + "("+className+" *this_);"); + sh.newline(); + sh.forceNewline(); + + Emitter.openStructNamespaces(sw, currentClass.fullName()); sw.newline(); if (extractInits(currentClass, INSTANCE_INIT, VOID, members, false)) { context.hasInits = true; } - + Emitter.closeNamespaces(sw, currentClass.fullName()); sw.newline(); sw.forceNewline(); + ClassMember prev = null; for (ClassMember member : members) { - if ((member instanceof polyglot.ast.CodeDecl) - || (prev instanceof polyglot.ast.CodeDecl)) { + if ((member instanceof polyglot.ast.CodeDecl) || (prev instanceof polyglot.ast.CodeDecl)) { h.newline(0); sw.newline(0); } @@ -1354,31 +1435,25 @@ n.printBlock(member, sw, tr); } - if (superClass != null) { - generateProxiesForOverriddenMethods(context, currentClass, - superClass, xts, "", h, members); - } - // Generate structEquals for structs - h.write("public: "); - emitter.printType(xts.Boolean(), h); - h.write(" " + mangled_method_name(STRUCT_EQUALS_METHOD) + "("); - h.write(Emitter.translateType(currentClass, false) + " *that"); - h.write(");"); - h.newline(); + emitter.printType(xts.Boolean(), sh); + sh.write(" " + mangled_method_name(STRUCT_EQUALS_METHOD) + "("); + sh.write(Emitter.translateType(currentClass, false) + " that"); + sh.write(");"); + sh.newline(); emitter.printTemplateSignature(currentClass.typeArguments(), sw); emitter.printType(xts.Boolean(), sw); sw.write(" " + Emitter.translateType(currentClass, false) + "::" + mangled_method_name(STRUCT_EQUALS_METHOD)+ "("); - sw.write(Emitter.translateType(currentClass, false) + " *that"); + sw.write(Emitter.translateType(currentClass, false) + " that"); sw.write(") {"); sw.newline(4); sw.begin(0); if (superClass != null) { sw.write("if (!this->" + Emitter.translateType(superClass) + "::" + mangled_method_name(STRUCT_EQUALS_METHOD) - + "((" + Emitter.translateType(superClass)+ "*)(that)))"); + + "(that))"); sw.newline(4); sw.begin(0); sw.write("return false;"); @@ -1404,14 +1479,12 @@ sw.newline(); generateStaticInitForClass(currentClass, h, members, className); + + emitter.generateStructSerializationMethods(currentClass, sw); } - h.end(); sw.end(); sw.newline(); - h.newline(0); - h.write("};"); - h.newline(); emitter.printRTTDefn(currentClass, sw); } @@ -1572,18 +1645,32 @@ } private void generateStaticInitForClass(X10ClassType currentClass, - ClassifiedStream h, List<ClassMember> members, String className) { - // declare static init function in header - h.write("public : static " + VOID + " " + STATIC_INIT + "();"); - h.newline(); - if (extractInits(currentClass, STATIC_INIT, VOID, members, true)) { - // define field that triggers initalisation-time registration of - // static init function - sw.write("static " + VOID_PTR + " __init__"+getUniqueId_() + - " __attribute__((__unused__)) = x10aux::InitDispatcher::addInitializer(" + - className+"::"+STATIC_INIT + ")" + ";"); - sw.newline(); sw.forceNewline(0); - } + ClassifiedStream h, List<ClassMember> members, String className) { + if (currentClass.isX10Struct()) { + // declare static init function in header + h.writeln(VOID + " " + STATIC_INIT + "();"); + Emitter.openStructNamespaces(sw, currentClass.fullName()); sw.newline(); + if (extractInits(currentClass, STATIC_INIT, VOID, members, true)) { + // define field that triggers initalisation-time registration of + // static init function + sw.write("static " + VOID_PTR + " __init__"+getUniqueId_() + + " __attribute__((__unused__)) = x10aux::InitDispatcher::addInitializer(" +STATIC_INIT + ")" + ";"); + sw.newline(); sw.forceNewline(0); + } + Emitter.closeNamespaces(sw, currentClass.fullName()); sw.newline(); sw.forceNewline(); + } else { + // declare static init function in header + h.write("static " + VOID + " " + STATIC_INIT + "();"); + h.newline(); + if (extractInits(currentClass, STATIC_INIT, VOID, members, true)) { + // define field that triggers initalisation-time registration of + // static init function + sw.write("static " + VOID_PTR + " __init__"+getUniqueId_() + + " __attribute__((__unused__)) = x10aux::InitDispatcher::addInitializer(" + + className+"::"+STATIC_INIT + ")" + ";"); + sw.newline(); sw.forceNewline(0); + } + } } String defaultValue(Type type) { @@ -1624,10 +1711,11 @@ X10Flags flags = X10Flags.toX10Flags(dec.flags().flags()); if (flags.isNative()) return; - ClassifiedStream h = sw.header(); + X10MethodDef def = (X10MethodDef) dec.methodDef(); X10MethodInstance mi = (X10MethodInstance) def.asInstance(); X10ClassType container = (X10ClassType) mi.container(); + ClassifiedStream h = sw.header(); if ((container.x10Def().typeParameters().size() != 0) && flags.isStatic()) { context.pendingStaticDecls().add(dec); return; @@ -1666,9 +1754,15 @@ Types.ref(container), Name.make(THIS)).asInstance(); context.addVariable(ti); } + if (container.isX10Struct()) { + Emitter.openStructNamespaces(sw, container.fullName()); sw.newline(); + } emitter.printHeader(dec, sw, tr, methodName, ret_type, true); dec.printSubStmt(dec.body(), sw, tr); sw.newline(); + if (container.isX10Struct()) { + Emitter.closeNamespaces(sw, container.fullName()); sw.newline(); sw.forceNewline(); + } } else { // Define property getter methods. if (flags.isProperty() && flags.isAbstract() && mi.formalTypes().size() == 0 && mi.typeParameters().size() == 0) { @@ -1713,41 +1807,16 @@ X10ClassType container = (X10ClassType) dec.constructorDef().container().get(); String typeName = emitter.translateType(container.def().asType()); - if (!container.flags().isAbstract()) { - // emit _make method - h.write("static "); - sw.pushCurrentStream(h); - emitter.printHeader(dec, sw, tr, false, MAKE, context.generatingStruct() ? typeName : make_ref(typeName)); - sw.popCurrentStream(); - h.allowBreak(0, " "); h.write("{"); h.newline(4); h.begin(0); - if (context.generatingStruct()) { - h.write(typeName+" this_; "); h.newline(); - h.write("this_."+CONSTRUCTOR+"("); - } else { - h.write(make_ref(typeName)+" this_ = "+ - "new (x10aux::alloc"+chevrons(typeName)+"()) "+typeName+"();"); h.newline(); - h.write("this_->"+CONSTRUCTOR+"("); - } - for (Iterator<Formal> i = dec.formals().iterator(); i.hasNext(); ) { - Formal f = i.next(); - h.write(mangled_non_method_name(f.name().id().toString())); - if (i.hasNext()) { - h.write(","); - h.allowBreak(0, " "); - } - } - h.write(");"); h.newline(); - h.write("return this_;"); - h.end(); h.newline(); - h.write("}"); h.newline(); // no gap between _make and _constructor - } - sw.pushCurrentStream(h); - emitter.printHeader(dec, sw, tr, false, CONSTRUCTOR, "void"); + emitter.printHeader(dec, sw, tr, false, false, "void"); sw.popCurrentStream(); h.write(";") ; h.newline(); h.forceNewline(); - emitter.printHeader(dec, sw, tr, true, CONSTRUCTOR, "void"); + + if (container.isX10Struct()) { + Emitter.openStructNamespaces(sw, container.fullName()); sw.newline(); + } + emitter.printHeader(dec, sw, tr, true, false, "void"); X10ConstructorInstance ci = (X10ConstructorInstance) dec.constructorDef().asInstance(); if (dec.body() == null) { assert false : dec.position().toString(); @@ -1762,7 +1831,6 @@ Types.ref(container), Name.make(THIS)).asInstance(); context.addVariable(ti); - sw.allowBreak(0, " "); sw.write("{"); sw.newline(4); sw.begin(0); Block_c body = (Block_c) dec.body(); @@ -1776,7 +1844,11 @@ if (context.hasInits) { // then, run x10 instance field initialisers - sw.write("this->"+INSTANCE_INIT+"();"); sw.newline(); + if (container.isX10Struct()) { + sw.write(INSTANCE_INIT+"(&this_);"); sw.newline(); + } else { + sw.write("this->"+INSTANCE_INIT+"();"); sw.newline(); + } } for (Stmt s : body.statements()) { @@ -1784,10 +1856,20 @@ if (s instanceof ConstructorCall) { ConstructorCall call = (ConstructorCall)s; if (call.kind() == ConstructorCall.SUPER) { - String superClass = emitter.translateType(container.superClass()); - sw.write("this->"+superClass+"::"+CONSTRUCTOR+"("); + if (container.isX10Struct()) { + String superClass = Emitter.structNameSpace(container.superClass().toClass().fullName(), true); + sw.write(superClass+"::"+CONSTRUCTOR+"(this_"); + if (call.arguments().size() > 0) sw.write(", "); + } else { + String superClass = emitter.translateType(container.superClass()); + sw.write("this->"+superClass+"::"+CONSTRUCTOR+"("); + } } else if (call.kind() == ConstructorCall.THIS) { - sw.write("this->"+CONSTRUCTOR+"("); + if (container.isX10Struct()) { + sw.write(CONSTRUCTOR+"("); + } else { + sw.write("this->"+CONSTRUCTOR+"("); + } } if (call.arguments().size() > 0) { sw.allowBreak(2, 2, "", 0); // miser mode @@ -1815,7 +1897,41 @@ sw.end(); sw.newline(); sw.write("}"); - sw.newline(); sw.forceNewline(); + if (!container.flags().isAbstract()) { + // emit _make method + h.write(container.isX10Struct() ? "inline ": "static "); + sw.pushCurrentStream(h); + emitter.printHeader(dec, sw, tr, false, true, container.isX10Struct() ? typeName : make_ref(typeName)); + sw.popCurrentStream(); + h.allowBreak(0, " "); h.write("{"); h.newline(4); h.begin(0); + if (container.isX10Struct()) { + h.write(typeName+" this_; "); h.newline(); + h.write(CONSTRUCTOR+"(&this_"); + if (!dec.formals().isEmpty()) h.write(", "); + } else { + h.write(make_ref(typeName)+" this_ = "+ + "new (x10aux::alloc"+chevrons(typeName)+"()) "+typeName+"();"); h.newline(); + h.write("this_->"+CONSTRUCTOR+"("); + } + for (Iterator<Formal> i = dec.formals().iterator(); i.hasNext(); ) { + Formal f = i.next(); + h.write(mangled_non_method_name(f.name().id().toString())); + if (i.hasNext()) { + h.write(","); + h.allowBreak(0, " "); + } + } + h.write(");"); h.newline(); + h.write("return this_;"); + h.end(); h.newline(); + h.write("}"); h.newline(); + h.forceNewline(); + } + + sw.newline(); sw.forceNewline(); + if (container.isX10Struct()) { + Emitter.closeNamespaces(sw, container.fullName()); sw.newline(); sw.forceNewline(); + } } @@ -1825,14 +1941,14 @@ return; X10CPPContext_c context = (X10CPPContext_c) tr.context(); - if ((((X10ClassDef)((X10ClassType)dec.fieldDef().asInstance().container()).def()).typeParameters().size() != 0) && - dec.flags().flags().isStatic()) - { + X10ClassType declaringClass = (X10ClassType)dec.fieldDef().asInstance().container(); + boolean isStatic = dec.flags().flags().isStatic(); + if ((((X10ClassDef)declaringClass.def()).typeParameters().size() != 0) && isStatic) { context.pendingStaticDecls().add(dec); return; } - ClassifiedStream h = sw.header(); + ClassifiedStream h = !isStatic && declaringClass.isX10Struct() ? context.structHeader : sw.header(); sw.pushCurrentStream(h); emitter.printHeader(dec, sw, tr, false); sw.popCurrentStream(); @@ -1840,7 +1956,7 @@ // FIXME: the above breaks switch constants! h.write(";"); h.newline(); h.forceNewline(); - if (dec.flags().flags().isStatic()) { + if (isStatic) { emitter.printHeader(dec, sw, tr, true); // [DC] disabled because I want this done through the static initialisation framework // [IP] re-enabled for a very limited set of cases, namely literal inits @@ -2341,7 +2457,7 @@ // [IP] FIXME: accommodate the frontend hack for the equals method if (mi.name() == Name.make("equals") && args.size() == 1 && mi.typeParameters().size() == 0 && - xts.isParameterType(mi.formalTypes().get(0))) + xts.isParameterType(mi.formalTypes().get(0))) { args.set(0, cast(args.get(0), xts.Object())); } @@ -2351,7 +2467,7 @@ emitNativeAnnotation(pat, mi.typeParameters(), target, args); return; } - + // the cast is because our generated member function may use a more general // return type because c++ does not support covariant smartptr returns Type ret_type = emitter.findRootMethodReturnType(md, null, mi); @@ -2361,91 +2477,125 @@ emitter.printType(mi.returnType(), sw); sw.write(" >("); } - sw.begin(0); - String dangling = ""; - boolean already_static = false; - String targetMethodName = mangled_method_name(n.name().id().toString()); - boolean isInterfaceInvoke = false; - if (!n.isTargetImplicit()) { - // explicit target. - if (target instanceof X10Special_c && - ((X10Special_c)target).kind().equals(X10Special_c.SUPER)) - { - sw.write(emitter.translateType(t)); - sw.write("::"); - already_static = true; - } else if (target instanceof Expr) { + if (xts.isStructType(mi.container())) { + X10ClassType clsType = (X10ClassType)mi.container().toClass(); + sw.begin(0); + String targetMethodName = Emitter.structNameSpace(clsType, true)+"::"+mangled_method_name(n.name().id().toString()); + String dangling = ""; + if (!n.isTargetImplicit()) { if (mi.flags().isStatic()) { sw.write("((void)"); n.printSubExpr((Expr) target, false, sw, tr); sw.write(","); - sw.write(emitter.translateType(t)); - sw.write("::"); dangling = ")"; - already_static = true; - } else { - boolean assoc = !(target instanceof New_c || target instanceof Binary_c); - if (t.isClass()) { - X10ClassType clsType = (X10ClassType)t.toClass(); - if (clsType.flags().isInterface()) { - ITable itable= ITable.getITable(clsType); - targetMethodName = itable.mangledName(mi); - isInterfaceInvoke = true; - if (ret_type.isVoid()) { - sw.write("(__extension__ ({ x10aux::ref<x10::lang::Object> _ = x10aux::placeCheck(x10aux::nullCheck("); - n.printSubExpr((Expr) target, assoc, sw, tr); - sw.write(")); (_.operator->()->*(x10aux::findITable"+chevrons(emitter.translateType(clsType, false))+"(_->_getITables())->"+itable.mangledName(mi)+"))"); - dangling = "; }))"; - } else { - sw.write("(__extension__ ({ x10aux::ref<x10::lang::Object> _ = x10aux::placeCheck(x10aux::nullCheck("); - n.printSubExpr((Expr) target, assoc, sw, tr); - sw.write(")); x10aux::GXX_ICE_Workaround"+chevrons(emitter.translateType(ret_type, true))+"::_((_.operator->()->*(x10aux::findITable"+chevrons(emitter.translateType(clsType, false))+"(_->_getITables())->"+itable.mangledName(mi)+"))"); - dangling = "); }))"; - } - } - } - - if (!isInterfaceInvoke) { - boolean needsCheck = true || !((X10Type)t).isX10Struct(); // HACK: treating sturcts as values. - sw.write(needsCheck ? "x10aux::placeCheck(x10aux::nullCheck(" : "("); - n.printSubExpr((Expr) target, assoc, sw, tr); - sw.write((needsCheck ? "))" : ")")+"->"); - } - } - } else if (target instanceof TypeNode || target instanceof AmbReceiver) { + } + sw.write(targetMethodName); + emitter.printTemplateInstantiation(mi, sw); + sw.write("("); n.print(target, sw, tr); - sw.write("::"); - already_static = true; } + printCallActuals(n, context, xts, mi, args); + sw.write(")"); + sw.write(dangling); + sw.end(); + } else { + sw.begin(0); + String dangling = ""; + boolean already_static = false; + String targetMethodName = mangled_method_name(n.name().id().toString()); + boolean isInterfaceInvoke = false; + if (!n.isTargetImplicit()) { + // explicit target. + if (target instanceof X10Special_c && ((X10Special_c)target).kind().equals(X10Special_c.SUPER)) { + sw.write(emitter.translateType(t)); + sw.write("::"); + already_static = true; + } else if (target instanceof Expr) { + if (mi.flags().isStatic()) { + sw.write("((void)"); + n.printSubExpr((Expr) target, false, sw, tr); + sw.write(","); + sw.write(emitter.translateType(t)); + sw.write("::"); + dangling = ")"; + already_static = true; + } else { + boolean assoc = !(target instanceof New_c || target instanceof Binary_c); + if (t.isClass()) { + X10ClassType clsType = (X10ClassType)t.toClass(); + if (clsType.flags().isInterface()) { + ITable itable= ITable.getITable(clsType); + targetMethodName = itable.mangledName(mi); + isInterfaceInvoke = true; + if (ret_type.isVoid()) { + sw.write("(__extension__ ({ x10aux::ref<x10::lang::Object> _ = x10aux::placeCheck(x10aux::nullCheck("); + n.printSubExpr((Expr) target, assoc, sw, tr); + sw.write(")); (_.operator->()->*(x10aux::findITable"+chevrons(emitter.translateType(clsType, false))+"(_->_getITables())->"+itable.mangledName(mi)+"))"); + dangling = "; }))"; + } else { + sw.write("(__extension__ ({ x10aux::ref<x10::lang::Object> _ = x10aux::placeCheck(x10aux::nullCheck("); + n.printSubExpr((Expr) target, assoc, sw, tr); + sw.write(")); x10aux::GXX_ICE_Workaround"+chevrons(emitter.translateType(ret_type, true))+"::_((_.operator->()->*(x10aux::findITable"+chevrons(emitter.translateType(clsType, false))+"(_->_getITables())->"+itable.mangledName(mi)+"))"); + dangling = "); }))"; + } + } + } + + if (!isInterfaceInvoke) { + boolean needsCheck = !((X10Type)t).isX10Struct(); + sw.write(needsCheck ? "x10aux::placeCheck(x10aux::nullCheck(" : "("); + n.printSubExpr((Expr) target, assoc, sw, tr); + sw.write((needsCheck ? "))" : ")")+"->"); + } + } + } else if (target instanceof TypeNode || target instanceof AmbReceiver) { + n.print(target, sw, tr); + sw.write("::"); + already_static = true; + } + } + + boolean virtual_dispatch = true; + if (t.isClass()) { + X10ClassType ct = (X10ClassType)t.toClass(); + X10ClassDef cd = ct.x10Def(); + if (cd.flags().isFinal()) { + virtual_dispatch = false; + } + } + if (mi.flags().isFinal()) { + virtual_dispatch = false; + } + if (!virtual_dispatch && !already_static ) { + // disable virtual dispatch + sw.write(emitter.translateType(t)); + sw.write("::"); + } + // [IP] FIXME: virtual_dispatch test is temporary, until xlC is upgraded to v10 + if (context.inTemplate() && mi.typeParameters().size() != 0 && virtual_dispatch) { + sw.write("template "); + } + if (!isInterfaceInvoke) { + sw.write(targetMethodName); + emitter.printTemplateInstantiation(mi, sw); + } + sw.write("("); + printCallActuals(n, context, xts, mi, args); + sw.write(")"); + sw.write(dangling); + sw.end(); } + + if (needsCast) { + sw.write(")"); + } + } - boolean virtual_dispatch = true; - if (t.isClass()) { - X10ClassType ct = (X10ClassType)t.toClass(); - X10ClassDef cd = ct.x10Def(); - if (cd.flags().isFinal()) { - virtual_dispatch = false; - } - } - if (mi.flags().isFinal()) { - virtual_dispatch = false; - } - if (!virtual_dispatch && !already_static ) { - // disable virtual dispatch - sw.write(emitter.translateType(t)); - sw.write("::"); - } - // [IP] FIXME: virtual_dispatch test is temporary, until xlC is upgraded to v10 - if (context.inTemplate() && mi.typeParameters().size() != 0 && virtual_dispatch) { - sw.write("template "); - } - if (!isInterfaceInvoke) { - sw.write(targetMethodName); - emitter.printTemplateInstantiation(mi, sw); - } - sw.write("("); - if (args.size() > 0) { + private void printCallActuals(X10Call_c n, X10CPPContext_c context, X10TypeSystem_c xts, X10MethodInstance mi, + List<Expr> args) { + int counter; + if (args.size() > 0) { sw.allowBreak(2, 2, "", 0); // miser mode sw.begin(0); counter = 0; @@ -2462,13 +2612,7 @@ } sw.end(); } - sw.write(")"); - sw.write(dangling); - sw.end(); - if (needsCast) { - sw.write(")"); - } - } + } public void visit(RegionMaker_c n) { super.visit(n); @@ -2534,7 +2678,7 @@ sw.end(); return; } else { - boolean needsChecks = true || !((X10Type)t).isX10Struct(); // HACK: treating sturcts as values. + boolean needsChecks = !((X10Type)t).isX10Struct(); boolean assoc = !(target instanceof New_c || target instanceof Binary_c); if (needsChecks) sw.write("x10aux::placeCheck(x10aux::nullCheck("); n.printSubExpr((Expr) target, assoc, sw, tr); @@ -2584,7 +2728,11 @@ counter++; } - sw.write(Emitter.translateType(n.objectType().type())+"::"+MAKE+"("); + if (xts.isStructType(n.objectType().type())) { + sw.write(Emitter.structNameSpace(n.objectType().type().toClass(), true)+"::"+MAKE+"("); + } else { + sw.write(Emitter.translateType(n.objectType().type())+"::"+MAKE+"("); + } sw.begin(0); for (Iterator<Expr> i = coercedArgs.iterator(); i.hasNext(); ) { Expr e = i.next(); @@ -3081,8 +3229,8 @@ sw.write(SAVED_THIS); context.saveEnvVariableInfo(THIS); } else { - if (false && ((X10Type)n.type()).isX10Struct()) { // H... [truncated message content] |
From: <ipe...@us...> - 2009-09-29 23:46:57
|
Revision: 11314 http://x10.svn.sourceforge.net/x10/?rev=11314&view=rev Author: ipeshansky Date: 2009-09-29 23:46:41 +0000 (Tue, 29 Sep 2009) Log Message: ----------- Fix warnings: call static methods properly, add generic parameters to lists and use foreach loops where possible. Remove stray import. Minor formatting and typo fixes. Ignore generated files. Modified Paths: -------------- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java Property Changed: ---------------- trunk/x10.runtime/src-cpp/x10rt/lib/ Modified: trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java =================================================================== --- trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2009-09-29 02:06:21 UTC (rev 11313) +++ trunk/x10.compiler/src/x10cpp/visit/MessagePassingCodeGenerator.java 2009-09-29 23:46:41 UTC (rev 11314) @@ -110,6 +110,7 @@ import polyglot.ast.Stmt; import polyglot.ast.StringLit_c; import polyglot.ast.SwitchBlock_c; +import polyglot.ast.SwitchElement; import polyglot.ast.Switch_c; import polyglot.ast.Throw_c; import polyglot.ast.Try_c; @@ -135,7 +136,6 @@ import polyglot.types.TypeSystem; import polyglot.types.Types; import polyglot.types.VarInstance; -import polyglot.util.CodeWriter; import polyglot.util.ErrorInfo; import polyglot.util.InternalCompilerError; import polyglot.util.Position; @@ -234,7 +234,7 @@ * Place 0, runs the program main and sends the required communication * across, whenever it requires. * - * All the final variables that are visible in the async are send as + * All the final variables that are visible in the async are sent as * arguments. * * [TODO] @@ -290,7 +290,7 @@ if (ct.typeArguments().size() == 0) return ct; X10TypeSystem_c xts = (X10TypeSystem_c) ct.typeSystem(); - List<Type> args = new TypedList(new ArrayList<Type>(), Type.class, false); + List<Type> args = new TypedList<Type>(new ArrayList<Type>(), Type.class, false); for (int i = 0; i < ct.typeArguments().size(); i++) { args.add(xts.Void()); } @@ -399,6 +399,7 @@ ArrayList<FieldDecl_c> inits = new ArrayList<FieldDecl_c>(); String container = translate_mangled_FQN(cd.fullName().toString())+voidTemplateInstantiation(cd.typeParameters().size()); sw.write("x10aux::RuntimeType "+container+"::rtt;"); + sw.newline(); for (ClassMember dec : context.pendingStaticDecls()) { if (dec instanceof FieldDecl_c) { FieldDecl_c fd = (FieldDecl_c) dec; @@ -489,9 +490,9 @@ } private boolean extractInits(X10ClassType currentClass, String methodName, - String retType, List members, boolean staticInits) + String retType, List<ClassMember> members, boolean staticInits) { - String className = emitter.translateType(currentClass); + String className = Emitter.translateType(currentClass); boolean sawInit = false; emitter.printTemplateSignature(currentClass.typeArguments(), sw); if (currentClass.isX10Struct()) { @@ -519,8 +520,7 @@ } else { sw.write("_I_(\"Doing initialisation for class: "+className+"\");"); sw.newline(); } - for (Iterator i = members.iterator(); i.hasNext(); ) { - ClassMember member = (ClassMember) i.next(); + for (ClassMember member : members) { if (!(member instanceof Initializer_c) && !(member instanceof FieldDecl_c)) continue; if (member.memberDef().flags().isStatic() != staticInits) @@ -579,12 +579,12 @@ sw.end(); sw.newline(); sw.write("}"); sw.newline(); sw.forceNewline(0); + return sawInit; } - private boolean hasExternMethods(List members) { - for (Iterator i = members.iterator(); i.hasNext(); ) { - ClassMember member = (ClassMember) i.next(); + private boolean hasExternMethods(List<ClassMember> members) { + for (ClassMember member : members) { if (member instanceof MethodDecl_c) { MethodDecl_c init = (MethodDecl_c) member; if (X10Flags.isExtern(init.flags().flags())) @@ -655,7 +655,7 @@ X10ClassDef def = (X10ClassDef) n.classDef(); X10TypeSystem_c xts = (X10TypeSystem_c) tr.typeSystem(); boolean isStruct = xts.isStructType(def.asType()); - + if (getCppRep(def) != null) { // emit no c++ code as this is a native rep class return; @@ -1188,7 +1188,7 @@ /* Serialization redirection methods */ h.write("static void "+SERIALIZE_METHOD+"("); h.begin(0); - h.write(emitter.translateType(currentClass, true)+" this_,"); h.newline(); + h.write(Emitter.translateType(currentClass, true)+" this_,"); h.newline(); h.write(SERIALIZATION_BUFFER+"& buf,"); h.newline(); h.write("x10aux::addr_map& m) {"); h.end(); h.newline(4); h.begin(0); h.write("x10::lang::Object::"+SERIALIZE_METHOD+"(this_, buf, m);"); h.end(); h.newline(); @@ -1200,7 +1200,7 @@ h.write("}"); h.newline(); h.forceNewline(); if (!members.isEmpty()) { - String className = emitter.translateType(currentClass); + String className = Emitter.translateType(currentClass); h.write(VOID + " " + INSTANCE_INIT + "();"); h.newline(); h.forceNewline(); @@ -1242,9 +1242,9 @@ generateITablesForClass(currentClass, xts, "virtual ", h); if (!members.isEmpty()) { - String className = emitter.translateType(currentClass); + String className = Emitter.translateType(currentClass); - h.write(VOID + " " + INSTANCE_INIT + "();"); + h.write(VOID + " " + INSTANCE_INIT + "();"); h.newline(); h.forceNewline(); if (extractInits(currentClass, INSTANCE_INIT, VOID, members, false)) { @@ -1294,7 +1294,7 @@ generateITablesForClass(currentClass, xts, "virtual ", h); if (!members.isEmpty()) { - String className = emitter.translateType(currentClass); + String className = Emitter.translateType(currentClass); h.write(VOID + " " + INSTANCE_INIT + "();"); h.newline(); @@ -1331,7 +1331,7 @@ emitter.printTemplateSignature(currentClass.typeArguments(), sw); emitter.printType(xts.Boolean(), sw); - sw.write(" " + emitter.translateType(currentClass, false) + sw.write(" " + Emitter.translateType(currentClass, false) + "::" + mangled_method_name(STRUCT_EQUALS_METHOD) + "("); emitter.printType(xts.Object(), sw); @@ -1342,7 +1342,7 @@ sw.write("if (p0.operator->() == this) return true; // short-circuit trivial equality"); sw.newline(); if (superClass != null) { // HACK: treating structs as values. - sw.write("if (!this->" + emitter.translateType(superClass) + sw.write("if (!this->" + Emitter.translateType(superClass) + "::" + mangled_method_name(STRUCT_EQUALS_METHOD) + "(p0))"); sw.newline(4); @@ -1413,7 +1413,7 @@ // generateITablesForClass(currentClass, xts, "", sh); //FIXME: itable codegen for structs if (!members.isEmpty()) { - String className = emitter.translateType(currentClass); + String className = Emitter.translateType(currentClass); sh.write(VOID + " " + INSTANCE_INIT + "("+className+" *this_);"); sh.newline(); @@ -1516,13 +1516,13 @@ if (!currentClass.typeArguments().isEmpty()) { emitter.printTemplateSignature(currentClass.typeArguments(), sw); } - sw.write("x10aux::itable_entry "+emitter.translateType(currentClass)+"::_itables["+(numInterfaces+1)+"] = {"); + sw.write("x10aux::itable_entry "+Emitter.translateType(currentClass)+"::_itables["+(numInterfaces+1)+"] = {"); itableNum = 0; for (Type interfaceType : allInterfaces) { - sw.write("x10aux::itable_entry(x10aux::getRTT"+chevrons(emitter.translateType(interfaceType, false))+"(), &_itable_"+itableNum+"), "); + sw.write("x10aux::itable_entry(x10aux::getRTT"+chevrons(Emitter.translateType(interfaceType, false))+"(), &_itable_"+itableNum+"), "); itableNum += 1; } - sw.write("x10aux::itable_entry(NULL, (void*)x10aux::getRTT"+chevrons(emitter.translateType(currentClass, false))+"())};"); sw.newline(); + sw.write("x10aux::itable_entry(NULL, (void*)x10aux::getRTT"+chevrons(Emitter.translateType(currentClass, false))+"())};"); sw.newline(); } } @@ -1582,7 +1582,7 @@ emitter.printTemplateSignature(currentClass.typeArguments(), sw); emitter.printTemplateSignature(newTypeParameters, sw); emitter.printType(replaceType(X10TypeMixin.baseType(dropzone.returnType()), typeMap), sw); - sw.write(" " + emitter.translateType(currentClass, false) + + sw.write(" " + Emitter.translateType(currentClass, false) + "::" + mangled_method_name(mname.toString()) + "("); sw.begin(0); counter = 0; @@ -1612,13 +1612,13 @@ } emitter.dumpRegex("Native", components, tr, pat, sw); } else { - sw.write(emitter.translateType(superClass, false) + + sw.write(Emitter.translateType(superClass, false) + "::" + mangled_method_name(mname.toString())); if (newTypeParameters.size() != 0) { String prefix = "<"; for (Type t : newTypeParameters) { sw.write(prefix); - sw.write(emitter.translateType(t)); + sw.write(Emitter.translateType(t)); prefix = ","; } sw.write(">"); @@ -1697,7 +1697,7 @@ sw.newline(); sw.write("#include <x10aux/bootstrap.h>"); sw.newline(); - String mainTypeArgs = "x10::runtime::Runtime," + emitter.translateType(container); + String mainTypeArgs = "x10::runtime::Runtime," + Emitter.translateType(container); sw.write("extern \"C\" { int main(int ac, char **av) { return x10aux::template_main"+chevrons(mainTypeArgs)+"(ac,av); } }"); sw.newline(); sw.forceNewline(0); @@ -1805,7 +1805,7 @@ ClassifiedStream h = sw.header(); X10ClassType container = (X10ClassType) dec.constructorDef().container().get(); - String typeName = emitter.translateType(container.def().asType()); + String typeName = Emitter.translateType(container.def().asType()); sw.pushCurrentStream(h); emitter.printHeader(dec, sw, tr, false, false, "void"); @@ -1861,7 +1861,7 @@ sw.write(superClass+"::"+CONSTRUCTOR+"(this_"); if (call.arguments().size() > 0) sw.write(", "); } else { - String superClass = emitter.translateType(container.superClass()); + String superClass = Emitter.translateType(container.superClass()); sw.write("this->"+superClass+"::"+CONSTRUCTOR+"("); } } else if (call.kind() == ConstructorCall.THIS) { @@ -1966,7 +1966,8 @@ dec.print(dec.init(), sw, tr); } sw.write(";"); - sw.newline(); sw.forceNewline(); + sw.newline(); + sw.forceNewline(); } } @@ -2012,8 +2013,7 @@ if (n.elements().size() > 0) { sw.newline(4); sw.begin(0); - for (Iterator i = n.elements().iterator(); i.hasNext(); ) { - Node s = (Node) i.next(); + for (SwitchElement s : n.elements()) { n.print(s, sw, tr); } sw.end(); @@ -2030,8 +2030,8 @@ if (n.statements().size() > 0) { sw.newline(4); sw.begin(0); - for (Iterator i = n.statements().iterator(); i.hasNext(); ) { - Node s = (Node) i.next(); + for (Iterator<Stmt> i = n.statements().iterator(); i.hasNext(); ) { + Stmt s = i.next(); n.print(s, sw, tr); if (i.hasNext()) sw.newline(); @@ -2114,7 +2114,7 @@ Expr lhs = asgn.left(nf); Expr rhs = asgn.right(); if (unsigned_op) { - sw.write("("+emitter.translateType(asgn.type())+")("); + sw.write("("+Emitter.translateType(asgn.type())+")("); sw.write("(("+emitter.makeUnsignedType(lhs.type())+"&)"); } asgn.printSubExpr(lhs, false, sw, tr); @@ -2196,8 +2196,8 @@ if (b.statements().size() > 0) { sw.newline(4); sw.begin(0); - for (Iterator i = b.statements().iterator(); i.hasNext(); ) { - Stmt n = (Stmt) i.next(); + for (Iterator<Stmt> i = b.statements().iterator(); i.hasNext(); ) { + Stmt n = i.next(); b.printBlock(n, sw, tr); if (i.hasNext()) sw.newline(); @@ -2219,8 +2219,8 @@ if (s.statements().size() > 0) { sw.newline(4); sw.begin(0); - for (Iterator i = s.statements().iterator(); i.hasNext(); ) { - Stmt n = (Stmt) i.next(); + for (Iterator<Stmt> i = s.statements().iterator(); i.hasNext(); ) { + Stmt n = i.next(); s.printBlock(n, sw, tr); if (i.hasNext()) sw.newline(); @@ -2267,8 +2267,7 @@ sw.write("{"); sw.newline(4); sw.begin(0); if (n.inits() != null) { - for (Iterator i = n.inits().iterator(); i.hasNext(); ) { - ForInit s = (ForInit) i.next(); + for (ForInit s : n.inits()) { if (s instanceof LocalDecl_c) { LocalDecl_c dec = (LocalDecl_c) s; emitter.printHeader(dec, sw, tr, true); @@ -2283,8 +2282,8 @@ sw.begin(0); if (n.inits() != null) { - for (Iterator i = n.inits().iterator(); i.hasNext(); ) { - ForInit s = (ForInit) i.next(); + for (Iterator<ForInit> i = n.inits().iterator(); i.hasNext(); ) { + ForInit s = i.next(); boolean oldSemiColon = tr.appendSemicolon(false); boolean oldPrintType = tr.printType(false); n.printBlock(s, sw, tr); @@ -2309,8 +2308,8 @@ sw.allowBreak(0); if (n.iters() != null) { - for (Iterator i = n.iters().iterator(); i.hasNext(); ) { - ForUpdate s = (ForUpdate) i.next(); + for (Iterator<ForUpdate> i = n.iters().iterator(); i.hasNext(); ) { + ForUpdate s = i.next(); boolean oldSemiColon = tr.appendSemicolon(false); n.printBlock(s, sw, tr); tr.appendSemicolon(oldSemiColon); @@ -2508,7 +2507,7 @@ if (!n.isTargetImplicit()) { // explicit target. if (target instanceof X10Special_c && ((X10Special_c)target).kind().equals(X10Special_c.SUPER)) { - sw.write(emitter.translateType(t)); + sw.write(Emitter.translateType(t)); sw.write("::"); already_static = true; } else if (target instanceof Expr) { @@ -2516,7 +2515,7 @@ sw.write("((void)"); n.printSubExpr((Expr) target, false, sw, tr); sw.write(","); - sw.write(emitter.translateType(t)); + sw.write(Emitter.translateType(t)); sw.write("::"); dangling = ")"; already_static = true; @@ -2531,12 +2530,12 @@ if (ret_type.isVoid()) { sw.write("(__extension__ ({ x10aux::ref<x10::lang::Object> _ = x10aux::placeCheck(x10aux::nullCheck("); n.printSubExpr((Expr) target, assoc, sw, tr); - sw.write(")); (_.operator->()->*(x10aux::findITable"+chevrons(emitter.translateType(clsType, false))+"(_->_getITables())->"+itable.mangledName(mi)+"))"); + sw.write(")); (_.operator->()->*(x10aux::findITable"+chevrons(Emitter.translateType(clsType, false))+"(_->_getITables())->"+itable.mangledName(mi)+"))"); dangling = "; }))"; } else { sw.write("(__extension__ ({ x10aux::ref<x10::lang::Object> _ = x10aux::placeCheck(x10aux::nullCheck("); n.printSubExpr((Expr) target, assoc, sw, tr); - sw.write(")); x10aux::GXX_ICE_Workaround"+chevrons(emitter.translateType(ret_type, true))+"::_((_.operator->()->*(x10aux::findITable"+chevrons(emitter.translateType(clsType, false))+"(_->_getITables())->"+itable.mangledName(mi)+"))"); + sw.write(")); x10aux::GXX_ICE_Workaround"+chevrons(Emitter.translateType(ret_type, true))+"::_((_.operator->()->*(x10aux::findITable"+chevrons(Emitter.translateType(clsType, false))+"(_->_getITables())->"+itable.mangledName(mi)+"))"); dangling = "); }))"; } } @@ -2569,7 +2568,7 @@ } if (!virtual_dispatch && !already_static ) { // disable virtual dispatch - sw.write(emitter.translateType(t)); + sw.write(Emitter.translateType(t)); sw.write("::"); } // [IP] FIXME: virtual_dispatch test is temporary, until xlC is upgraded to v10 @@ -2599,8 +2598,8 @@ sw.allowBreak(2, 2, "", 0); // miser mode sw.begin(0); counter = 0; - for (Iterator i = args.iterator(); i.hasNext(); ) { - Expr e = (Expr) i.next(); + for (Iterator<Expr> i = args.iterator(); i.hasNext(); ) { + Expr e = i.next(); Type fType = mi.formalTypes().get(counter); assert (xts.typeDeepBaseEquals(fType, e.type(), context)) : ("Casts should have been inserted"); n.print(e, sw, tr); @@ -2670,7 +2669,7 @@ sw.write("((void)"); n.printSubExpr((Expr) target, false, sw, tr); sw.write(","); - sw.write(emitter.translateType(target.type())); + sw.write(Emitter.translateType(target.type())); sw.write("::"); sw.allowBreak(2, 3, "", 0); sw.write(mangled_field_name(n.name().id().toString())); @@ -2789,7 +2788,7 @@ } else throw new InternalCompilerError("Unrecognized IntLit kind " + n.kind()); sw.write("("); sw.begin(0); - sw.write("(" + emitter.translateType(n.type(), true) + ")"); + sw.write("(" + Emitter.translateType(n.type(), true) + ")"); sw.write(val); sw.end(); sw.write(")"); } @@ -2800,7 +2799,7 @@ public void visit(StringLit_c n) { X10TypeSystem_c xts = (X10TypeSystem_c) tr.typeSystem(); - sw.write(emitter.translateType(xts.String())+"::Lit(\""); + sw.write(Emitter.translateType(xts.String())+"::Lit(\""); sw.write(StringUtil.escape(n.stringValue())); sw.write("\")"); } @@ -2877,14 +2876,14 @@ if (n.equals()) { sw.write("x10aux::sametype"); sw.write(chevrons( - emitter.translateType(n.subtype().type(), true) + "," + - emitter.translateType(n.supertype().type(), true) + Emitter.translateType(n.subtype().type(), true) + "," + + Emitter.translateType(n.supertype().type(), true) )); } else { sw.write("x10aux::subtypeof"); sw.write(chevrons( - emitter.translateType(n.subtype().type(), true) + "," + - emitter.translateType(n.supertype().type(), true) + Emitter.translateType(n.subtype().type(), true) + "," + + Emitter.translateType(n.supertype().type(), true) )); } sw.write("()"); @@ -2895,7 +2894,7 @@ if (refsAsPointers) { sw.write("!!dynamic_cast"); - sw.write(chevrons(emitter.translateType(n.compareType().type(), true))); + sw.write(chevrons(Emitter.translateType(n.compareType().type(), true))); sw.write("("); sw.begin(0); n.printSubExpr(n.expr(), sw, tr); @@ -2904,7 +2903,7 @@ return; } sw.write("x10aux::instanceof"); - sw.write(chevrons(emitter.translateType(n.compareType().type(), true))); + sw.write(chevrons(Emitter.translateType(n.compareType().type(), true))); sw.write("("); sw.begin(0); n.printSubExpr(n.expr(), false, sw, tr); @@ -2943,11 +2942,10 @@ // *not* an interface and thus is not virtually inheritted. If it // were, we would have to static_cast the exception to Throwable on // throw (otherwise we would need to offset by an unknown quantity). - String exception_ref = emitter.translateType(xts.Throwable(), true); + String exception_ref = Emitter.translateType(xts.Throwable(), true); sw.write(exception_ref+"& " + excVar + " = ("+exception_ref+"&)" + refVar + ";"); context.setExceptionVar(excVar); - for (Iterator it = n.catchBlocks().iterator(); it.hasNext(); ) { - Catch cb = (Catch) it.next(); + for (Catch cb : n.catchBlocks()) { sw.newline(0); n.printBlock(cb, sw, tr); } @@ -2975,7 +2973,7 @@ String excVar = context.getExceptionVar(); sw.newline(); sw.write("if ("); - String type = emitter.translateType(n.formal().type().type(), true); + String type = Emitter.translateType(n.formal().type().type(), true); if (refsAsPointers) { sw.write("!!dynamic_cast" + chevrons(type) + "(" + excVar + ")"); } else { @@ -3113,10 +3111,10 @@ String name = "__i" + form.name(); String itableName = name+"_itable"; - String iteratorType = emitter.translateType(xts.Iterator(form.type().type()), false); - String iterableType = emitter.translateType(xts.Iterable(form.type().type()), false); - String iterableTypeRef = emitter.translateType(xts.Iterable(form.type().type()), true); - String iteratorTypeRef = emitter.translateType(xts.Iterator(form.type().type()), true); + String iteratorType = Emitter.translateType(xts.Iterator(form.type().type()), false); + String iterableType = Emitter.translateType(xts.Iterable(form.type().type()), false); + String iterableTypeRef = Emitter.translateType(xts.Iterable(form.type().type()), true); + String iteratorTypeRef = Emitter.translateType(xts.Iterator(form.type().type()), true); boolean doubleTemplate = ((X10ClassType)context.currentClass()).typeArguments().size() > 0; sw.write("x10aux::ref<x10::lang::Object> " + name + " = "+iteratorTypeRef); @@ -3192,14 +3190,14 @@ n.printSubExpr(n.cond(), false, sw, tr); sw.unifiedBreak(2); sw.write("? "); - sw.write("("+emitter.translateType(n.type(), true)+")("); + sw.write("("+Emitter.translateType(n.type(), true)+")("); sw.begin(0); n.printSubExpr(n.consequent(), true, sw, tr); sw.end(); sw.write(")"); sw.unifiedBreak(2); sw.write(": "); - sw.write("("+emitter.translateType(n.type(), true)+")("); + sw.write("("+Emitter.translateType(n.type(), true)+")("); sw.begin(0); n.printSubExpr(n.alternative(), true, sw, tr); sw.end(); @@ -3232,11 +3230,11 @@ if (((X10Type)n.type()).isX10Struct()) { sw.write("this_"); } else { - sw.write("(("+emitter.translateType(n.type(),true)+")"+n.kind()+")"); + sw.write("(("+Emitter.translateType(n.type(),true)+")"+n.kind()+")"); } } } else if (n.kind().equals(X10Special_c.SUPER)) { - sw.write(emitter.translateType(context.currentClass().superClass())); + sw.write(Emitter.translateType(context.currentClass().superClass())); } else if (n.isSelf()) { assert false: "I do not believe we ever visit over constraints."; // FIXME: Why are we printing the string "self"? @@ -3281,7 +3279,7 @@ freeTypeParams.addAll(hostClassDef.typeParameters()); } - String hostClassName = emitter.translate_mangled_FQN(hostClassType.fullName().toString(), "_"); + String hostClassName = translate_mangled_FQN(hostClassType.fullName().toString(), "_"); c.setInsideClosure(true); @@ -3295,7 +3293,7 @@ String prefix = "<"; for (Type t : freeTypeParams) { in_template_closure = true; - cnamet_.append(prefix + emitter.translateType(t)); + cnamet_.append(prefix + Emitter.translateType(t)); prefix = ","; } if (in_template_closure) cnamet_.append(" >"); @@ -3320,21 +3318,21 @@ } Type retType = n.returnType().type(); - //String className = emitter.translateType(c.currentClass()); + //String className = Emitter.translateType(c.currentClass()); X10ClassType sup = (X10ClassType) xts.closureBaseInterfaceDef(0, n.formals().size(), retType.isVoid()).asType(); List<Type> supArgs = new ArrayList<Type>(); for (Formal formal : n.formals()) supArgs.add(formal.type().typeRef().get()); if (!retType.isVoid()) supArgs.add(retType); - String superType = emitter.translateType(sup.typeArguments(supArgs)); - String superTypeRef = emitter.translateType(sup.typeArguments(supArgs), true); + String superType = Emitter.translateType(sup.typeArguments(supArgs)); + String superTypeRef = Emitter.translateType(sup.typeArguments(supArgs), true); // class header if (!freeTypeParams.isEmpty()) emitter.printTemplateSignature(freeTypeParams, inc); inc.write("class "+cname+" : "); inc.begin(0); - inc.write("public "+emitter.translateType(xts.Value())); + inc.write("public "+Emitter.translateType(xts.Value())); inc.write("{") ; inc.end() ; inc.newline(4); inc.begin(0); inc.write("public:") ; inc.newline(); inc.forceNewline(); @@ -3344,7 +3342,7 @@ inc.write("virtual x10aux::itable_entry* _getITables() { return _itables; }"); inc.newline(); inc.forceNewline(); inc.write("// closure body"); inc.newline(); - inc.write(emitter.translateType(retType, true)+" apply("); + inc.write(Emitter.translateType(retType, true)+" apply("); prefix = ""; for (Formal formal : n.formals()) { inc.write(prefix); @@ -3391,7 +3389,7 @@ if (name.equals(THIS)) name = SAVED_THIS; else name = mangled_non_method_name(name); - inc.write("this_->"+name+" = buf.read<"+emitter.translateType(var.type(), true)+" >();"); + inc.write("this_->"+name+" = buf.read<"+Emitter.translateType(var.type(), true)+" >();"); inc.newline(); } inc.write("return this_;"); inc.end(); inc.newline(); @@ -3408,7 +3406,7 @@ if (name.equals(THIS)) name = SAVED_THIS; else name = mangled_non_method_name(name); - inc.write(emitter.translateType(var.type(), true) + " " + name); + inc.write(Emitter.translateType(var.type(), true) + " " + name); } inc.write(") {"); inc.newline(4); inc.begin(0); @@ -3436,9 +3434,9 @@ */ inc.newline(); inc.forceNewline(); - inc.write(emitter.translateType(xts.String(), true)+" toString() {"); + inc.write(Emitter.translateType(xts.String(), true)+" toString() {"); inc.newline(4); inc.begin(0); - inc.write("return "+emitter.translateType(xts.String())+"::Lit(\""+StringUtil.escape(n.position().nameAndLineString())+"\");"); + inc.write("return "+Emitter.translateType(xts.String())+"::Lit(\""+StringUtil.escape(n.position().nameAndLineString())+"\");"); inc.end(); inc.newline(); inc.write("}"); inc.end(); inc.newline(); inc.forceNewline(); @@ -3470,7 +3468,7 @@ String template = in_template_closure ? "template " : ""; inc.write("x10aux::DeserializationDispatcher::addDeserializer("+ cnamet+"::"+template+DESERIALIZE_METHOD+ - chevrons(emitter.translateType(xts.Object()))+");"); + chevrons(Emitter.translateType(xts.Object()))+");"); inc.newline(); inc.forceNewline(); if (in_template_closure) { @@ -3489,7 +3487,7 @@ prefix="<"; StringBuffer sb = new StringBuffer(); for (Type t : freeTypeParams) { - sb.append(prefix+emitter.translateType(t, true)); + sb.append(prefix+Emitter.translateType(t, true)); prefix = ","; } if (prefix.equals(",")) sb.append(">"); @@ -3582,7 +3580,7 @@ for (Expr a : args) { alt[i] = getId(); Type fType = formals.get(i).type().type(); - sw.write(emitter.translateType(fType, true)+" "+alt[i]+" ="); + sw.write(Emitter.translateType(fType, true)+" "+alt[i]+" ="); sw.allowBreak(2, " "); c.print(a, sw, tr); sw.write(";"); @@ -3695,7 +3693,7 @@ if (lit != null || (t.isClass() && t.toClass().flags().isInterface())) { sw.write("(__extension__ ({ x10aux::ref<x10::lang::Object> _ = x10aux::placeCheck(x10aux::nullCheck("); c.printSubExpr(target, sw, tr); - sw.write(")); "+(mi.returnType().isVoid() ? "" : "x10aux::GXX_ICE_Workaround"+chevrons(emitter.translateType(mi.returnType(), true))+"::_")+"((_.operator->()->*(x10aux::findITable"+chevrons(emitter.translateType(target.type(), false))+"(_->_getITables())->apply))(");; + sw.write(")); "+(mi.returnType().isVoid() ? "" : "x10aux::GXX_ICE_Workaround"+chevrons(Emitter.translateType(mi.returnType(), true))+"::_")+"((_.operator->()->*(x10aux::findITable"+chevrons(Emitter.translateType(target.type(), false))+"(_->_getITables())->apply))(");; terminate = ");}))"; } else { sw.write("x10aux::placeCheck(x10aux::nullCheck("); @@ -3704,10 +3702,8 @@ } sw.begin(0); - List l = args; boolean first = true; - for (Iterator i = l.iterator(); i.hasNext(); ) { - Expr e = (Expr) i.next(); + for (Expr e : args) { if (!first) sw.write(","); sw.allowBreak(0, " "); c.print(e, sw, tr); @@ -3722,7 +3718,7 @@ Type t = n.type(); if (t == null) throw new InternalCompilerError("Unknown type"); - sw.write(emitter.translateType(t)); + sw.write(Emitter.translateType(t)); } @@ -3808,12 +3804,12 @@ sw.write("!"); sw.write(STRUCT_EQUALS+"("); sw.begin(0); if (c != null && !xts.isParameterType(c) && !xts.typeBaseEquals(c, l, context)) - sw.write("(" + emitter.translateType(c, true) + ")"); + sw.write("(" + Emitter.translateType(c, true) + ")"); n.printSubExpr(left, sw, tr); sw.write(","); sw.allowBreak(0, " "); if (c != null && !xts.isParameterType(c) && !xts.typeBaseEquals(c, r, context)) - sw.write("(" + emitter.translateType(c, true) + ")"); + sw.write("(" + Emitter.translateType(c, true) + ")"); n.printSubExpr(right, sw, tr); sw.end(); sw.write(")"); sw.end(); sw.write(")"); @@ -3876,7 +3872,7 @@ } if (unsigned_op) { - sw.write("("+emitter.translateType(n.type())+")("); + sw.write("("+Emitter.translateType(n.type())+")("); sw.write("(("+emitter.makeUnsignedType(n.left().type())+")"); } n.printSubExpr(n.left(), true, sw, tr); @@ -3952,7 +3948,7 @@ public void visit(Tuple_c c) { // Handles Rails initializer. Type T = X10TypeMixin.getParameterType(c.type(), 0); - String type = emitter.translateType(c.type()); + String type = Emitter.translateType(c.type()); // [DC] this cast is needed to ensure everything has a ref type // otherwise overloads don't seem to work properly sw.write("("+make_ref(type)+")"); @@ -3960,7 +3956,7 @@ emitter.printType(T, sw); sw.write(","); sw.allowBreak(0, " "); - sw.write(emitter.translateType(c.type())); + sw.write(Emitter.translateType(c.type())); sw.write(" >("+c.arguments().size()); for (Expr e : c.arguments()) { sw.write(","); Property changes on: trunk/x10.runtime/src-cpp/x10rt/lib ___________________________________________________________________ Added: svn:ignore + libx10rt_standalone.a This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |