1. Pypy
  2. Untitled project
  3. jitviewer

Commits

Antonio Cuni  committed 1c2ebef

add the possibility to show the bytecode position on demand. Useful when playing with jit hooks, because that is the info you have in the greenkey

  • Participants
  • Parent commits 186cc14
  • Branches default

Comments (0)

Files changed (3)

File _jitviewer/static/script.js

View file
 
 var glob_bridge_state = {
     'asm': false,
+    'bytecodepos': false,
     'op': true,
 };
 
         if (!glob_bridge_state.asm) {
             $(".asm").hide();
         }
+        if (!glob_bridge_state.bytecodepos) {
+            $(".bytecodepos").hide();
+        }
     });
 }
 
             if (!glob_bridge_state.asm) {
                 $(".asm").hide();
             }
+            if (!glob_bridge_state.bytecodepos) {
+                $(".bytecodepos").hide();
+            }
             $.scrollTo($("#loop-" + bridge_id), {axis:'y'});
         });
     });
     }
 }
 
+function bytecodepos_toggle()
+{
+    var e = $("#bytecodepos_toggler");
+    var e2 = $(".bytecodepos");
+    if (e.html().search("Show") != -1) {
+        glob_bridge_state.bytecodepos = true;
+        e.html("Hide bytecode position");
+        e2.show();
+    } else {
+        glob_bridge_state.bytecodepos = false;
+        e.html("Show bytecode position");
+        e2.hide();
+    }
+}
+
 function highlight_var(elem)
 {
     $('.' + elem.className).addClass("variable_highlight");

File _jitviewer/templates/index.html

View file
 <body>
   <header>
     <span>Menu</span><br/>
-    <a id="asmtoggler" href="/" onClick="asmtoggle(); return false">Show assembler</a>
+    <a id="asmtoggler" href="/" onClick="asmtoggle(); return false">Show assembler</a><br>
+    <a id="bytecodepos_toggler" href="/" onClick="bytecodepos_toggle(); return false">Show bytecode position</a>
     <div id="callstack">
     </div>
   </header>

File _jitviewer/templates/loop.html

View file
           <div class="operations">
               {% for chunk in sourceline.chunks %}
                  {% if chunk.is_bytecode %}
-                   <span class="{{chunk.cssclass}}">{{chunk.html_repr()}}</span><br/>
+                   <span class="{{chunk.cssclass}}"><span class="bytecodepos">{{chunk.bytecode_no}} </span>{{chunk.html_repr()}}</span><br/>
                    {% for op in chunk.operations %}
                       {% if op.name != "debug_merge_point" %}
                         {% if op.bridge %}