Remove (stash) debugging %traces in runtime/.
authorMatt Birkholz <puck@birchwood-abbey.net>
Tue, 5 Jan 2016 21:21:34 +0000 (14:21 -0700)
committerMatt Birkholz <puck@birchwood-abbey.net>
Tue, 5 Jan 2016 21:21:34 +0000 (14:21 -0700)
Reduce runtime/ diffs between this branch and master.

src/runtime/thread.scm

index ac7d5dc4fe10a6f7bfd3a182df1b4cc47f5e7794..543aadc68ab094e364e6973e38c8c58dd39d6dfe 100644 (file)
@@ -274,7 +274,6 @@ USA.
   unspecific)
 
 (define (thread-not-running thread state)
-  (%trace ";thread-not-running: stopping "thread" in state "state"\n")
   (set-thread/execution-state! thread state)
   (let ((thread* (thread/next thread)))
     (set-thread/next! thread #f)
@@ -282,7 +281,6 @@ USA.
   (run-first-thread))
 
 (define (run-first-thread)
-  (%trace ";run-first-thread "first-running-thread"\n")
   (if first-running-thread
       (run-thread first-running-thread)
       (begin
@@ -309,7 +307,6 @@ USA.
   (without-interrupts %suspend-current-thread))
 
 (define (%suspend-current-thread)
-  (%trace ";%suspend-current-thread: "first-running-thread"\n")
   (call-with-current-thread #f
     (lambda (thread)
       (let ((block-events? (thread/block-events? thread)))
@@ -362,7 +359,6 @@ USA.
   ;; Preserve the floating-point environment here to guarantee that the
   ;; thread timer won't raise or clear exceptions (particularly the
   ;; inexact result exception) that the interrupted thread cares about.
-  (%trace ";thread-timer: interrupt in "first-running-thread"\n")
   (let ((fp-env (enter-default-float-environment first-running-thread)))
     (set! next-scheduled-timeout #f)
     (set-interrupt-enables! interrupt-mask/gc-ok)
@@ -370,28 +366,16 @@ USA.
     (maybe-signal-io-thread-events)
     (let ((thread first-running-thread))
       (cond ((not thread)
-            (%maybe-toggle-thread-timer)
-            (%trace ";thread-timer: continuing with timer set for "
-                    next-scheduled-timeout"\n"))
+            (%maybe-toggle-thread-timer))
            ((thread/continuation thread)
-            (%trace ";thread-timer: switching to "thread"\n")
             (run-thread thread))
            ((not (eq? 'RUNNING-WITHOUT-PREEMPTION
                       (thread/execution-state thread)))
-            (%trace ";thread-timer: yielding "thread" to "(thread/next thread)"\n")
             (yield-thread thread fp-env))
            (else
-            (%trace ";thread-timer: continuing with "thread"\n")
             (restore-float-environment-from-default fp-env)
             (%resume-current-thread thread))))))
 
-(define %trace? #f)
-
-(define-syntax %trace
-  (syntax-rules ()
-    ((_ . MSG)
-     (if %trace? ((lambda () (outf-error . MSG)))))))
-
 (define (yield-current-thread)
   (without-interrupts
    (lambda ()
@@ -406,7 +390,6 @@ USA.
 
 (define (yield-thread thread #!optional fp-env)
   (let ((next (thread/next thread)))
-    (%trace ";yield-thread: "thread" yields to "next"\n")
     (if (not next)
        (begin
          (if (not (default-object? fp-env))
@@ -430,7 +413,6 @@ USA.
 \f
 (define (exit-current-thread value)
   (let ((thread (current-thread)))
-    (%trace ";exit-current-thread: "thread" with "value"\n")
     (set-interrupt-enables! interrupt-mask/gc-ok)
     (set-thread/block-events?! thread #t)
     (ring/discard-all (thread/pending-events thread))
@@ -519,7 +501,6 @@ USA.
 
 (define (wait-for-io)
   (%maybe-toggle-thread-timer #f)
-  (%trace ";wait-for-io: next timeout = "next-scheduled-timeout"\n")
   (let ((catch-errors
         (lambda (thunk)
           (let ((thread (console-thread)))
@@ -538,7 +519,6 @@ USA.
     (let ((result
           (catch-errors
            (lambda ()
-             (%trace ";wait-for-io: blocking for i/o\n")
              (set-interrupt-enables! interrupt-mask/all)
              (test-select-registry io-registry #t)))))
       (set-interrupt-enables! interrupt-mask/gc-ok)
@@ -546,15 +526,9 @@ USA.
       (let ((thread first-running-thread))
        (if thread
            (if (thread/continuation thread)
-               (begin
-                 (%trace ";wait-for-io: running "thread"\n")
-                 (run-thread thread))
-               (begin
-                 (%trace ";wait-for-io: continuing "thread"\n")
-                 (%maybe-toggle-thread-timer)))
-           (begin
-             (%trace ";wait-for-io: looping\n")
-             (wait-for-io)))))))
+               (run-thread thread)
+               (%maybe-toggle-thread-timer))
+           (wait-for-io))))))
 \f
 (define (signal-select-result result)
   (cond ((vector? result)
@@ -1070,7 +1044,6 @@ USA.
   (dynamic-wind %stop-thread-timer thunk %maybe-toggle-thread-timer))
 
 (define (%maybe-toggle-thread-timer #!optional consider-non-timers?)
-  (%trace ";%maybe-toggle-thread-timer "consider-non-timers?"\n")
   (let ((now (real-time-clock)))
     (let ((start
           (lambda (time)