[e-lang] Safe compile-time evaluation
Mark S. Miller
markm at cs.jhu.edu
Sat May 6 20:08:44 EDT 2006
Kevin Reid wrote:
> Another issue with constant folding:
>
> Is it allowable for an E compiler to hang due to code like:
>
> if (false_but_not_statically_known) {
> __loop(thunk implements DeepFrozen { true })
> }
No.
> (Exempting __loop is insufficient since user code might behave
> similarly.)
Agreed.
> If not, how shall we avoid it? What I've thought of so far:
>
> 1. Have a rubber-stamp auditor to mark objects[*] as allowing
> constant-folding for calls to them. [...]
>
> 2. Evaluate constant calls with an interpreter with execution time/
> step-count limits. (This smaller-than-vat-granularity [...]
Why smaller than vat granularity? The compiler could spawn a vat to do
constant folding. Any time a constant fold takes too long, the compiler kills
that vat, fails to fold that constant, possibly logs a warning[1], spawns a
new vat, and proceeds with the next attempted constant fold.
> [*] Given Selfless auditors, this can be made specific to a certain
> subset of messages to an object.
Could you explain your footnote? I don't understand it. Thanks.
[1] The compiler should log this warning only to its platform's write-only log
file, in order to avoid providing its clients a visible source of non-determinism.
--
Text by me above is hereby placed in the public domain
Cheers,
--MarkM
More information about the e-lang
mailing list