Skip to content
This repository has been archived by the owner on Dec 9, 2017. It is now read-only.

Developer's Guide

Manu Sridharan edited this page Jan 16, 2014 · 2 revisions

For the moment, this page is a place to collect notes on the architecture of Jalangi that don't fit as source code comments.

Global vs. module variables

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.

Clone this wiki locally