Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interpreter: Catch Invalid_argument more locally #1736

Merged
merged 2 commits into from
Jul 17, 2020
Merged

Commits on Jul 17, 2020

  1. Interpreter: Catch Invalid_argument more locally

    previously, we would catch `Invalid_argument` and turn it into a `Trap`
    very coarsly. The coarse `catch` around `interpret_block` was added in
    1e1757a
    but now also catches `Invalid_argument` exceptions that should _not_ be
    caught.
    
    Instead, we need to to `try … with` precisely the points where we expect
    an `Invalid_argument` to stand for something trapping. In this case
    `Prim.prim.`
    
    `Prim.prim` can't raise trap itself, as `Trap` is defined in the two
    interpreters, and because it doesn't have accees to the `exp.at`.
    
    So this wraps invocations to `Prim.prim`, following similar patters for
    `binop` etc.
    
    It also simplifies the type signature of `Prim.num_conv_prim`, making it
    clear that this is just a self-contained call-by-value function.
    Otherwise, we’d still catch `Invalid_argument` exceptions raised by the
    _continuation_ that `num_conv_prim` invokes.
    
    The same _should_ be applied to `Prim.prim`, but we can’t, because
    `Array.tabulate` is higher order and inovkes a function. But still, this
    is an improvement of the status quo.
    
    See https://dfinity.slack.com/archives/CPL67E7MX/p1594979459058400?thread_ts=1594977500.055800&cid=CPL67E7MX
    nomeata committed Jul 17, 2020
    Configuration menu
    Copy the full SHA
    0d7115b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d97fb49 View commit details
    Browse the repository at this point in the history