
URL: https://svn.lrde.epita.fr/svn/xrm/trunk ChangeLog: 2007-01-07 SIGOURE Benoit <tsuna@lrde.epita.fr> Catch another ICE condition. * src/str/xrm-to-prism.str: Trigger an ICE (Internal Compiler Error) when a parameterized formula call is found in the AST whereas it was meant to be removed (inlined) by an earlier compiler stage. * src/str/collect-static-const-decl.str: Remove an unecessary binding. * src/str/eval-meta-code.str: Remove unecessary calls to the `id' strategy. collect-static-const-decl.str | 2 +- eval-meta-code.str | 15 ++++++++------- xrm-to-prism.str | 10 ++++++---- 3 files changed, 15 insertions(+), 12 deletions(-) Index: src/str/xrm-to-prism.str =================================================================== --- src/str/xrm-to-prism.str (revision 100) +++ src/str/xrm-to-prism.str (working copy) @@ -106,7 +106,11 @@ * to expand an arrays which rely on static const variables. * NOTE: We also re-use this traversal to perform an EvalStaticRand. */ - ; log-timed(topdown(try(array-decl-desugar + EvalStaticRand)) + ; log-timed( + topdown(try(?PFormulaCall(_, _); debug + ; ice(|"xrm-to-prism", + "call to parametrized formula wasn't inlined.")) + ; try(array-decl-desugar + EvalStaticRand)) | "Desugaring array declarations", 2) /* flatten nested lists */ @@ -131,9 +135,7 @@ | "Adding modules for random numbers", 2) end - /* Remove array accesses: x[i] -> x_i - * Remove calls to parameterized formulas. - */ + // Remove array accesses: x[i] -> x_i // FIXME: can we make this more efficient than a complete innermost? ; if <is-module-file> start-symbol then log-timed( Index: src/str/eval-meta-code.str =================================================================== --- src/str/eval-meta-code.str (revision 100) +++ src/str/eval-meta-code.str (working copy) @@ -46,14 +46,15 @@ strategies - eval-meta-code = - (eval-meta-if; id/*say(!" @@@ eval-meta-code: eval-meta-if done")*/) - <+ (lazy-eval-and; id/*say(!" @@@ eval-meta-code: lazy-eval-and done")*/) - <+ (lazy-eval-or; id/*say(!" @@@ eval-meta-code: lazy-eval-or done")*/) - <+ (unroll-meta-for; id/*say(!" @@@ eval-meta-code: unroll-meta-for done")*/) - <+ (unroll-meta-forin; id/*say(!" @@@ eval-meta-code: unroll-meta-forin done")*/) - <+ (expand-pformulas; id/*say(!" @@@ eval-meta-code: expand-pformulas done")*/) // try again on expansed code. + eval-meta-code = try(?PFormulaCall(_, _); say(!"PFormulaCall"); debug);( + (eval-meta-if /*;say(!" @@@ eval-meta-code: eval-meta-if done")*/) + <+ (lazy-eval-and /*;say(!" @@@ eval-meta-code: lazy-eval-and done")*/) + <+ (lazy-eval-or /*;say(!" @@@ eval-meta-code: lazy-eval-or done")*/) + <+ (unroll-meta-for /*;say(!" @@@ eval-meta-code: unroll-meta-for done")*/) + <+ (unroll-meta-forin /*;say(!" @@@ eval-meta-code: unroll-meta-forin done")*/) + <+ (expand-pformulas ;say(!" @@@ eval-meta-code: expand-pformulas done")) <+ all(eval-meta-code) + ) strategies Index: src/str/collect-static-const-decl.str =================================================================== --- src/str/collect-static-const-decl.str (revision 100) +++ src/str/collect-static-const-decl.str (working copy) @@ -88,7 +88,7 @@ /* Only try to expand non recursive parameterized formulas (eg: for * partial evaluation) */ expand-non-recursive-pformulas = - ?PFormulaCall(Identifier(fname), _) + ?PFormulaCall(_, _) ; ExpandPFormulas ; eval-meta-code -- SIGOURE Benoit aka Tsuna (SUSv3 compliant) _____ "On a long enough timeline, the survival rate /EPITA\ Promo 2008.CSI/ACU for everyone drops to zero" -- Jack.