Skip to content

Conversation

b-studios
Copy link
Collaborator

@b-studios b-studios commented Mar 8, 2025

This PR fixes #861 by not contifying under reset.

It also adds a pretty printer as a drive-by for easier debugging (the one from #843).

Comment on lines +88 to +94
// leads to `k_6 is not defined` when disabling optimizations on issue861.effekt
// case Some(cont: ContLam) if returnsUnique && !isRecursive =>
// val k2 = Id("k")
// given Substitution = Substitution(conts = Map(k -> ContVar(k2)))
// LetCont(k2, cont,
// Stmt.LetCont(id, ContLam(vparams, ks, substitute(rewrittenBody)),
// contify(id, rewrittenRest)))
Copy link
Collaborator Author

@b-studios b-studios Mar 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly, we do not have a regression test since we need to disable optimizations.

Maybe a variant of #851 where we selectively run tests without optimizations would be useful (here JS backend so a lot of the reported segfaults etc. do not matter here.)

The same holds for issue842.effekt which is a reproduction for #842 that we also should once run without optimizations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the present PR I comment this out, however this "might" have performance implications...

Copy link
Contributor

@jiribenes jiribenes Mar 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we're hitting the limits of the way we currently do example-based regression tests...
We have multiple axes now, but we really only cleanly account for two of them (1 & 3):

  1. by backend:
    • JS
    • LLVM
    • ...
  2. by opts:
    • with opts
    • no opts
  3. stdlib vs compiler:
    • stdlib
    • compiler
  4. by backend-specific details:
    • with valgrind
    • without valgrind

I don't really know how to neatly account for also 2 and 4 without making things too confusing 🤔

@b-studios b-studios merged commit bbe420e into master Mar 11, 2025
2 checks passed
@b-studios b-studios deleted the fix/issue861 branch March 11, 2025 15:28
b-studios pushed a commit that referenced this pull request Mar 28, 2025
This is a *continuation* of #851. We aim to fix the previously ignored
tests that currently fail when being run without optimization.

- [x] permute.effekt: segfault in resume->uniqueStack->copyStack since
resume is called with an erased resumption stack
  - apparently from growing the stack via checkLimit
    - fixed e.g. by initial size = `shl 1, 8` instead of 7
- [x] multiple declarations (in JS)
- `ascii_isalphanumeric.effekt`, `ascii_iswhitespace.effekt`,
`parser.effekt`, `probabilistic.effekt`
  - fixed by "Do not contify under reset" (found out via bisect) 
    - is still a problem though
- [x] missing block info
  - [x] generator.effekt: by noting parameters for regions
  - [x] regions.effekt
  - [x] selfregion.effekt
- [x] typeparametric.effekt: by returning garbage value (`undef`)
- [x] issue842.effekt: by #872
- [x] issue861.effekt: by #872
- [x] top-level object definititions
- if_control_effect.effekt, toplevel_objects.effekt,
type_omission_op.effekt, higherorderobject.effekt, res_obj_boxed.effekt,
effectfulobject.effekt

---------

Co-authored-by: Philipp Schuster <[email protected]>
lenakaeufel pushed a commit to lenakaeufel/effekt that referenced this pull request May 1, 2025
This is a *continuation* of effekt-lang#851. We aim to fix the previously ignored
tests that currently fail when being run without optimization.

- [x] permute.effekt: segfault in resume->uniqueStack->copyStack since
resume is called with an erased resumption stack
  - apparently from growing the stack via checkLimit
    - fixed e.g. by initial size = `shl 1, 8` instead of 7
- [x] multiple declarations (in JS)
- `ascii_isalphanumeric.effekt`, `ascii_iswhitespace.effekt`,
`parser.effekt`, `probabilistic.effekt`
  - fixed by "Do not contify under reset" (found out via bisect) 
    - is still a problem though
- [x] missing block info
  - [x] generator.effekt: by noting parameters for regions
  - [x] regions.effekt
  - [x] selfregion.effekt
- [x] typeparametric.effekt: by returning garbage value (`undef`)
- [x] issue842.effekt: by effekt-lang#872
- [x] issue861.effekt: by effekt-lang#872
- [x] top-level object definititions
- if_control_effect.effekt, toplevel_objects.effekt,
type_omission_op.effekt, higherorderobject.effekt, res_obj_boxed.effekt,
effectfulobject.effekt

---------

Co-authored-by: Philipp Schuster <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple resumption misoptimization
2 participants