Goose  Diff

Differences From Artifact [cda3e2d87d]:

  • File bs/builtins/types/template/uni-tdecl.cpp — part of check-in [6e598fe891] at 2019-08-29 20:12:40 on branch trunk — Params are now encoded distinctly from normal values, to allow for more generic unification rules for things suchs as BigInt versus Integer. (user: achavasse size: 8184)

To Artifact [893616dc0d]:

  • File bs/builtins/types/template/uni-tdecl.cpp — part of check-in [0db33d7cb4] at 2019-09-07 16:53:53 on branch trunk — ir: rewrote the super inefficient "term versus trie" matching function. This speeds up everything significantly: compiling the mandelbrot sample is no longer embarrassingly slower than compiling an equivalent c++ version with clang. (user: achavasse size: 8182)

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
        auto tDeclPat = ValueToIRExpr( Value( GetValueType< TDecl >(), VEC( ANYTERM( _ ), ANYTERM( _ ) ) ) );

        e.unificationRuleSet()->addHalfUnificationRule( tDeclPat,
            []( const Term& lhs, UnificationContext& c ) -> UniGen
            {
                auto tdecl = FromValue< TDecl >( *ValueFromIRExpr( lhs ) );
                assert( tdecl );
                co_yield HalfUnify( tdecl->type(), c );
            } );

        e.unificationRuleSet()->addSymRule( tDeclPat, ANYTERM( _ ), UnifyTDecl );
        e.unificationRuleSet()->addSymRule( tDeclPat, UnifyTDecl );

        // tfunc tdecl param / tfunc arg
        auto tFuncTypePat = ValueToIRExpr( Value( TypeType(), VEC( TSID( texpr ), TSID( tfunc ),







|







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
        auto tDeclPat = ValueToIRExpr( Value( GetValueType< TDecl >(), VEC( ANYTERM( _ ), ANYTERM( _ ) ) ) );

        e.unificationRuleSet()->addHalfUnificationRule( tDeclPat,
            []( const Term& lhs, UnificationContext& c ) -> UniGen
            {
                auto tdecl = FromValue< TDecl >( *ValueFromIRExpr( lhs ) );
                assert( tdecl );
                return HalfUnify( tdecl->type(), c );
            } );

        e.unificationRuleSet()->addSymRule( tDeclPat, ANYTERM( _ ), UnifyTDecl );
        e.unificationRuleSet()->addSymRule( tDeclPat, UnifyTDecl );

        // tfunc tdecl param / tfunc arg
        auto tFuncTypePat = ValueToIRExpr( Value( TypeType(), VEC( TSID( texpr ), TSID( tfunc ),