Skip to content

Commit

Permalink
[RFC007] Extract runtime contract equality out of typecheck (#2130)
Browse files Browse the repository at this point in the history
* Extract runtime contract equality out of typecheck

This continues the preparative work to migrate the typechecker to the
new AST. One current blocker is that the `typecheck::eq` is used both by
the typechecker and at runtime for contract deduplication; however we
will get rid of it eventually, while still needing to perform contract
deduplication (until the landing of the bytecode virtual machine).

This commit extract the code from `typecheck::eq` for contract
deduplication in a new module, so that the runtime isn't dependent on
`typecheck` anymore. The code is specialized (as it doesn't need to
handle static contract equality), and in order to eliminate the
dependence on `UnifType`, we drop the ability to compare polymorphic
type. The latter is the only reason `typecheck::eq` operated on
`UnifType` instead of `Type`, but the motivation is not very convincing:
how many times do we encounter a type annotation, itself inside a
contract annotation, such that annotation is a polymorphic type AND it
happens to be a candidate for deduplication? Our intuition would be: zero.

This hypothesis will be validated on our working benchmarks
(instrumentation counts each contract deduplication)

* Update core/src/eval/contract_eq.rs

Co-authored-by: jneem <[email protected]>

---------

Co-authored-by: jneem <[email protected]>
  • Loading branch information
yannham and jneem authored Dec 24, 2024
1 parent 77e355a commit cae9894
Show file tree
Hide file tree
Showing 4 changed files with 528 additions and 8 deletions.
Loading

0 comments on commit cae9894

Please sign in to comment.