Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Make explicit which path conditions apply to a Generator #2224

Closed
wants to merge 2 commits into from

Conversation

NTillmann
Copy link
Contributor

Release notes: None

It used to be a case that the Generator constructor simply
harvested whatever was currently set in the realm as the current
path condition.

This makes it explicit, and fixes some places where likely the wrong
path condition was picked up. At least one place caused an issue in
InstantRender that is now fixed (but I couldn't extract a small repro).

Leaving behind a number of TODO #2222s in the code to review once more.

@@ -43,7 +43,8 @@ function joinGenerators(
generator1: Generator,
generator2: Generator
): Generator {
let result = new Generator(realm, "joined");
// TODO #2222: Check if `realm.pathConditions` is correct here.
Copy link
Contributor

Choose a reason for hiding this comment

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

It is correct. The path conditions are restored when evaluateNodeForEffects returns, so the path would be whatever it was when the fork (that is now being joined) has occurred.

@@ -97,7 +97,8 @@ export class WidenImplementation {
e2.createdObjects
);
let createdObjects = new Set(); // Top, since the empty set knows nothing. There is no other choice for widen.
let generator = new Generator(realm, "widen"); // code subject to widening will be generated somewhere else
// TODO #2222: Check if `realm.pathConditions` is correct here.
Copy link
Contributor

Choose a reason for hiding this comment

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

It is correct here for the same reason as above.

src/realm.js Outdated
@@ -195,7 +195,14 @@ export function construct_empty_effects(
realm: Realm,
c: Completion = new SimpleNormalCompletion(realm.intrinsics.empty)
): Effects {
return new Effects(c, new Generator(realm, "construct_empty_effects"), new Map(), new Map(), new Set());
// TODO #2222: Check if `realm.pathConditions` is always correct here. Consider making it a required parameter.
Copy link
Contributor

Choose a reason for hiding this comment

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

The path conditions here should probably be empty. Picking up the current path conditions from the Realm might be the reason why composition does not work.

Release notes: None

It used to be a case that the Generator constructor simply
harvested whatever was currently set in the realm as the current
path condition.

This makes it explicit, and fixes some places where likely the wrong
path condition was picked up. At least one place caused an issue in
InstantRender that is now fixed (but I couldn't extract a small repro).

Leaving behind a number of `TODO #2222`s in the code to review once more.
Still leaving behind some #2222 TODOs for further investigation.
Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@NTillmann is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@hermanventer hermanventer deleted the GeneratorPathConditions branch July 11, 2018 20:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants