-
Notifications
You must be signed in to change notification settings - Fork 28
Developer's Guide
For the moment, this page is a place to collect notes on the architecture of Jalangi that don't fit as source code comments.
Scoping of top-level var
declarations work differently in the browser vs. node.js; such variables are in the "global" scope in browsers, and visible to other scripts, while in node they are in the "module" scope and not visible to other scripts. Jalangi is able to replay both of these conventions under node by keeping a separate shadow value for each global per script. Consider the following set of scripts and their operations:
a.js: var x = 3;
b.js: read x;
c.js: var x = 5;
d.js: read x;
In the browser, there is a single global x
, and two corresponding shadow values, one for b.js
and one for d.js
. The trace will contain entries for the reads from b.js
and d.js
(since there is always a trace entry for the first read of a location). On replay under node.js, the trace will be used to feed the appropriate values to the reads, independent of the fact that the var x
declarations in a.js
and c.js
won't create global variables. When recording and replaying under node.js, scoping is not an issue since the semantics are the same for record and replay.