From: <vj...@us...> - 2010-01-30 08:41:26
|
Revision: 12780 http://x10.svn.sourceforge.net/x10/?rev=12780&view=rev Author: vj0 Date: 2010-01-30 08:41:18 +0000 (Sat, 30 Jan 2010) Log Message: ----------- Refactoring of the constraints implementation. The constraint system in x10.constraint is now made more standard. It exposes publically only those methods that should be used by clients of the constraint solver -- this will make it easier to replace this constraint solver with a more standard congruence-closure solver (necessary for integrating other constraint systems in). The notion of promise is hidden within the constraint solver implementation. Additionally, the special treatment of this and self is removed from this solver. Modified Paths: -------------- trunk/x10.compiler/src/x10/ExtensionInfo.java trunk/x10.compiler/src/x10/ast/AmbDepTypeNode_c.java trunk/x10.compiler/src/x10/ast/AssignPropertyCall_c.java trunk/x10.compiler/src/x10/ast/Async_c.java trunk/x10.compiler/src/x10/ast/AtEach_c.java trunk/x10.compiler/src/x10/ast/AtStmt_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/FunctionTypeNode_c.java trunk/x10.compiler/src/x10/ast/Here_c.java trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java trunk/x10.compiler/src/x10/ast/Tuple_c.java trunk/x10.compiler/src/x10/ast/TypeDecl_c.java trunk/x10.compiler/src/x10/ast/X10BooleanLit_c.java trunk/x10.compiler/src/x10/ast/X10CharLit_c.java trunk/x10.compiler/src/x10/ast/X10ClassBody_c.java trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java trunk/x10.compiler/src/x10/ast/X10ConstructorCall_c.java trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java trunk/x10.compiler/src/x10/ast/X10Field_c.java trunk/x10.compiler/src/x10/ast/X10FloatLit_c.java trunk/x10.compiler/src/x10/ast/X10IntLit_c.java trunk/x10.compiler/src/x10/ast/X10Local_c.java trunk/x10.compiler/src/x10/ast/X10Loop_c.java trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java trunk/x10.compiler/src/x10/ast/X10New_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/ast/X10StringLit_c.java trunk/x10.compiler/src/x10/emitter/Emitter.java trunk/x10.compiler/src/x10/emitter/RuntimeTypeExpander.java trunk/x10.compiler/src/x10/optimizations/LoopUnroller.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_c.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/ParametrizedType.java trunk/x10.compiler/src/x10/types/Subst.java trunk/x10.compiler/src/x10/types/TypeDef.java trunk/x10.compiler/src/x10/types/TypeDef_c.java trunk/x10.compiler/src/x10/types/TypeParamSubst.java trunk/x10.compiler/src/x10/types/X10ClassDef.java trunk/x10.compiler/src/x10/types/X10ClassDef_c.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_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/X10FieldInstance.java trunk/x10.compiler/src/x10/types/X10FieldInstance_c.java trunk/x10.compiler/src/x10/types/X10LocalInstance_c.java trunk/x10.compiler/src/x10/types/X10MemberDef.java trunk/x10.compiler/src/x10/types/X10MethodDef_c.java trunk/x10.compiler/src/x10/types/X10MethodInstance_c.java trunk/x10.compiler/src/x10/types/X10ParsedClassType.java trunk/x10.compiler/src/x10/types/X10ParsedClassType_c.java trunk/x10.compiler/src/x10/types/X10ProcedureDef.java trunk/x10.compiler/src/x10/types/X10ProcedureInstance.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/ClosureSynthesizer.java trunk/x10.compiler/src/x10/util/Synthesizer.java trunk/x10.compiler/src/x10/visit/ConstantPropagator.java trunk/x10.constraints/src/x10/constraint/XAnd_c.java trunk/x10.constraints/src/x10/constraint/XConstraint.java trunk/x10.constraints/src/x10/constraint/XConstraint_c.java trunk/x10.constraints/src/x10/constraint/XDisEquals_c.java trunk/x10.constraints/src/x10/constraint/XEQV_c.java trunk/x10.constraints/src/x10/constraint/XEquals_c.java trunk/x10.constraints/src/x10/constraint/XFormula_c.java trunk/x10.constraints/src/x10/constraint/XLit_c.java trunk/x10.constraints/src/x10/constraint/XLocal_c.java trunk/x10.constraints/src/x10/constraint/XNot_c.java trunk/x10.constraints/src/x10/constraint/XPromise.java trunk/x10.constraints/src/x10/constraint/XPromise_c.java trunk/x10.constraints/src/x10/constraint/XTerm.java trunk/x10.constraints/src/x10/constraint/XTerms.java trunk/x10.constraints/src/x10/constraint/XVar_c.java trunk/x10.runtime/src-java/x10/rtt/ConstrainedType.java trunk/x10.tests/examples/Constructs/Types/NullableObjectEqualsPrimitive.x10 trunk/x10.tests/examples/Constructs/Types/ObjectEqualsPrimitive.x10 Added Paths: ----------- trunk/x10.compiler/src/x10/types/constraints/ trunk/x10.compiler/src/x10/types/constraints/CConstraint.java trunk/x10.compiler/src/x10/types/constraints/CConstraint_c.java trunk/x10.compiler/src/x10/types/constraints/Constraints.java trunk/x10.compiler/src/x10/types/constraints/XConstrainedTerm.java trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/X10DepTypeSubClassOne.x10 trunk/x10.tests/examples/Constructs/Cast/ReferenceDependentTypeCast/X10InterfaceOne.x10 trunk/x10.tests/examples/Constructs/Types/NullableObjectEqualsPrimitive_MustFailCompile.x10 Removed Paths: ------------- trunk/x10.compiler/src/x10/types/X10ConstructorInstance_c.l trunk/x10.compiler/src/x10/visit/X10Boxer.java trunk/x10.constraints/src/x10/constraint/XConstrainedTerm.java trunk/x10.constraints/src/x10/constraint/XConstraintImp.java Modified: trunk/x10.compiler/src/x10/ExtensionInfo.java =================================================================== --- trunk/x10.compiler/src/x10/ExtensionInfo.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ExtensionInfo.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -71,7 +71,6 @@ import x10.visit.RewriteAtomicMethodVisitor; import x10.visit.RewriteExternVisitor; import x10.visit.StaticNestedClassRemover; -import x10.visit.X10Boxer; import x10.visit.X10Caster; import x10.visit.X10ImplicitDeclarationExpander; import x10.visit.X10InitChecker; @@ -386,12 +385,7 @@ 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(); Modified: trunk/x10.compiler/src/x10/ast/AmbDepTypeNode_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AmbDepTypeNode_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/AmbDepTypeNode_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -32,7 +32,6 @@ import polyglot.visit.NodeVisitor; import polyglot.visit.PrettyPrinter; import polyglot.visit.TypeChecker; -import x10.constraint.XConstraint; import x10.extension.X10Del; import x10.extension.X10Del_c; import x10.types.TypeConstraint; @@ -40,6 +39,7 @@ import x10.types.X10Context; import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; +import x10.types.constraints.CConstraint; public class AmbDepTypeNode_c extends TypeNode_c implements AmbDepTypeNode, AddFlags { @@ -126,7 +126,7 @@ DepParameterExpr dep = (DepParameterExpr) n.visitChild(n.dep, childtc); - XConstraint c = Types.get(dep.valueConstraint()); + CConstraint c = Types.get(dep.valueConstraint()); t = X10TypeMixin.xclause(t, c); if (flags != null) { t = X10TypeMixin.processFlags(flags, t); Modified: trunk/x10.compiler/src/x10/ast/AssignPropertyCall_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AssignPropertyCall_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/AssignPropertyCall_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -34,8 +34,7 @@ import polyglot.visit.CFGBuilder; import polyglot.visit.ContextVisitor; import polyglot.visit.NodeVisitor; -import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; + import x10.constraint.XFailure; import x10.constraint.XRef_c; import x10.constraint.XRoot; @@ -47,6 +46,8 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.XTypeTranslator; +import x10.types.constraints.CConstraint; +import x10.types.constraints.CConstraint_c; /** * @author vj @@ -187,15 +188,15 @@ Type returnType = Types.get(thisConstructor.returnType()); -// XConstraint result = X10TypeMixin.xclause(returnType); - XConstraint result = X10TypeMixin.realX(returnType); +// CConstraint result = X10TypeMixin.xclause(returnType); + CConstraint result = X10TypeMixin.realX(returnType); if (result.valid()) result = null; if (result != null) { - XConstraint known = Types.get(thisConstructor.supClause()); - known = (known==null ? new XConstraint_c() : known.copy()); + CConstraint known = Types.get(thisConstructor.supClause()); + known = (known==null ? new CConstraint_c() : known.copy()); try { known.addIn(Types.get(thisConstructor.guard())); @@ -210,7 +211,7 @@ XVar prop = (XVar) ts.xtypeTranslator().trans(known, known.self(), fii); // Add in the real clause of the initializer with [self.prop/self] - XConstraint c = X10TypeMixin.realX(initType); + CConstraint c = X10TypeMixin.realX(initType); if (c != null) known.addIn(c.substitute(prop, c.self())); Modified: trunk/x10.compiler/src/x10/ast/Async_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Async_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/Async_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -32,7 +32,6 @@ 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; @@ -41,6 +40,7 @@ import x10.types.X10Context; import x10.types.X10MethodDef; import x10.types.X10TypeSystem; +import x10.types.constraints.XConstrainedTerm; /** * Created on Oct 5, 2004 Modified: trunk/x10.compiler/src/x10/ast/AtEach_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AtEach_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/AtEach_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -26,12 +26,14 @@ import polyglot.util.Position; import polyglot.visit.PrettyPrinter; import x10.ast.X10Loop.LoopKind; -import x10.constraint.XConstrainedTerm; -import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; + import x10.constraint.XFailure; import x10.constraint.XTerm; +import x10.constraint.XTerms; import x10.types.X10Context; +import x10.types.constraints.CConstraint; +import x10.types.constraints.CConstraint_c; +import x10.types.constraints.XConstrainedTerm; /** * An immutable representation of the X10 statement: ateach (i : D) S @@ -67,8 +69,8 @@ @Override public Context enterChildScope(Node child, Context c) { X10Context xc = (X10Context) super.enterChildScope(child, c); - XConstraint d = new XConstraint_c(); - XTerm term = XConstraint_c.genUQV(); + CConstraint d = new CConstraint_c(); + XTerm term = XTerms.makeUQV(); try { // FIXME: this creates a new place term; ideally, it should be the place associated with each // point in the ateach distribution Modified: trunk/x10.compiler/src/x10/ast/AtStmt_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/AtStmt_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/AtStmt_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -37,7 +37,6 @@ 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; @@ -48,6 +47,7 @@ import x10.types.X10MethodDef; import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; +import x10.types.constraints.XConstrainedTerm; /** * Created on Oct 5, 2004 Modified: trunk/x10.compiler/src/x10/ast/DepParameterExpr.java =================================================================== --- trunk/x10.compiler/src/x10/ast/DepParameterExpr.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/DepParameterExpr.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -19,8 +19,8 @@ import polyglot.ast.Formal; import polyglot.ast.TypeNode; import polyglot.types.Ref; -import x10.constraint.XConstraint; import x10.types.TypeConstraint; +import x10.types.constraints.CConstraint; /** * @author vj Jan 9, 2005 @@ -34,8 +34,8 @@ List<Expr> condition(); DepParameterExpr condition(List<Expr> cond); - Ref<XConstraint> valueConstraint(); - DepParameterExpr valueConstraint(Ref<XConstraint> c); + Ref<CConstraint> valueConstraint(); + DepParameterExpr valueConstraint(Ref<CConstraint> c); Ref<TypeConstraint> typeConstraint(); DepParameterExpr typeConstraint(Ref<TypeConstraint> c); Modified: trunk/x10.compiler/src/x10/ast/DepParameterExpr_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/DepParameterExpr_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/DepParameterExpr_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -39,12 +39,12 @@ import polyglot.visit.TypeBuilder; import polyglot.visit.TypeCheckPreparer; import polyglot.visit.TypeChecker; -import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; import x10.types.TypeConstraint; import x10.types.TypeConstraint_c; import x10.types.X10Context; import x10.types.X10TypeSystem; +import x10.types.constraints.CConstraint; +import x10.types.constraints.CConstraint_c; /** An immutable representation of a dependent type constraint. * The corresponding syntax is [T](e){x: T; c} @@ -61,7 +61,7 @@ */ protected List<Expr> condition; - private Ref<XConstraint> valueConstraint; + private Ref<CConstraint> valueConstraint; private Ref<TypeConstraint> typeConstraint; /** @@ -102,11 +102,11 @@ return super.enterChildScope(child, c); } - public Ref<XConstraint> valueConstraint() { + public Ref<CConstraint> valueConstraint() { return valueConstraint; } - public DepParameterExpr valueConstraint(Ref<XConstraint> c) { + public DepParameterExpr valueConstraint(Ref<CConstraint> c) { DepParameterExpr_c n = (DepParameterExpr_c) copy(); n.valueConstraint = c; return n; @@ -158,7 +158,7 @@ public Node buildTypes(TypeBuilder tb) throws SemanticException { DepParameterExpr_c n = (DepParameterExpr_c) copy(); - n.valueConstraint = Types.<XConstraint>lazyRef(new XConstraint_c(), new SetResolverGoal(tb.job())); + n.valueConstraint = Types.<CConstraint>lazyRef(new CConstraint_c(), new SetResolverGoal(tb.job())); n.typeConstraint = Types.<TypeConstraint>lazyRef(new TypeConstraint_c(), new SetResolverGoal(tb.job())); return n; } @@ -168,7 +168,7 @@ tc = (TypeChecker) tc.context(v.context().freeze()); { - LazyRef<XConstraint> xr = (LazyRef<XConstraint>) valueConstraint; + LazyRef<CConstraint> xr = (LazyRef<CConstraint>) valueConstraint; assert xr != null : "setResolver pass run before buildTypes for " + this; xr.setResolver(new TypeCheckFragmentGoal(parent, this, tc, xr, false)); } @@ -242,8 +242,8 @@ } } - XConstraint xvc = ts.xtypeTranslator().constraint(formals, values, (X10Context) tc.context()); - ((LazyRef<XConstraint>) valueConstraint).update(xvc); + x10.types.constraints.CConstraint xvc = ts.xtypeTranslator().constraint(formals, values, (X10Context) tc.context()); + ((LazyRef<CConstraint>) valueConstraint).update(xvc); TypeConstraint xtc = ts.xtypeTranslator().typeConstraint(formals, types, (X10Context) tc.context()); ((LazyRef<TypeConstraint>) typeConstraint).update(xtc); Modified: trunk/x10.compiler/src/x10/ast/FunctionTypeNode_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/FunctionTypeNode_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/FunctionTypeNode_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -38,11 +38,12 @@ import polyglot.visit.ContextVisitor; import polyglot.visit.NodeVisitor; import polyglot.visit.PrettyPrinter; -import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; + import x10.types.ClosureDef; import x10.types.X10ClassType; import x10.types.X10TypeSystem; +import x10.types.constraints.CConstraint; +import x10.types.constraints.CConstraint_c; public class FunctionTypeNode_c extends TypeNode_c implements FunctionTypeNode { @@ -94,7 +95,7 @@ // typeParams, formalTypes, formalNames, guard != null ? guard.valueConstraint() - : Types.<XConstraint>lazyRef(new XConstraint_c()), + : Types.<CConstraint>lazyRef(new CConstraint_c()), // guard != null ? guard.typeConstraint() : null, throwTypes); Modified: trunk/x10.compiler/src/x10/ast/Here_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Here_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/Here_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -23,15 +23,16 @@ 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; +import x10.types.constraints.CConstraint; +import x10.types.constraints.CConstraint_c; +import x10.types.constraints.XConstrainedTerm; /** @@ -76,7 +77,7 @@ X10Context xc = (X10Context) tc.context(); Type tt = ts.Place(); - XConstraint cc = new XConstraint_c(); + CConstraint cc = new CConstraint_c(); try { cc.addSelfBinding(xc.currentPlaceTerm()); } Modified: trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/PlacedClosure_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -23,15 +23,17 @@ 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.constraint.XTerms; import x10.types.ClosureDef; import x10.types.X10Context; import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; +import x10.types.constraints.CConstraint; +import x10.types.constraints.CConstraint_c; +import x10.types.constraints.XConstrainedTerm; /** * A common abstraction for a closure that may execute at a given place, @@ -100,16 +102,16 @@ X10TypeSystem ts ) throws SemanticException { Type placeType = place.type(); - XConstraint d = X10TypeMixin.xclause(placeType); - d = (d==null) ? new XConstraint_c() : d.copy(); - XConstraint pc = null; + CConstraint d = X10TypeMixin.xclause(placeType); + d = (d==null) ? new CConstraint_c() : d.copy(); + CConstraint 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.genUQV(); + term = XTerms.makeUQV(); } try { pt = XConstrainedTerm.instantiate(d, term); @@ -123,7 +125,7 @@ if (placeIsRef) { XTerm src = ts.xtypeTranslator().trans(pc, place, xc); if (src == null) { - src = XConstraint_c.genUQV(); + src = XTerms.makeUQV(); } try { d= d.substitute(src, d.self()); Modified: trunk/x10.compiler/src/x10/ast/Tuple_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/Tuple_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/Tuple_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -35,14 +35,14 @@ import polyglot.visit.NodeVisitor; import polyglot.visit.PrettyPrinter; import polyglot.visit.Translator; -import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; import x10.constraint.XFailure; import x10.constraint.XLit; import x10.constraint.XVar; import x10.types.X10ClassType; import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; +import x10.types.constraints.CConstraint; +import x10.types.constraints.CConstraint_c; /** * An immutable representation of the X10 rail constructor [e1, ..., ek]. @@ -174,7 +174,7 @@ Type r = ts.ValRail(); Type t = (X10ClassType) X10TypeMixin.instantiate(r, type); - XConstraint c = new XConstraint_c(); + CConstraint c = new CConstraint_c(); FieldInstance lengthField = ((X10ClassType) t).fieldNamed(Name.make("length")); if (lengthField == null) throw new InternalCompilerError("Could not find length field of " + t, position()); Modified: trunk/x10.compiler/src/x10/ast/TypeDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/TypeDecl_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/TypeDecl_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -38,8 +38,7 @@ import polyglot.visit.ContextVisitor; import polyglot.visit.NodeVisitor; import polyglot.visit.TypeBuilder; -import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; + import x10.constraint.XFailure; import x10.constraint.XRoot; import x10.extension.X10Del_c; @@ -52,6 +51,8 @@ import x10.types.X10ParsedClassType; import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; +import x10.types.constraints.CConstraint; +import x10.types.constraints.CConstraint_c; public class TypeDecl_c extends Term_c implements TypeDecl { private TypeNode type; @@ -262,11 +263,11 @@ List<LocalDef> formalNames = new ArrayList<LocalDef>(); for (Formal f : n.formals()) { final Formal f2 = f; - final LazyRef<XConstraint> cref = Types.<XConstraint>lazyRef(new XConstraint_c()); + final LazyRef<CConstraint> cref = Types.<CConstraint>lazyRef(new CConstraint_c()); Type t = X10TypeMixin.xclause(f.type().typeRef(), cref); cref.setResolver(new Runnable() { public void run() { - XConstraint c = new XConstraint_c(); + CConstraint c = new CConstraint_c(); try { c.addSelfBinding(ts.xtypeTranslator().trans(f2.localDef().asInstance())); } Modified: trunk/x10.compiler/src/x10/ast/X10BooleanLit_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10BooleanLit_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/X10BooleanLit_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -16,8 +16,6 @@ import polyglot.types.Type; import polyglot.util.Position; import polyglot.visit.ContextVisitor; -import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; import x10.constraint.XFailure; import x10.constraint.XTerm; import x10.types.X10Context; @@ -25,6 +23,8 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.XTypeTranslator; +import x10.types.constraints.CConstraint; +import x10.types.constraints.CConstraint_c; /** * @author vj @@ -45,7 +45,7 @@ X10TypeSystem xts = (X10TypeSystem) tc.typeSystem(); Type Boolean = xts.Boolean(); - XConstraint c = new XConstraint_c(); + CConstraint c = new CConstraint_c(); XTerm term = xts.xtypeTranslator().trans(c, this.type(Boolean), (X10Context) tc.context()); try { c.addSelfBinding(term); Modified: trunk/x10.compiler/src/x10/ast/X10CharLit_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10CharLit_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/X10CharLit_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -16,14 +16,14 @@ import polyglot.types.Type; import polyglot.util.Position; import polyglot.visit.ContextVisitor; -import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; import x10.constraint.XFailure; import x10.constraint.XTerm; import x10.types.X10Context; import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.XTypeTranslator; +import x10.types.constraints.CConstraint; +import x10.types.constraints.CConstraint_c; /** * An immutable representation of a char lit, modified from JL @@ -44,7 +44,7 @@ X10TypeSystem xts = (X10TypeSystem) tc.typeSystem(); Type charType = xts.Char(); - XConstraint c = new XConstraint_c(); + CConstraint c = new CConstraint_c(); XTerm term = xts.xtypeTranslator().trans(c, this.type(charType), (X10Context) tc.context()); try { c.addSelfBinding(term); Modified: trunk/x10.compiler/src/x10/ast/X10ClassBody_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ClassBody_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/X10ClassBody_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -39,7 +39,6 @@ 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; @@ -57,6 +56,7 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.X10TypeSystem_c; +import x10.types.constraints.XConstrainedTerm; public class X10ClassBody_c extends ClassBody_c { public X10ClassBody_c(Position pos, java.util.List<ClassMember> members) { Modified: trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -80,9 +80,7 @@ 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; @@ -108,6 +106,9 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.X10TypeSystem_c; +import x10.types.constraints.CConstraint; +import x10.types.constraints.CConstraint_c; +import x10.types.constraints.XConstrainedTerm; import x10.util.Synthesizer; /** * The same as a Java class, except that it needs to handle properties. @@ -437,29 +438,29 @@ final DepParameterExpr ci = (DepParameterExpr) n.visitChild(n.classInvariant, childTb); n = (X10ClassDecl_c) n.classInvariant(ci); - final LazyRef<XConstraint> c = new LazyRef_c<XConstraint>(new XConstraint_c()); + final LazyRef<CConstraint> c = new LazyRef_c<CConstraint>(new CConstraint_c()); final X10ClassDecl_c nn = n; // Add all the constraints on the supertypes into the invariant. c.setResolver(new Runnable() { public void run() { - XConstraint x = new XConstraint_c(); + CConstraint x = new CConstraint_c(); try { if (ci != null) { - XConstraint xi = ci.valueConstraint().get(); + CConstraint xi = ci.valueConstraint().get(); x.addIn(xi); TypeConstraint ti = ci.typeConstraint().get(); } if (nn.superClass != null) { Type t = nn.superClass.type(); - XConstraint tc = X10TypeMixin.xclause(t); + CConstraint tc = X10TypeMixin.xclause(t); if (tc != null) x.addIn(tc); } for (TypeNode tn : nn.interfaces) { Type t = tn.type(); - XConstraint tc = X10TypeMixin.xclause(t); + CConstraint tc = X10TypeMixin.xclause(t); if (tc != null) x.addIn(tc); } @@ -608,7 +609,8 @@ public Node typeCheckOverride(Node parent, ContextVisitor tc) throws SemanticException { - X10ClassDecl_c n = this; + +X10ClassDecl_c n = this; NodeVisitor v = tc.enter(parent, n); Modified: trunk/x10.compiler/src/x10/ast/X10ConstructorCall_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ConstructorCall_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/X10ConstructorCall_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -44,7 +44,6 @@ import polyglot.visit.NodeVisitor; import polyglot.visit.TypeBuilder; import x10.ast.X10New_c.MatcherMaker; -import x10.constraint.XConstraint; import x10.types.X10ConstructorDef; import x10.types.X10ConstructorInstance; import x10.types.X10MethodInstance; @@ -53,6 +52,7 @@ import x10.types.X10TypeSystem; import x10.types.X10TypeSystem_c; import x10.types.X10TypeSystem_c.DumbConstructorMatcher; +import x10.types.constraints.CConstraint; /** * A call to this(...) or super(...) in the body of a constructor. @@ -253,7 +253,7 @@ // The constructor *within which this super call happens*. X10ConstructorDef thisConstructor = (X10ConstructorDef) ctx.currentCode(); - XConstraint c = X10TypeMixin.realX(ci.returnType()); + CConstraint c = X10TypeMixin.realX(ci.returnType()); thisConstructor.setSupClause(Types.ref(c)); } Modified: trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/X10ConstructorDecl_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -39,11 +39,9 @@ import polyglot.visit.NodeVisitor; import polyglot.visit.TypeBuilder; import polyglot.visit.TypeChecker; -import x10.constraint.XConstraint; import x10.constraint.XFailure; import x10.constraint.XName; import x10.constraint.XNameWrapper; -import x10.constraint.XPromise; import x10.constraint.XRef_c; import x10.constraint.XRoot; import x10.constraint.XTerms; @@ -60,6 +58,7 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; +import x10.types.constraints.CConstraint; /** * An X10ConstructorDecl differs from a ConstructorDecl in that it has a returnType. * @@ -253,8 +252,8 @@ // Type newType = ref.get(); // // if (n.localDef().flags().isFinal()) { -// XConstraint c = X10TypeMixin.xclause(newType); -// if (c == null) c = new XConstraint_c(); +// CConstraint c = X10TypeMixin.xclause(newType); +// if (c == null) c = new CConstraint_c(); // try { // c.addSelfBinding(xts.xtypeTranslator().trans(n.localDef().asInstance())); // } @@ -280,7 +279,7 @@ //List newFormals = new ArrayList(formals.size()); X10ProcedureDef pi = (X10ProcedureDef) nn.memberDef(); - XConstraint c = pi.guard().get(); + CConstraint c = pi.guard().get(); try { if (c != null) { c = c.copy(); @@ -291,11 +290,14 @@ // Fold the formal's constraint into the guard. XVar var = xts.xtypeTranslator().trans(n.localDef().asInstance()); - XConstraint dep = X10TypeMixin.xclause(newType); + CConstraint dep = X10TypeMixin.xclause(newType); if (dep != null) { dep = dep.copy(); - XPromise p = dep.intern(var); - dep = dep.substitute(p.term(), c.self()); + dep = dep.substitute(var, c.self()); + /* + XPromise p = dep.intern(var); + dep = dep.substitute(p.term(), c.self()); + */ c.addIn(dep); } @@ -308,7 +310,7 @@ // Fold this's constraint (the class invariant) into the guard. { Type t = tc.context().currentClass(); - XConstraint dep = X10TypeMixin.xclause(t); + CConstraint dep = X10TypeMixin.xclause(t); if (c != null && dep != null) { XRoot thisVar = ((X10MemberDef) constructorDef()).thisVar(); if (thisVar != null) @@ -391,7 +393,7 @@ X10ConstructorDecl_c n = this; for (TypeNode type : n.throwTypes()) { - XConstraint rc = X10TypeMixin.xclause(type.type()); + CConstraint rc = X10TypeMixin.xclause(type.type()); if (rc != null && ! rc.valid()) throw new SemanticException("Cannot throw a dependent type.", type.position()); } @@ -408,7 +410,7 @@ Type retTypeBase = X10TypeMixin.baseOfProto(n.returnType().type()); retTypeBase = X10TypeMixin.baseType(retTypeBase); - XConstraint c = X10TypeMixin.xclause(n.returnType().type()); + CConstraint c = X10TypeMixin.xclause(n.returnType().type()); X10ConstructorDef nnci = (X10ConstructorDef) n.constructorDef(); // Type clazz = ((X10Type) nnci.asInstance().container()).setFlags(X10Flags.ROOTED); Modified: trunk/x10.compiler/src/x10/ast/X10Field_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Field_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/X10Field_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -36,11 +36,11 @@ import polyglot.util.InternalCompilerError; import polyglot.util.Position; import polyglot.visit.ContextVisitor; -import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; + import x10.constraint.XFailure; import x10.constraint.XRoot; import x10.constraint.XTerm; +import x10.constraint.XTerms; import x10.constraint.XVar; import x10.types.ConstrainedType; import x10.types.ParameterType; @@ -54,6 +54,8 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; +import x10.types.constraints.CConstraint; +import x10.types.constraints.CConstraint_c; /** @@ -159,12 +161,12 @@ // Substitute in the actual target for this. This is done by findField, now. // Type thisType = tType; - // XConstraint rc = X10TypeMixin.realX(retType); + // CConstraint 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)); + // CConstraint newRC = rc.substitute(var, ts.xtypeTranslator().transThis(thisType)); // retType = X10TypeMixin.xclause(retType, newRC); // fi = fi.type(retType); // } @@ -172,8 +174,9 @@ result.checkConsistency(c); // Check the guard - XConstraint guard = ((X10FieldInstance) result.fieldInstance()).guard(); - if (guard != null && ! new XConstraint_c().entails(guard, c.constraintProjection(guard))) { + CConstraint guard = ((X10FieldInstance) result.fieldInstance()).guard(); + if (guard != null && ! new CConstraint_c().entails(guard, + c.constraintProjection(guard))) { throw new SemanticException("Cannot access field. Field guard not satisfied.", position()); } @@ -212,20 +215,20 @@ } public static Type rightType(Type t, X10MemberDef fi, Receiver target, Context c) throws SemanticException { - XConstraint x = X10TypeMixin.xclause(t); + CConstraint x = X10TypeMixin.xclause(t); if (x != null && fi.thisVar() != null) { if (target instanceof Expr) { XVar receiver = null; X10TypeSystem ts = (X10TypeSystem) t.typeSystem(); - XTerm r = ts.xtypeTranslator().trans((XConstraint) null, target, (X10Context) c); + XTerm r = ts.xtypeTranslator().trans((CConstraint) null, target, (X10Context) c); if (r instanceof XVar) { receiver = (XVar) r; } if (receiver == null) - receiver = XConstraint_c.genEQV(); + receiver = XTerms.makeEQV(); t = Subst.subst(t, (new XVar[] { receiver }), (new XRoot[] { fi.thisVar() }), new Type[] { }, new ParameterType[] { }); } } @@ -234,13 +237,13 @@ } public static Type fieldRightType(Type t, X10MemberDef fi, Receiver target, Context c) throws SemanticException { - XConstraint x = X10TypeMixin.xclause(t); + CConstraint x = X10TypeMixin.xclause(t); if (x != null && fi.thisVar() != null) { x = x.copy(); // Need to add the target's constraints in here because the target may not // be a variable. hence the type information wont be in the context. if (target instanceof Expr) { - XConstraint xc = X10TypeMixin.xclause(target.type()); + CConstraint xc = X10TypeMixin.xclause(target.type()); if (xc != null && ! xc.valid()) { xc = xc.copy(); try { @@ -248,13 +251,13 @@ assert receiver != null; /*if (receiver == null) { X10TypeSystem ts = (X10TypeSystem) t.typeSystem(); - XTerm r = ts.xtypeTranslator().trans((XConstraint) null, target, (X10Context) c); + XTerm r = ts.xtypeTranslator().trans((CConstraint) null, target, (X10Context) c); if (r instanceof XVar) { receiver = (XVar) r; } if (receiver == null) - receiver = XConstraint_c.genUQV(); + receiver = CConstraint_c.genUQV(); }*/ xc = xc.substitute(receiver, xc.self()); x.addIn(xc); Modified: trunk/x10.compiler/src/x10/ast/X10FloatLit_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10FloatLit_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/X10FloatLit_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -16,8 +16,6 @@ import polyglot.types.Type; import polyglot.util.Position; import polyglot.visit.ContextVisitor; -import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; import x10.constraint.XFailure; import x10.constraint.XTerm; import x10.types.X10Context; @@ -25,6 +23,8 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.XTypeTranslator; +import x10.types.constraints.CConstraint; +import x10.types.constraints.CConstraint_c; /** * An immutable representation of a float lit, modified from JL @@ -47,7 +47,7 @@ X10TypeSystem xts = (X10TypeSystem) tc.typeSystem(); Type Type = (kind==FLOAT ? xts.Float() : xts.Double()); - XConstraint c = new XConstraint_c(); + CConstraint c = new CConstraint_c(); XTerm term = xts.xtypeTranslator().trans(c, this.type(Type), (X10Context) tc.context()); try { c.addSelfBinding(term); Modified: trunk/x10.compiler/src/x10/ast/X10IntLit_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10IntLit_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/X10IntLit_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -17,8 +17,6 @@ import polyglot.util.InternalCompilerError; import polyglot.util.Position; import polyglot.visit.ContextVisitor; -import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; import x10.constraint.XFailure; import x10.constraint.XTerm; import x10.types.X10Context; @@ -26,6 +24,8 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.XTypeTranslator; +import x10.types.constraints.CConstraint; +import x10.types.constraints.CConstraint_c; import polyglot.ast.IntLit; import polyglot.ast.IntLit.Kind; @@ -86,7 +86,7 @@ else { throw new InternalCompilerError("bad integer literal kind", position()); } - XConstraint c = new XConstraint_c(); + CConstraint c = new CConstraint_c(); XTerm term = xts.xtypeTranslator().trans(c, this.type(Type), (X10Context) tc.context()); try { c.addSelfBinding(term); Modified: trunk/x10.compiler/src/x10/ast/X10Local_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Local_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/X10Local_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -27,8 +27,7 @@ import polyglot.types.VarDef; import polyglot.util.Position; import polyglot.visit.ContextVisitor; -import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; + import x10.constraint.XFailure; import x10.constraint.XLocal; import x10.constraint.XTerm; @@ -39,6 +38,8 @@ import x10.types.X10ProcedureDef; import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; +import x10.types.constraints.CConstraint; +import x10.types.constraints.CConstraint_c; public class X10Local_c extends Local_c { @@ -82,7 +83,7 @@ CodeDef ci = context.currentCode(); if (ci instanceof X10ProcedureDef) { X10ProcedureDef pi = (X10ProcedureDef) ci; - XConstraint c = Types.get(pi.guard()); + CConstraint c = Types.get(pi.guard()); if (c != null) { X10TypeSystem xts = (X10TypeSystem) tc.typeSystem(); @@ -96,8 +97,8 @@ // Add the guard into the constraint for this type. Type t = result.type(); - XConstraint dep = X10TypeMixin.xclause(t); - if (dep == null) dep = new XConstraint_c(); + CConstraint dep = X10TypeMixin.xclause(t); + if (dep == null) dep = new CConstraint_c(); else dep = dep.copy(); // XTerm resultTerm = xts.xtypeTranslator().trans(result); // dep.addSelfBinding((XVar) resultTerm); Modified: trunk/x10.compiler/src/x10/ast/X10Loop_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Loop_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/X10Loop_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -44,8 +44,6 @@ import polyglot.visit.TypeBuilder; import polyglot.visit.TypeCheckPreparer; import polyglot.visit.TypeChecker; -import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; import x10.constraint.XFailure; import x10.constraint.XName; import x10.constraint.XRoot; @@ -63,6 +61,7 @@ import x10.types.X10TypeEnv_c; import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; +import x10.types.constraints.CConstraint; import x10.util.Synthesizer; /** @@ -396,7 +395,7 @@ Type indexType = getIndexType(domainType); Type base = X10TypeMixin.baseType(domainType); - XConstraint c = X10TypeMixin.xclause(domainType); + CConstraint c = X10TypeMixin.xclause(domainType); XVar selfValue = X10TypeMixin.selfVarBinding(domainType); XVar selfVar = c != null ? c.self() : null; @@ -408,7 +407,7 @@ try { // Generate a new local variable if needed - XVar var = selfValue != null ? selfValue : XConstraint_c.genEQV(false); + XVar var = selfValue != null ? selfValue : XTerms.makeUQV(); // And substitute it for this in indexType indexType = Subst.subst(indexType, var, thisVar); if (ts.isSubtype(indexType, ts.Point(),tcp.context())) { Modified: trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/X10MethodDecl_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -74,11 +74,9 @@ import polyglot.visit.TypeBuilder; import polyglot.visit.TypeCheckPreparer; import polyglot.visit.TypeChecker; -import x10.constraint.XConstraint; import x10.constraint.XFailure; import x10.constraint.XName; import x10.constraint.XNameWrapper; -import x10.constraint.XPromise; import x10.constraint.XRef_c; import x10.constraint.XRoot; import x10.constraint.XTerm; @@ -103,6 +101,7 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.XTypeTranslator; +import x10.types.constraints.CConstraint; /** A representation of a method declaration. * Includes an extra field to represent the guard @@ -263,7 +262,7 @@ // Add the method guard into the environment. if (guard != null) { - Ref<XConstraint> vc = guard.valueConstraint(); + Ref<CConstraint> vc = guard.valueConstraint(); Ref<TypeConstraint> tc = guard.typeConstraint(); if (vc != null || tc != null) { @@ -363,7 +362,7 @@ } for (TypeNode type : n.throwTypes()) { - XConstraint rc = X10TypeMixin.xclause(type.type()); + CConstraint rc = X10TypeMixin.xclause(type.type()); if (rc != null && ! rc.valid()) throw new SemanticException("Cannot throw a dependent type.", type.position()); } @@ -405,7 +404,7 @@ if (s instanceof Return) { Return r = (Return) s; if (r.expr() != null) { - XTerm v = ts.xtypeTranslator().trans((XConstraint) null, r.expr(), (X10Context) tc.context()); + XTerm v = ts.xtypeTranslator().trans((CConstraint) null, r.expr(), (X10Context) tc.context()); ok = true; X10MethodDef mi = (X10MethodDef) this.mi; if (mi.body() instanceof LazyRef) { @@ -474,7 +473,7 @@ X10TypeSystem xts = (X10TypeSystem) tc.typeSystem(); for (TypeNode type : throwTypes()) { - XConstraint rc = X10TypeMixin.xclause(type.type()); + CConstraint rc = X10TypeMixin.xclause(type.type()); if (rc != null && ! rc.valid()) throw new SemanticException("Cannot throw a dependent type.", type.position()); } @@ -853,7 +852,7 @@ //List newFormals = new ArrayList(formals.size()); X10ProcedureDef pi = (X10ProcedureDef) nn.memberDef(); - XConstraint c = pi.guard().get(); + CConstraint c = pi.guard().get(); try { if (c != null) { c = c.copy(); @@ -864,11 +863,14 @@ // Fold the formal's constraint into the guard. XVar var = xts.xtypeTranslator().trans(n.localDef().asInstance()); - XConstraint dep = X10TypeMixin.xclause(newType); + CConstraint dep = X10TypeMixin.xclause(newType); if (dep != null) { dep = dep.copy(); + dep = dep.substitute(var, c.self()); + /* XPromise p = dep.intern(var); dep = dep.substitute(p.term(), c.self()); + */ c.addIn(dep); } @@ -881,7 +883,7 @@ // Fold this's constraint (the class invariant) into the guard. { Type t = tc.context().currentClass(); - XConstraint dep = X10TypeMixin.xclause(t); + CConstraint dep = X10TypeMixin.xclause(t); if (c != null && dep != null) { XRoot thisVar = ((X10MemberDef) methodDef()).thisVar(); if (thisVar != null) Modified: trunk/x10.compiler/src/x10/ast/X10New_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10New_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/X10New_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -49,7 +49,6 @@ import polyglot.visit.NodeVisitor; import polyglot.visit.TypeBuilder; import polyglot.visit.TypeChecker; -import x10.constraint.XConstraint; import x10.constraint.XTerm; import x10.constraint.XTerms; import x10.extension.X10Del_c; @@ -61,6 +60,7 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.X10TypeSystem_c; +import x10.types.constraints.CConstraint; /** @@ -184,7 +184,7 @@ Type t = tn.type(); t = ts.expandMacros(t); - XConstraint xc = X10TypeMixin.xclause(t); + CConstraint xc = X10TypeMixin.xclause(t); t = X10TypeMixin.baseType(t); if (!(t instanceof X10ClassType)) { @@ -229,7 +229,7 @@ Type t = ts.findMemberType(qualifier.type(), name, c); t = ts.expandMacros(t); - XConstraint xc = X10TypeMixin.xclause(t); + CConstraint xc = X10TypeMixin.xclause(t); t = X10TypeMixin.baseType(t); if (!(t instanceof X10ClassType)) { @@ -532,7 +532,7 @@ X10Context c = (X10Context) tc.context(); X10ConstructorInstance ci = (X10ConstructorInstance) constructorInstance(); if (ci != null) { - XConstraint guard = ci.guard(); + CConstraint guard = ci.guard(); if (guard != null && !guard.consistent()) { throw new SemanticException("Constructor guard not satisfied by caller.", position()); } Modified: trunk/x10.compiler/src/x10/ast/X10Return_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Return_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/X10Return_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -31,8 +31,6 @@ import polyglot.util.InternalCompilerError; import polyglot.util.Position; import polyglot.visit.ContextVisitor; -import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; import x10.constraint.XEQV; import x10.constraint.XFailure; import x10.constraint.XLocal; @@ -44,6 +42,7 @@ import x10.types.X10ProcedureDef; import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; +import x10.types.constraints.CConstraint; public class X10Return_c extends Return_c { @@ -58,14 +57,14 @@ Type b = X10TypeMixin.baseType(t); if (b != t) b = removeLocals(ctx, b, thisCode); - XConstraint c = X10TypeMixin.xclause(t); + CConstraint c = X10TypeMixin.xclause(t); if (c == null) return b; c = removeLocals(ctx, c, thisCode); return X10TypeMixin.xclause(b, c); } - public XConstraint removeLocals(X10Context ctx, XConstraint c, CodeDef thisCode) { + public CConstraint removeLocals(X10Context ctx, CConstraint c, CodeDef thisCode) { if (ctx.currentCode() != thisCode) { return c; } @@ -79,7 +78,7 @@ continue LI; } XLocal l = ts.xtypeTranslator().trans(li.asInstance()); - XEQV x = XConstraint_c.genEQV(true); + XEQV x = XTerms.makeEQV(); c = c.substitute(x, l); } catch (SemanticException e) { Modified: trunk/x10.compiler/src/x10/ast/X10Special_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Special_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/X10Special_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -18,9 +18,6 @@ import polyglot.types.Types; import polyglot.util.Position; import polyglot.visit.ContextVisitor; -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; @@ -34,6 +31,9 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.XTypeTranslator; +import x10.types.constraints.CConstraint; +import x10.types.constraints.CConstraint_c; +import x10.types.constraints.XConstrainedTerm; public class X10Special_c extends Special_c implements X10Special { @@ -144,8 +144,8 @@ if (kind == THIS) { Type tt = X10TypeMixin.baseType(t); - XConstraint cc = X10TypeMixin.xclause(t); - cc = cc == null ? new XConstraint_c() : cc.copy(); + CConstraint cc = X10TypeMixin.xclause(t); + cc = cc == null ? new CConstraint_c() : cc.copy(); try { XVar var = (XVar) xts.xtypeTranslator().trans(cc, this, c); cc.addSelfBinding(var); @@ -166,8 +166,8 @@ else if (kind == SUPER) { Type superClass = X10TypeMixin.superClass(t); Type tt = X10TypeMixin.baseType(superClass); - XConstraint cc = X10TypeMixin.xclause(superClass); - cc = cc == null ? new XConstraint_c() : cc.copy(); + CConstraint cc = X10TypeMixin.xclause(superClass); + cc = cc == null ? new CConstraint_c() : cc.copy(); try { cc.addSelfBinding((XVar) xts.xtypeTranslator().trans(cc, this, c)); } @@ -184,10 +184,10 @@ CodeDef ci = c.currentCode(); if (ci instanceof X10ProcedureDef) { X10ProcedureDef pi = (X10ProcedureDef) ci; - XConstraint guard = Types.get(pi.guard()); + CConstraint guard = Types.get(pi.guard()); if (guard != null) { Type newType = result.type(); - XConstraint dep = X10TypeMixin.xclause(newType).copy(); + CConstraint dep = X10TypeMixin.xclause(newType).copy(); try { dep.addIn(guard); } Modified: trunk/x10.compiler/src/x10/ast/X10StringLit_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10StringLit_c.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/ast/X10StringLit_c.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -16,8 +16,7 @@ import polyglot.types.Type; import polyglot.util.Position; import polyglot.visit.ContextVisitor; -import x10.constraint.XConstraint; -import x10.constraint.XConstraint_c; + import x10.constraint.XFailure; import x10.constraint.XTerm; import x10.types.X10Context; @@ -25,6 +24,8 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.XTypeTranslator; +import x10.types.constraints.CConstraint; +import x10.types.constraints.CConstraint_c; /** * @author vj @@ -43,7 +44,7 @@ X10TypeSystem xts= (X10TypeSystem) tc.typeSystem(); Type Type = xts.String(); - XConstraint c = new XConstraint_c(); + CConstraint c = new CConstraint_c(); XTerm term = xts.xtypeTranslator().trans(c, this.type(Type), (X10Context) tc.context()); try { c.addSelfBinding(term); Modified: trunk/x10.compiler/src/x10/emitter/Emitter.java =================================================================== --- trunk/x10.compiler/src/x10/emitter/Emitter.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/emitter/Emitter.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -62,7 +62,6 @@ 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; @@ -88,6 +87,7 @@ import x10.types.X10TypeMixin; import x10.types.X10TypeSystem; import x10.types.XTypeTranslator.XTypeLit_c; +import x10.types.constraints.CConstraint; import x10.visit.X10PrettyPrinterVisitor; import x10.visit.X10Translator; import x10.visit.X10PrettyPrinterVisitor.CircularList; @@ -536,11 +536,11 @@ } } } - public void serializeConstraint(XConstraint constraint) { + public void serializeConstraint(CConstraint 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.write("new x10.constraint.CConstraint_c() {{"); w.newline(4); w.begin(0); w.write("try {"); @@ -570,7 +570,7 @@ w.write("}}"); } private static final String XTERMS = "x10.constraint.XTerms"; - private void serializeTerm(XTerm term, XConstraint parent) { + private void serializeTerm(XTerm term, CConstraint parent) { if (term.equals(parent.self())) { w.write("self()"); } else @@ -1351,7 +1351,7 @@ // 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(); + CConstraint constraint = def.classInvariant().get(); assert (constraint != null); serializeConstraint(constraint); } Modified: trunk/x10.compiler/src/x10/emitter/RuntimeTypeExpander.java =================================================================== --- trunk/x10.compiler/src/x10/emitter/RuntimeTypeExpander.java 2010-01-29 22:51:32 UTC (rev 12779) +++ trunk/x10.compiler/src/x10/emitter/RuntimeTypeExpander.java 2010-01-30 08:41:18 UTC (rev 12780) @@ -13,6 +13,7 @@ import x10.types.ParameterType; import x10.types.X10ClassDef; import x10.types.X10ClassType; +import x10.types.constraints.CConstraint; import x10.visit.X10PrettyPrinterVisitor; final public class RuntimeTypeExpander extends Expander { @@ -143,7 +144,7 @@ ConstrainedType ct = (ConstrainedType) at; Type base = ct.baseType().get(); if (X10PrettyPrinterVisitor.serialize_runtime_constraints) { - XConstraint constraint = ct.constraint().get(); + CConstraint constraint = ct.constraint().get(); ... [truncated message content] |