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

Separate run time environments #418

Open
viebel opened this issue Jan 10, 2019 · 5 comments
Open

Separate run time environments #418

viebel opened this issue Jan 10, 2019 · 5 comments

Comments

@viebel
Copy link

viebel commented Jan 10, 2019

Subsequent calls to stopifyLocally should not interfere each other:

aa = stopify.stopifyLocally(`(() => {
  var sum = 0
  while(true) {
    sum++;
    if(sum % 1e8 === 0) {
      console.info("y:" + sum);
    }
  }
})()`); aa.run(x=>x)

aa = stopify.stopifyLocally(`(() => {
  var sum = 0
  while(true) {
    sum++;
    if(sum % 1e8 === 0) {
      console.info("x:" + sum);
    }
  }
})()`); aa.run(x=>x)

Expected behaviour: print both “x:…” and “y:…”
Actual behaviour: print only “x:…”

@rachitnigam do you think it's a regression?

@arjunguha
Copy link
Member

I'm finally back. I don't think this is a regression. We have never tried to do what you're doing.

I think part of the problem is that there is a single global variable that tracks the (single) runtime system instance:

https://github.com/plasma-umass/Stopify/blob/160af366e0fbffed8a9563c585209c7f0c6ef30a/stopify/src/entrypoints/compiler.ts#L25

Frankly, this is just bad design. There may be other issues too. We're happy to work on this.

@sp1tz this could be something to look at

@rachitnigam
Copy link
Collaborator

Okay, thanks! I did a brief hack to turn all instances of the runner to use a let instead of var, but that didn't seem to help.

This is a blocker for viebel/klipse#314 (Stopify support for Klipse) so let me know if there a branch with a hacky fix for me to look at.

@arjunguha
Copy link
Member

That won't help. It's a genuine global variable. Look at the code that Stopify generates. It assumes a single global variable, I think $S and this is it.

@rachitnigam
Copy link
Collaborator

Quick ping to see if there is anything for this. If there is a design doc with an outline for what needs to be done, I can try to hack it up.

@arjunguha
Copy link
Member

Nope, go for it! It would be great to have this in.

rachitnigam referenced this issue in brownplt/pyret-lang Aug 2, 2019
- require() pauses the current computation, finds and loads the file with a new
  AsyncRun, then resumes with the result
- makeRequireAsync() returns a promise to deal with the delayed/async result
- Everything gets stopified, no control over stopifying some modules and not
  others, or some functions and not others
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

No branches or pull requests

3 participants