Commits

David Mandelin  committed 88e7d48

Refresh & add more detailed causes for extend-tree condition

  • Participants
  • Parent commits 8dc017d

Comments (0)

Files changed (2)

File patches/metric-lwact.diff

-diff -r 1e9b4d1ec9af js/src/jsapi.cpp
---- a/js/src/jsapi.cpp	Tue May 12 16:25:57 2009 -0700
-+++ b/js/src/jsapi.cpp	Tue May 12 16:51:12 2009 -0700
-@@ -721,6 +721,9 @@
+diff -r fb21a3a12180 js/src/jsapi.cpp
+--- a/js/src/jsapi.cpp	Thu Jun 04 10:58:06 2009 -0700
++++ b/js/src/jsapi.cpp	Thu Jun 04 11:18:57 2009 -0700
+@@ -727,6 +727,9 @@
  JS_PUBLIC_API(JSRuntime *)
  JS_NewRuntime(uint32 maxbytes)
  {
      JSRuntime *rt;
  
  #ifdef DEBUG
-@@ -886,6 +889,9 @@
+@@ -892,6 +895,9 @@
  JS_PUBLIC_API(void)
  JS_ShutDown(void)
  {
  #ifdef JS_OPMETER
      extern void js_DumpOpMeters();
  
-diff -r 1e9b4d1ec9af js/src/jsinterp.cpp
---- a/js/src/jsinterp.cpp	Tue May 12 16:25:57 2009 -0700
-+++ b/js/src/jsinterp.cpp	Tue May 12 16:51:12 2009 -0700
-@@ -2600,9 +2600,22 @@
+diff -r fb21a3a12180 js/src/jsinterp.cpp
+--- a/js/src/jsinterp.cpp	Thu Jun 04 10:58:06 2009 -0700
++++ b/js/src/jsinterp.cpp	Thu Jun 04 11:18:57 2009 -0700
+@@ -235,7 +235,7 @@
+                                                  JSVAL_TO_OBJECT(v))),
+                             OBJ_SHAPE(obj));
+ #endif
+-                        js_MakeScopeShapeUnique(cx, scope);
++                        //js_MakeScopeShapeUnique(cx, scope); dpm per bz
+                         if (js_IsPropertyCacheDisabled(cx)) {
+                             /*
+                              * js_GenerateShape could not recover from
+@@ -2619,9 +2619,22 @@
  # define ABORT_RECORDING(cx, reason)    ((void) 0)
  #endif
  
      JSRuntime *rt;
      JSStackFrame *fp;
      JSScript *script;
-@@ -2820,6 +2833,8 @@
+@@ -2839,6 +2852,8 @@
          if (TRACING_ENABLED(cx)) {                                            \
              if (js_MonitorLoopEdge(cx, inlineCallCount)) {                    \
                  JS_ASSERT(TRACE_RECORDER(cx));                                \
                  ENABLE_INTERRUPTS();                                          \
              }                                                                 \
              fp = cx->fp;                                                      \
-@@ -3038,6 +3053,8 @@
+@@ -3057,6 +3072,8 @@
  #endif /* !JS_TRACER */
  
  #if JS_THREADED_INTERP
              jumpTable = moreInterrupts ? interruptJumpTable : normalJumpTable;
              JS_EXTENSION_(goto *normalJumpTable[op]);
  #else
-@@ -7334,6 +7351,13 @@
+@@ -7356,6 +7373,13 @@
          }
      }
  #endif
      return ok;
  
    atom_not_defined:
-diff -r 1e9b4d1ec9af js/src/jstracer.cpp
---- a/js/src/jstracer.cpp	Tue May 12 16:25:57 2009 -0700
-+++ b/js/src/jstracer.cpp	Tue May 12 16:51:12 2009 -0700
+diff -r fb21a3a12180 js/src/jstracer.cpp
+--- a/js/src/jstracer.cpp	Thu Jun 04 10:58:06 2009 -0700
++++ b/js/src/jstracer.cpp	Thu Jun 04 11:18:57 2009 -0700
 @@ -78,6 +78,8 @@
  #include "jsautooplen.h"        // generated headers last
  #include "imacros.c.out"
  #if JS_HAS_XML_SUPPORT
  #define ABORT_IF_XML(v)                                                       \
      JS_BEGIN_MACRO                                                            \
-@@ -2774,6 +2776,8 @@
+@@ -2833,6 +2835,8 @@
  JS_REQUIRES_STACK void
  TraceRecorder::compile(JSTraceMonitor* tm)
  {
      if (tm->needFlush) {
          FlushJITCache(cx);
          return;
-@@ -4269,6 +4273,8 @@
+@@ -2880,6 +2884,7 @@
+     fragmento->labels->add(fragment, sizeof(Fragment), 0, label);
+     free(label);
+ #endif
++    printf("completed\n");
+     AUDIT(traceCompleted);
+ }
+ 
+@@ -3925,11 +3930,12 @@
+ }
+ 
+ static JS_REQUIRES_STACK bool
+-js_AttemptToExtendTree(JSContext* cx, VMSideExit* anchor, VMSideExit* exitedFrom, jsbytecode* outer)
++js_AttemptToExtendTree(JSContext* cx, VMSideExit* anchor, VMSideExit* exitedFrom, jsbytecode* outer, mon_StateObj* _mso = 0)
+ {
+     JSTraceMonitor* tm = &JS_TRACE_MONITOR(cx);
+     if (tm->needFlush) {
+         FlushJITCache(cx);
++        if (_mso) _mso->r = R_FAIL_EXTEND_FLUSH;
+         return false;
+     }
+ 
+@@ -3938,8 +3944,12 @@
+     TreeInfo* ti = (TreeInfo*)f->vmprivate;
+ 
+     /* Don't grow trees above a certain size to avoid code explosion due to tail duplication. */
+-    if (ti->branchCount >= MAX_BRANCHES)
+-        return false;
++    if (ti->branchCount >= MAX_BRANCHES) {
++        printf("maxBranches %s:%u %d\n", cx->fp->script->filename,
++               js_FramePCToLineNumber(cx, cx->fp), *cx->fp->regs->pc);
++        if (_mso) _mso->r = R_FAIL_EXTEND_MAX_BRANCHES;
++        return false;
++    }
+ 
+     Fragment* c;
+     if (!(c = anchor->target)) {
+@@ -3987,9 +3997,13 @@
+             ngslots = e2->numGlobalSlots;
+             typeMap = fullMap.data();
+         }
+-        return js_StartRecorder(cx, anchor, c, (TreeInfo*)f->vmprivate, stackSlots,
+-                                ngslots, typeMap, exitedFrom, outer, cx->fp->argc);
+-    }
++        bool rv = js_StartRecorder(cx, anchor, c, (TreeInfo*)f->vmprivate, stackSlots,
++                                   ngslots, typeMap, exitedFrom, outer, cx->fp->argc);
++        if (!rv && _mso)
++            _mso->r = R_FAIL_EXTEND_START;
++        return rv;
++    }
++    if (_mso) _mso->r = R_FAIL_EXTEND_COLD;
+     return false;
+ }
+ 
+@@ -4318,6 +4332,8 @@
  js_ExecuteTree(JSContext* cx, Fragment* f, uintN& inlineCallCount,
                 VMSideExit** innermostNestedGuardp)
  {
      JS_ASSERT(f->root == f && f->code() && f->vmprivate);
  
      JSTraceMonitor* tm = &JS_TRACE_MONITOR(cx);
-@@ -4358,11 +4364,14 @@
+@@ -4407,11 +4423,14 @@
  
      debug_only(fflush(NULL);)
      GuardRecord* rec;
      VMSideExit* lr = (VMSideExit*)rec->exit;
  
      AUDIT(traceTriggered);
-@@ -4622,6 +4631,8 @@
+@@ -4671,6 +4690,8 @@
  JS_REQUIRES_STACK bool
  js_MonitorLoopEdge(JSContext* cx, uintN& inlineCallCount)
  {
      JSTraceMonitor* tm = &JS_TRACE_MONITOR(cx);
  
      /* Is the recorder currently active? */
-@@ -4641,14 +4652,17 @@
+@@ -4690,14 +4711,17 @@
           * the interpreter and do not attempt to trigger or record a new tree at this
           * location.
           */
          return false; /* Out of memory, don't try to record now. */
      }
  
-@@ -4663,8 +4677,10 @@
+@@ -4712,8 +4736,10 @@
      }
  
      /* Do not enter the JIT code with a pending operation callback. */
      
      jsbytecode* pc = cx->fp->regs->pc;
      uint32 argc = cx->fp->argc;
-@@ -4675,6 +4691,7 @@
+@@ -4724,6 +4750,7 @@
  
      if (!f) {
          FlushJITCache(cx);
          return false;
      }
  
-@@ -4682,12 +4699,17 @@
+@@ -4731,12 +4758,17 @@
         activate any trees so, start compiling. */
      if (!f->code() && !f->peer) {
      record:
 +        return rv;
      }
  
-     debug_only_v(printf("Looking for compat peer %d@%d, from %p (ip: %p)\n",
-@@ -4703,6 +4725,7 @@
+     debug_only_v(nj_dprintf("Looking for compat peer %d@%d, from %p (ip: %p)\n",
+@@ -4752,6 +4784,7 @@
             expensive. This must be a rather type-unstable loop. */
-         debug_only_v(printf("Blacklisted: too many peer trees.\n");)
+         debug_only_v(nj_dprintf("Blacklisted: too many peer trees.\n");)
          js_Blacklist((jsbytecode*) f->root->ip);
 +        _mso.r = R_MAX_PEERS;
          return false;
      }
  
-@@ -4710,24 +4733,45 @@
+@@ -4759,24 +4792,41 @@
      VMSideExit* innermostNestedGuard = NULL;
  
      lr = js_ExecuteTree(cx, match, inlineCallCount, &innermostNestedGuard);
        case BRANCH_EXIT:
        case CASE_EXIT:
 -        return js_AttemptToExtendTree(cx, lr, NULL, NULL);
-+        rv = js_AttemptToExtendTree(cx, lr, NULL, NULL);
-+        if (!rv)
-+            _mso.r = R_FAIL_EXTEND;
-+        return rv;
++        return js_AttemptToExtendTree(cx, lr, NULL, NULL, &_mso);
        case LOOP_EXIT:
--        if (innermostNestedGuard)
+         if (innermostNestedGuard)
 -            return js_AttemptToExtendTree(cx, innermostNestedGuard, lr, NULL);
 -        return false;
-+        if (innermostNestedGuard) {
-+            rv = js_AttemptToExtendTree(cx, innermostNestedGuard, lr, NULL);
-+            if (!rv)
-+                _mso.r = R_FAIL_EXTEND_INNER;
-+            return rv;
-+        }
++            return js_AttemptToExtendTree(cx, innermostNestedGuard, lr, NULL,
++                                          &_mso);
++        printf("extendOuter %s:%u %d\n", cx->fp->script->filename,
++               js_FramePCToLineNumber(cx, cx->fp), *cx->fp->regs->pc);
 +        _mso.r = R_NO_EXTEND_OUTER;
 +        return false;
 +      case MISMATCH_EXIT: _mso.r = R_MISMATCH_EXIT; return false;
          return false;
      }
  }
-diff -r 1e9b4d1ec9af js/src/jstracer.h
---- a/js/src/jstracer.h	Tue May 12 16:25:57 2009 -0700
-+++ b/js/src/jstracer.h	Tue May 12 16:51:12 2009 -0700
-@@ -749,6 +749,80 @@
+diff -r fb21a3a12180 js/src/jstracer.h
+--- a/js/src/jstracer.h	Thu Jun 04 10:58:06 2009 -0700
++++ b/js/src/jstracer.h	Thu Jun 04 11:18:57 2009 -0700
+@@ -343,11 +343,11 @@
+     unsigned                branchCount;
+     Queue<VMSideExit*>      sideExits;
+     UnstableExit*           unstableExits;
+-#ifdef DEBUG
++    //#ifdef DEBUG
+     const char*             treeFileName;
+     uintN                   treeLineNumber;
+     uintN                   treePCOffset;
+-#endif
++    //#endif
+ 
+     TreeInfo(nanojit::Fragment* _fragment,
+              SlotList* _globalSlots)
+@@ -772,6 +772,82 @@
  extern void
  js_SetMaxCodeCacheBytes(JSContext* cx, uint32 bytes);
  
 +    R_MAX_PEERS,
 +    R_FAIL_EXECUTE_TREE,
 +    R_FAIL_STABILIZE,
-+    R_FAIL_EXTEND,
-+    R_FAIL_EXTEND_INNER,
++    R_FAIL_EXTEND_FLUSH,
++    R_FAIL_EXTEND_MAX_BRANCHES,
++    R_FAIL_EXTEND_START,
++    R_FAIL_EXTEND_COLD,
 +    R_NO_EXTEND_OUTER,
 +    R_MISMATCH_EXIT,
 +    R_OOM_EXIT,

File scripts/acts.py

     'peers',
     'execute',
     'stabilize',
-    'extend',
-    'extendInner',
+    'extendFlush',
+    'extendMaxBranches',
+    'extendStart',
+    'extendCold',
     'extendOuter',
     'mismatchExit',
     'oomExit',