Skip to content

Commit 640d3fe

Browse files
author
Philip Guo
committed
started adding "render primitives on heap" toggle option
1 parent 831b432 commit 640d3fe

3 files changed

Lines changed: 22 additions & 11 deletions

File tree

‎v3/js/opt-frontend.js‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,12 @@ $(document).ready(function() {
148148

149149
$.get(backend_script,
150150
{user_script : pyInputCodeMirror.getValue(),
151-
cumulative_mode: $('#cumulativeModeSelector').val()},
151+
cumulative_mode: $('#cumulativeModeSelector').val(),
152+
render_heap_primitives: $('#heapPrimitivesSelector').val(),
153+
},
152154
function(dataFromBackend) {
153155
var trace = dataFromBackend.trace;
154-
156+
155157
// don't enter visualize mode if there are killer errors:
156158
if (!trace ||
157159
(trace.length == 0) ||
@@ -471,6 +473,10 @@ $(document).ready(function() {
471473
if (cumulativeState !== undefined) {
472474
$('#cumulativeModeSelector').val(cumulativeState);
473475
}
476+
var heapPrimitivesState = $.bbq.getState('heapPrimitives');
477+
if (heapPrimitivesState !== undefined) {
478+
$('#heapPrimitivesSelector').val(heapPrimitivesState);
479+
}
474480
var pyState = $.bbq.getState('py');
475481
if (pyState !== undefined) {
476482
$('#pythonVersionSelector').val(pyState);
@@ -493,7 +499,7 @@ $(document).ready(function() {
493499
}
494500
}
495501

496-
502+
497503
// log a generic AJAX error handler
498504
$(document).ajaxError(function() {
499505
alert("Server error (possibly due to memory/resource overload). Report a bug to philip@pgbovine.net\n\n(Click the 'Generate URL' button to include a unique URL in your email bug report.)");
@@ -514,6 +520,7 @@ $(document).ready(function() {
514520
var myArgs = {code: pyInputCodeMirror.getValue(),
515521
mode: appMode,
516522
cumulative: $('#cumulativeModeSelector').val(),
523+
heapPrimitives: $('#heapPrimitivesSelector').val(),
517524
py: $('#pythonVersionSelector').val()};
518525

519526
if (appMode == 'display') {
@@ -529,6 +536,7 @@ $(document).ready(function() {
529536
assert(appMode == 'display');
530537
var myArgs = {code: pyInputCodeMirror.getValue(),
531538
cumulative: $('#cumulativeModeSelector').val(),
539+
heapPrimitives: $('#heapPrimitivesSelector').val(),
532540
py: $('#pythonVersionSelector').val(),
533541
curInstr: myVisualizer.curInstr,
534542
};

‎v3/js/pytutor.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5353
- NEVER use naked $(__) or d3.select(__) statements to select DOM elements.
5454
5555
ALWAYS use myViz.domRoot or myViz.domRootD3 for jQuery and D3, respectively.
56-
56+
5757
Otherwise things will break in weird ways when you have more than one visualization
5858
embedded within a webpage, due to multiple matches in the global namespace.
5959
@@ -90,7 +90,7 @@ function ExecutionVisualizer(domRootID, dat, params) {
9090
this.curInputCode = dat.code.rtrim(); // kill trailing spaces
9191
this.curTrace = dat.trace;
9292

93-
93+
9494
// optional filtering to remove redundancy ...
9595
// ok, we're gonna filter out all trace entries of 'call' events,
9696
// because each one contains IDENTICAL state information as the

‎v3/visualize.html‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,19 @@
7171
<div id="codeInputPane"></div> <!-- populate with a CodeMirror instance -->
7272

7373
<p style="margin-top: 10px;">
74-
Execute code using
74+
Execute using
7575
<select id="pythonVersionSelector">
7676
<option value="2">Python 2.7</option>
7777
<option value="3">Python 3.2</option>
78-
</select>
79-
and
78+
</select>,
8079
<select id="cumulativeModeSelector">
81-
<option value="false">don't display exited functions (default).</option>
82-
<option value="true">display frames of exited functions.</option>
83-
</select>
80+
<option value="false">hide frames of exited functions</option>
81+
<option value="true">display frames of exited functions</option>
82+
</select>, and
83+
<select id="heapPrimitivesSelector">
84+
<option value="false">render primitives in stack</option>
85+
<option value="true">render primitives on heap</option>
86+
</select>.
8487
</p>
8588

8689
<p>

0 commit comments

Comments
 (0)