[Git][ghc/ghc][wip/js-staging] RTS: remove more dangling semicolons
Sylvain Henry (@hsyl20)
gitlab at gitlab.haskell.org
Fri Oct 14 13:39:14 UTC 2022
Sylvain Henry pushed to branch wip/js-staging at Glasgow Haskell Compiler / GHC
Commits:
af7f81f8 by Sylvain Henry at 2022-10-14T15:42:24+02:00
RTS: remove more dangling semicolons
- - - - -
9 changed files:
- rts/js/compact.js
- rts/js/environment.js
- rts/js/gc.js
- rts/js/hscore.js
- rts/js/mem.js
- rts/js/stableptr.js
- rts/js/stm.js
- rts/js/thread.js
- rts/js/weak.js
Changes:
=====================================
rts/js/compact.js
=====================================
@@ -8,43 +8,43 @@ function h$logCompact() { h$log.apply(h$log,arguments); }
#endif
function h$compactNew(size) {
- TRACE_COMPACT("compactNew" + size);
+ TRACE_COMPACT("compactNew" + size)
throw new Error("not implemented");
}
function h$compactResize(compact, size) {
- TRACE_COMPACT("compactResize" + size);
+ TRACE_COMPACT("compactResize" + size)
}
function h$compactContains(compact, obj) {
- TRACE_COMPACT("compactContains");
+ TRACE_COMPACT("compactContains")
return 0;
}
function h$compactContainsAny(obj) {
- TRACE_COMPACT("compactContainsAny");
+ TRACE_COMPACT("compactContainsAny")
return 0;
}
function h$compactGetFirstBlock(compact) {
- TRACE_COMPACT("compactGetFirstBlock");
+ TRACE_COMPACT("compactGetFirstBlock")
RETURN_UBX_TUP2(null, 0);
}
function h$compactGetNextBlock(compact, blocka, blokco) {
- TRACE_COMPACT("compactGetNextBlock");
+ TRACE_COMPACT("compactGetNextBlock")
RETURN_UBX_TUP2(null, 0);
}
function h$compactAllocateBlock(size, suggesta, suggesto) {
- TRACE_COMPACT("compactAllocateBlock" + size);
+ TRACE_COMPACT("compactAllocateBlock" + size)
throw new Error("not implemented");
// returns new root address
RETURN_UBX_TUP2(null, 0);
}
function h$compactFixupPointers(blocka, blocko, roota, rooto) {
- TRACE_COMPACT("compactFixupPointers");
+ TRACE_COMPACT("compactFixupPointers")
throw new Error("not implemented");
// returns new root address and new Compact#
RETURN_UBX_TUP3(null, null, 0);
@@ -52,18 +52,18 @@ function h$compactFixupPointers(blocka, blocko, roota, rooto) {
function h$compactAdd(compact, obj) {
- TRACE_COMPACT("compactAdd");
+ TRACE_COMPACT("compactAdd")
throw new Error("not implemented");
}
function h$compactAddWithSharing(compact, obj) {
- TRACE_COMPACT("compactAddWithSharing");
+ TRACE_COMPACT("compactAddWithSharing")
throw new Error("not implemented");
}
function h$compactCompactSize(compact) {
- TRACE_COMPACT("compactSize");
+ TRACE_COMPACT("compactSize")
return 0;
}
=====================================
rts/js/environment.js
=====================================
@@ -151,7 +151,7 @@ function h$initArgs() {
}
function h$getProgArgv(argc_v,argc_off,argv_v,argv_off) {
- TRACE_ENV("getProgArgV");
+ TRACE_ENV("getProgArgV")
var c = h$programArgs().length;
if(c === 0) {
argc_v.dv.setInt32(argc_off, 0, true);
@@ -195,25 +195,25 @@ function h$getCPUTime() {
if(h$isNode()) {
var t = process.cpuUsage();
var cput = t.user + t.system;
- TRACE_ENV("getCPUTime: " + cput);
+ TRACE_ENV("getCPUTime: " + cput)
return cput;
}
#endif
// XXX this allows more testsuites to run
// but I don't really like returning a fake value here
- TRACE_ENV("getCPUTime: returning fake value");
+ TRACE_ENV("getCPUTime: returning fake value")
return ++h$fakeCpuTime;
return -1;
}
function h$__hscore_environ() {
- TRACE_ENV("hscore_environ");
+ TRACE_ENV("hscore_environ")
#ifndef GHCJS_BROWSER
if(h$isNode()) {
var env = [], i;
for(i in process.env) {
var envv = i + '=' + process.env[i];
- TRACE_ENV("hscore_environ: " + envv);
+ TRACE_ENV("hscore_environ: " + envv)
env.push(envv);
}
if(env.length === 0) return null;
@@ -232,13 +232,13 @@ function h$__hsbase_unsetenv(name, name_off) {
}
function h$getenv(name, name_off) {
- TRACE_ENV("getenv");
+ TRACE_ENV("getenv")
#ifndef GHCJS_BROWSER
if(h$isNode()) {
var n = h$decodeUtf8z(name, name_off);
- TRACE_ENV("getenv (node): " + n);
+ TRACE_ENV("getenv (node): " + n)
if(typeof process.env[n] !== 'undefined') {
- TRACE_ENV("getenv (node): " + n + " -> " + process.env[n]);
+ TRACE_ENV("getenv (node): " + n + " -> " + process.env[n])
RETURN_UBX_TUP2(h$encodeUtf8(process.env[n]), 0);
}
}
@@ -249,7 +249,7 @@ function h$getenv(name, name_off) {
function h$setenv(name, name_off, val, val_off, overwrite) {
var n = h$decodeUtf8z(name, name_off);
var v = h$decodeUtf8z(val, val_off);
- TRACE_ENV("setenv: " + n + " -> " + v);
+ TRACE_ENV("setenv: " + n + " -> " + v)
if(n.indexOf('=') !== -1) {
h$setErrno("EINVAL");
return -1;
@@ -264,7 +264,7 @@ function h$setenv(name, name_off, val, val_off, overwrite) {
function h$unsetenv(name, name_off) {
var n = h$decodeUtf8z(name, name_off);
- TRACE_ENV("unsetenv: " + n);
+ TRACE_ENV("unsetenv: " + n)
if(n.indexOf('=') !== -1) {
h$setErrno("EINVAL");
return -1;
@@ -287,14 +287,14 @@ function h$putenv(str, str_off) {
#ifndef GHCJS_BROWSER
var x = h$decodeUtf8z(str, str_off);
var i = x.indexOf('=');
- TRACE_ENV("putenv: " + x);
+ TRACE_ENV("putenv: " + x)
if(i === -1) { // remove the value
- TRACE_ENV("putenv unset: " + x);
+ TRACE_ENV("putenv unset: " + x)
if(h$isNode()) delete process.env[x];
} else { // set the value
var name = x.substring(0, i)
var val = x.substring(i+1);
- TRACE_ENV("putenv set: " + name + " -> " + val);
+ TRACE_ENV("putenv set: " + name + " -> " + val)
if(h$isNode()) process.env[name] = val;
}
#endif
=====================================
rts/js/gc.js
=====================================
@@ -159,8 +159,8 @@ function h$gcQuick(t) {
#ifdef GHCJS_TRACE_GC
var time = Date.now() - start;
h$gcTime += time;
- TRACE_GC("time (quick): " + time + "ms");
- TRACE_GC("time (total): " + h$gcTime + "ms");
+ TRACE_GC("time (quick): " + time + "ms")
+ TRACE_GC("time (total): " + h$gcTime + "ms")
#endif
}
@@ -181,10 +181,10 @@ function h$gc(t) {
if(h$currentThread !== null) throw "h$gc: GC can only be run when no thread is running";
#ifdef GHCJS_TRACE_GC
h$marked = 0;
- TRACE_GC("gc: " + (t!==null?h$threadString(t):"null"));
+ TRACE_GC("gc: " + (t!==null?h$threadString(t):"null"))
var start = Date.now();
#endif
- TRACE_GC("full gc of thread " + h$threadString(t));
+ TRACE_GC("full gc of thread " + h$threadString(t))
h$resetRegisters();
h$resetResultVars();
h$gcMark = 5-h$gcMark;
@@ -194,7 +194,7 @@ function h$gc(t) {
var a = h$extensibleRetentionRoots[i](h$gcMark);
if(a) h$follow(a, a.length-1);
}
- TRACE_GC("scanning threads, runnable: " + h$threads.length() + " blocked: " + h$blocked.size() + " t: " + t);
+ TRACE_GC("scanning threads, runnable: " + h$threads.length() + " blocked: " + h$blocked.size() + " t: " + t)
// mark al runnable threads and the running thread
if(t !== null) {
@@ -218,11 +218,11 @@ function h$gc(t) {
}
h$resetThread(nt);
}
- TRACE_GC("scanning permanent retention roots");
+ TRACE_GC("scanning permanent retention roots")
iter = h$extraRoots.iter();
while((nt = iter.next()) !== null) h$follow(nt.root);
- TRACE_GC("scanning stable pointers");
+ TRACE_GC("scanning stable pointers")
for(i=0;i<h$stablePtrData.length;i++) {
if(h$stablePtrData[i]) h$follow(h$stablePtrData[i]);
}
@@ -241,9 +241,9 @@ function h$gc(t) {
#ifdef GHCJS_TRACE_GC
var time = now - start;
h$gcTime += time;
- TRACE_GC("time: " + time + "ms");
- TRACE_GC("time (total): " + h$gcTime + "ms");
- TRACE_GC("marked objects: " + h$marked);
+ TRACE_GC("time: " + time + "ms")
+ TRACE_GC("time (total): " + h$gcTime + "ms")
+ TRACE_GC("marked objects: " + h$marked)
#endif
h$debugAlloc_verifyReachability(h$gcMark);
}
@@ -280,7 +280,7 @@ function h$markRetained() {
or its finalizer, and move the weak pointer object to a new list
*/
do {
- TRACE_GC("mark retained iteration 1/2");
+ TRACE_GC("mark retained iteration 1/2")
marked = false;
for (i = 0; i < h$weakPointerList.length; ++i) {
@@ -329,14 +329,14 @@ function h$markRetained() {
continue;
}
- TRACE_GC("mark retained iteration 2/2");
+ TRACE_GC("mark retained iteration 2/2")
if(w.val !== null) {
w.val = null;
}
if(w.finalizer !== null) {
if(!IS_MARKED(w.finalizer)) {
- TRACE_GC("following finalizer");
+ TRACE_GC("following finalizer")
h$follow(w.finalizer);
}
toFinalize.push(w);
@@ -356,7 +356,7 @@ function h$markRetained() {
function h$markThread(t) {
var mark = h$gcMark;
- TRACE_GC("marking thread: " + h$threadString(t));
+ TRACE_GC("marking thread: " + h$threadString(t))
if(IS_MARKED(t)) return;
h$follow(t);
}
@@ -387,7 +387,7 @@ function h$follow(obj, sp) {
#ifdef GHCJS_TRACE_GC
var start = Date.now();
#endif
- TRACE_GC("following");
+ TRACE_GC("following")
var work, mark = h$gcMark;
if(typeof sp === 'number') {
work = obj.slice(0, sp+1);
@@ -397,26 +397,26 @@ function h$follow(obj, sp) {
w = 1;
}
while(w > 0) {
- TRACE_GC("work length: " + work.length + " w: " + w);
+ TRACE_GC("work length: " + work.length + " w: " + w)
c = work[--w];
- TRACE_GC("[" + work.length + "] mark step: " + typeof c);
+ TRACE_GC("[" + work.length + "] mark step: " + typeof c)
#ifdef GHCJS_TRACE_GC
if(typeof c === 'object') {
if(c !== null) {
- TRACE_GC("object: " + c.toString());
- TRACE_GC("object props: " + h$collectProps(c));
- TRACE_GC("object mark: " + c.m + " (" + typeof(c.m) + ") (current: " + mark + ")");
+ TRACE_GC("object: " + c.toString())
+ TRACE_GC("object props: " + h$collectProps(c))
+ TRACE_GC("object mark: " + c.m + " (" + typeof(c.m) + ") (current: " + mark + ")")
} else {
- TRACE_GC("object: " + c);
+ TRACE_GC("object: " + c)
}
}
#endif
if(c !== null && c !== undefined && typeof c === 'object' && ((typeof c.m === 'number' && (c.m&3) !== mark) || (typeof c.m === 'object' && c.m !== null && typeof c.m.m === 'number' && (c.m.m&3) !== mark))) {
var doMark = false;
var cf = c.f;
- TRACE_GC("first accepted");
+ TRACE_GC("first accepted")
if(typeof cf === 'function' && (typeof c.m === 'number' || typeof c.m === 'object')) {
- TRACE_GC("marking heap object: " + c.f.n + " size: " + c.f.size);
+ TRACE_GC("marking heap object: " + c.f.n + " size: " + c.f.size)
// only change the two least significant bits for heap objects
MARK_OBJ(c);
// dynamic references
@@ -440,16 +440,16 @@ function h$follow(obj, sp) {
// static references
var s = cf.s;
if(s !== null) {
- TRACE_GC("adding static marks");
+ TRACE_GC("adding static marks")
for(var i=0;i<s.length;i++) ADDW(s[i]);
}
} else if(typeof c.len === 'number' && c.buf instanceof ArrayBuffer) {
- TRACE_GC("marking ByteArray");
+ TRACE_GC("marking ByteArray")
MARK_OBJ(c);
} else if(c instanceof h$Weak) {
MARK_OBJ(c);
} else if(c instanceof h$MVar) {
- TRACE_GC("marking MVar");
+ TRACE_GC("marking MVar")
MARK_OBJ(c);
iter = c.writers.iter();
while((ii = iter()) !== null) {
@@ -467,11 +467,11 @@ function h$follow(obj, sp) {
}
if(c.val !== null && !IS_MARKED(c.val)) ADDW(c.val);
} else if(c instanceof h$MutVar) {
- TRACE_GC("marking MutVar");
+ TRACE_GC("marking MutVar")
MARK_OBJ(c);
ADDW(c.val);
} else if(c instanceof h$TVar) {
- TRACE_GC("marking TVar");
+ TRACE_GC("marking TVar")
MARK_OBJ(c);
ADDW(c.val);
iter = c.blocked.iter();
@@ -485,7 +485,7 @@ function h$follow(obj, sp) {
}
}
} else if(c instanceof h$Thread) {
- TRACE_GC("marking Thread");
+ TRACE_GC("marking Thread")
MARK_OBJ(c);
if(c.stack) {
for(i=c.sp;i>=0;i--) {
@@ -498,7 +498,7 @@ function h$follow(obj, sp) {
} else if(c instanceof h$Transaction) {
// - the accessed TVar values don't need to be marked
// - parents are also on the stack, so they should've been marked already
- TRACE_GC("marking STM transaction");
+ TRACE_GC("marking STM transaction")
MARK_OBJ(c);
for(i=c.invariants.length-1;i>=0;i--) {
ADDW(c.invariants[i].action);
@@ -511,7 +511,7 @@ function h$follow(obj, sp) {
} else if(c instanceof Array && c.__ghcjsArray) {
// only for Haskell arrays with lifted values
MARK_OBJ(c);
- TRACE_GC("marking array");
+ TRACE_GC("marking array")
for(i=0;i<c.length;i++) {
var x = c[i];
if(typeof x === 'object' && x !== null && !IS_MARKED(x)) {
@@ -519,7 +519,7 @@ function h$follow(obj, sp) {
}
}
} else if(typeof c === 'object') {
- TRACE_GC("extensible retention marking");
+ TRACE_GC("extensible retention marking")
#ifdef GHCJS_TRACE_GC_UNKNOWN
var extensibleMatched = false;
#endif
@@ -538,13 +538,13 @@ function h$follow(obj, sp) {
}
#ifdef GHCJS_TRACE_GC_UNKNOWN
if(!extensibleMatched) {
- TRACE_GC("unknown object: " + h$collectProps(c));
+ TRACE_GC("unknown object: " + h$collectProps(c))
}
#endif
} // otherwise: not an object, no followable values
}
}
- TRACE_GC("h$follow: " + (Date.now()-start) + "ms");
+ TRACE_GC("h$follow: " + (Date.now()-start) + "ms")
}
// resetThread clears the stack above the stack pointer
@@ -564,7 +564,7 @@ function h$resetThread(t) {
stack[i] = null;
}
}
- TRACE_GC("h$resetThread: " + (Date.now()-start) + "ms");
+ TRACE_GC("h$resetThread: " + (Date.now()-start) + "ms")
}
/*
@@ -574,7 +574,7 @@ function h$resetThread(t) {
All woken up threads are marked.
*/
function h$resolveDeadlocks() {
- TRACE_GC("resolving deadlocks");
+ TRACE_GC("resolving deadlocks")
var kill, t, iter, bo, mark = h$gcMark;
do {
h$markWeaks();
@@ -626,13 +626,13 @@ function h$finalizeCAFs() {
if(c.m & 3 !== mark) {
var cr = h$CAFsReset[i];
if(c.f !== cr[0]) { // has been updated, reset it
- TRACE_GC("resetting CAF: " + cr.n);
+ TRACE_GC("resetting CAF: " + cr.n)
c.f = cr[0];
c.d1 = cr[1];
c.d2 = cr[2];
}
}
}
- TRACE_GC("h$finalizeCAFs: " + (Date.now()-start) + "ms");
+ TRACE_GC("h$finalizeCAFs: " + (Date.now()-start) + "ms")
}
=====================================
rts/js/hscore.js
=====================================
@@ -8,97 +8,97 @@ function h$logHscore() { h$log.apply(h$log,arguments); }
#endif
function h$__hscore_sizeof_termios() {
- TRACE_HSCORE("hscore_sizeof_termios");
+ TRACE_HSCORE("hscore_sizeof_termios")
return 4;
}
function h$tcgetattr(x, y, z) {
- TRACE_HSCORE("tcgetattr: " + x + " " + y + " " + z);
+ TRACE_HSCORE("tcgetattr: " + x + " " + y + " " + z)
return 0;
}
function h$__hscore_get_saved_termios(r) {
- TRACE_HSCORE("hscore_get_saved_termios: " + r);
+ TRACE_HSCORE("hscore_get_saved_termios: " + r)
RETURN_UBX_TUP2(null, 0);
}
function h$__hscore_set_saved_termios(a, b, c) {
- TRACE_HSCORE("hscore_set_saved_termios: " + a + " " + b + " " + c);
+ TRACE_HSCORE("hscore_set_saved_termios: " + a + " " + b + " " + c)
RETURN_UBX_TUP2(null, 0);
}
function h$__hscore_sizeof_sigset_t() {
- TRACE_HSCORE("hscore_sizeof_sigset_t");
+ TRACE_HSCORE("hscore_sizeof_sigset_t")
return 4;
}
function h$sigemptyset(a, b) {
- TRACE_HSCORE("sigemptyset: " + a + " " + b);
+ TRACE_HSCORE("sigemptyset: " + a + " " + b)
RETURN_UBX_TUP2(null, 0);
}
function h$__hscore_sigttou() {
- TRACE_HSCORE("hscore_sigttou");
+ TRACE_HSCORE("hscore_sigttou")
return 0;
}
function h$sigaddset(a, b, c) {
- TRACE_HSCORE("sigaddset: " + a + " " + b + " " + c);
+ TRACE_HSCORE("sigaddset: " + a + " " + b + " " + c)
return 0;
}
function h$__hscore_sig_block() {
- TRACE_HSCORE("hscore_sig_block");
+ TRACE_HSCORE("hscore_sig_block")
return 0;
}
function h$sigprocmask(a,b,c,d,e) {
- TRACE_HSCORE("sigprocmask: " + a + " " + b + " " + c + " " + d + " " + e);
+ TRACE_HSCORE("sigprocmask: " + a + " " + b + " " + c + " " + d + " " + e)
RETURN_UBX_TUP2(0, 0);
}
function h$__hscore_lflag(a,b) {
- TRACE_HSCORE("hscore_lflag: " + a + " " + b);
+ TRACE_HSCORE("hscore_lflag: " + a + " " + b)
return 0;
}
function h$__hscore_icanon() {
- TRACE_HSCORE("hscore_icanon");
+ TRACE_HSCORE("hscore_icanon")
return 0;
}
function h$__hscore_poke_lflag(a, b, c) {
- TRACE_HSCORE("hscore_poke_lflag: " + a + " " + b + " " + c);
+ TRACE_HSCORE("hscore_poke_lflag: " + a + " " + b + " " + c)
return 0;
}
function h$__hscore_ptr_c_cc(a, b) {
- TRACE_HSCORE("hscore_ptr_c_cc: " + a + " " + b);
+ TRACE_HSCORE("hscore_ptr_c_cc: " + a + " " + b)
RETURN_UBX_TUP2(h$newByteArray(8), 0); // null;
}
function h$__hscore_vmin() {
- TRACE_HSCORE("hscore_vmin");
+ TRACE_HSCORE("hscore_vmin")
RETURN_UBX_TUP2(h$newByteArray(8), 0); // null;
}
function h$__hscore_vtime() {
- TRACE_HSCORE("hscore_vtime");
+ TRACE_HSCORE("hscore_vtime")
return 0;
}
function h$__hscore_tcsanow() {
- TRACE_HSCORE("hscore_tcsanow");
+ TRACE_HSCORE("hscore_tcsanow")
return 0;
}
function h$tcsetattr(a,b,c,d) {
- TRACE_HSCORE("tcsetattr: " + a + " " + b + " " + c + " " + d);
+ TRACE_HSCORE("tcsetattr: " + a + " " + b + " " + c + " " + d)
return 0;
}
function h$__hscore_sig_setmask() {
- TRACE_HSCORE("hscore_sig_setmask");
+ TRACE_HSCORE("hscore_sig_setmask")
return 0;
}
=====================================
rts/js/mem.js
=====================================
@@ -129,7 +129,7 @@ function h$initInfoTables ( depth // depth in the base chain
, infoMeta // packed info
, infoStatic
) {
- TRACE_META("decoding info tables");
+ TRACE_META("decoding info tables")
var n, i, j, o, pos = 0, info;
function code(c) {
if(c < 34) return c - 32;
@@ -139,7 +139,7 @@ function h$initInfoTables ( depth // depth in the base chain
function next() {
var c = info.charCodeAt(pos);
if(c < 124) {
- TRACE_META("pos: " + pos + " decoded: " + code(c));
+ TRACE_META("pos: " + pos + " decoded: " + code(c))
pos++;
return code(c);
}
@@ -147,7 +147,7 @@ function h$initInfoTables ( depth // depth in the base chain
pos+=3;
var r = 90 + 90 * code(info.charCodeAt(pos-2))
+ code(info.charCodeAt(pos-1));
- TRACE_META("pos: " + (pos-3) + " decoded: " + r);
+ TRACE_META("pos: " + (pos-3) + " decoded: " + r)
return r;
}
if(c === 125) {
@@ -155,7 +155,7 @@ function h$initInfoTables ( depth // depth in the base chain
var r = 8190 + 8100 * code(info.charCodeAt(pos-3))
+ 90 * code(info.charCodeAt(pos-2))
+ code(info.charCodeAt(pos-1));
- TRACE_META("pos: " + (pos-4) + " decoded: " + r);
+ TRACE_META("pos: " + (pos-4) + " decoded: " + r)
return r;
}
throw ("h$initInfoTables: invalid code in info table: " + c + " at " + pos)
@@ -173,7 +173,7 @@ function h$initInfoTables ( depth // depth in the base chain
} else {
r = n - 12;
}
- TRACE_META("decoded int: " + r);
+ TRACE_META("decoded int: " + r)
return r;
}
function nextSignificand() {
@@ -190,7 +190,7 @@ function h$initInfoTables ( depth // depth in the base chain
} else {
r = n - 12;
}
- TRACE_META("decoded significand:" + r);
+ TRACE_META("decoded significand:" + r)
return r;
}
function nextEntry(o) { return nextIndexed("nextEntry", h$entriesStack, o); }
@@ -212,25 +212,25 @@ function h$initInfoTables ( depth // depth in the base chain
var isString = false;
switch(o) {
case 0:
- TRACE_META("bool arg: false");
+ TRACE_META("bool arg: false")
return false;
case 1:
- TRACE_META("bool arg: true");
+ TRACE_META("bool arg: true")
return true;
case 2:
- TRACE_META("int constant: 0");
+ TRACE_META("int constant: 0")
return 0;
case 3:
- TRACE_META("int constant: 1");
+ TRACE_META("int constant: 1")
return 1;
case 4:
- TRACE_META("int arg");
+ TRACE_META("int arg")
return nextInt();
case 5:
- TRACE_META("literal arg: null");
+ TRACE_META("literal arg: null")
return null;
case 6:
- TRACE_META("double arg");
+ TRACE_META("double arg")
n = next();
switch(n) {
case 0:
@@ -258,11 +258,11 @@ function h$initInfoTables ( depth // depth in the base chain
return nextSignificand() * Math.pow(2, n1);
}
case 7:
- TRACE_META("string arg");
+ TRACE_META("string arg")
isString = true;
// no break, strings are null temrinated UTF8 encoded binary with
case 8:
- TRACE_META("binary arg");
+ TRACE_META("binary arg")
n = next();
var ba = h$newByteArray(isString ? (n+1) : n);
var b8 = ba.u8;
@@ -308,7 +308,7 @@ function h$initInfoTables ( depth // depth in the base chain
}
return h$init_closure(c, args);
default:
- TRACE_META("object arg: " + (o-11));
+ TRACE_META("object arg: " + (o-11))
return nextObj(o-11);
}
}
@@ -370,20 +370,20 @@ function h$initInfoTables ( depth // depth in the base chain
info = infoStatic;
pos = 0;
for(i=0;i<objects.length;i++) {
- TRACE_META("start iteration");
+ TRACE_META("start iteration")
o = objects[i];
// traceMetaObjBefore(o);
var nx = next();
- TRACE_META("static init object: " + i + " tag: " + nx);
+ TRACE_META("static init object: " + i + " tag: " + nx)
switch(nx) {
case 0: // no init, could be a primitive value (still in the list since others might reference it)
// h$log("zero init");
break;
case 1: // staticfun
o.f = nextEntry();
- TRACE_META("staticFun");
+ TRACE_META("staticFun")
n = next();
- TRACE_META("args: " + n);
+ TRACE_META("args: " + n)
if(n === 0) {
o.d1 = null;
o.d2 = null;
@@ -401,10 +401,10 @@ function h$initInfoTables ( depth // depth in the base chain
break;
case 2: // staticThunk
- TRACE_META("staticThunk");
+ TRACE_META("staticThunk")
o.f = nextEntry();
n = next();
- TRACE_META("args: " + n);
+ TRACE_META("args: " + n)
if(n === 0) {
o.d1 = null;
o.d2 = null;
@@ -422,19 +422,19 @@ function h$initInfoTables ( depth // depth in the base chain
h$addCAF(o);
break;
case 3: // staticPrim false, no init
- TRACE_META("staticBool false");
+ TRACE_META("staticBool false")
break;
case 4: // staticPrim true, no init
- TRACE_META("staticBool true");
+ TRACE_META("staticBool true")
break;
case 5:
- TRACE_META("staticInt");
+ TRACE_META("staticInt")
break;
case 6: // staticString
- TRACE_META("staticDouble");
+ TRACE_META("staticDouble")
break;
case 7: // staticBin
- TRACE_META("staticBin: error unused");
+ TRACE_META("staticBin: error unused")
n = next();
var b = h$newByteArray(n);
for(j=0;j>n;j++) {
@@ -442,15 +442,15 @@ function h$initInfoTables ( depth // depth in the base chain
}
break;
case 8: // staticEmptyList
- TRACE_META("staticEmptyList");
+ TRACE_META("staticEmptyList")
o.f = HS_NIL_CON;
break;
case 9: // staticList
- TRACE_META("staticList");
+ TRACE_META("staticList")
n = next();
var hasTail = next();
var c = (hasTail === 1) ? nextObj() : HS_NIL;
- TRACE_META("list length: " + n);
+ TRACE_META("list length: " + n)
while(n--) {
c = MK_CONS(nextArg(), c);
}
@@ -459,51 +459,51 @@ function h$initInfoTables ( depth // depth in the base chain
o.d2 = c.d2;
break;
case 10: // staticData n args
- TRACE_META("staticData");
+ TRACE_META("staticData")
n = next();
- TRACE_META("args: " + n);
+ TRACE_META("args: " + n)
o.f = nextEntry();
for(j=0;j<n;j++) {
h$setField(o, j, nextArg());
}
break;
case 11: // staticData 0 args
- TRACE_META("staticData0");
+ TRACE_META("staticData0")
o.f = nextEntry();
break;
case 12: // staticData 1 args
- TRACE_META("staticData1");
+ TRACE_META("staticData1")
o.f = nextEntry();
o.d1 = nextArg();
break;
case 13: // staticData 2 args
- TRACE_META("staticData2");
+ TRACE_META("staticData2")
o.f = nextEntry();
o.d1 = nextArg();
o.d2 = nextArg();
break;
case 14: // staticData 3 args
- TRACE_META("staticData3");
+ TRACE_META("staticData3")
o.f = nextEntry();
o.d1 = nextArg();
// should be the correct order
o.d2 = { d1: nextArg(), d2: nextArg()};
break;
case 15: // staticData 4 args
- TRACE_META("staticData4");
+ TRACE_META("staticData4")
o.f = nextEntry();
o.d1 = nextArg();
// should be the correct order
o.d2 = { d1: nextArg(), d2: nextArg(), d3: nextArg() };
break;
case 16: // staticData 5 args
- TRACE_META("staticData5");
+ TRACE_META("staticData5")
o.f = nextEntry();
o.d1 = nextArg();
o.d2 = { d1: nextArg(), d2: nextArg(), d3: nextArg(), d4: nextArg() };
break;
case 17: // staticData 6 args
- TRACE_META("staticData6");
+ TRACE_META("staticData6")
o.f = nextEntry();
o.d1 = nextArg();
o.d2 = { d1: nextArg(), d2: nextArg(), d3: nextArg(), d4: nextArg(), d5: nextArg() };
=====================================
rts/js/stableptr.js
=====================================
@@ -20,13 +20,13 @@ var h$stablePtrN = 1;
var h$stablePtrFree = [];
function h$makeStablePtr(v) {
- TRACE_STABLEPTR("makeStablePtr");
+ TRACE_STABLEPTR("makeStablePtr")
if(!v) return 0;
var slot = h$stablePtrFree.pop();
if(slot === undefined) {
slot = h$stablePtrN++;
}
- TRACE_STABLEPTR(" -> slot:" + slot);
+ TRACE_STABLEPTR(" -> slot:" + slot)
h$stablePtrData[slot] = v;
return slot << 2;
}
@@ -59,7 +59,7 @@ function h$deRefStablePtr(stable_o) {
function h$hs_free_stable_ptr(stable_d, stable_o) {
var slot = stable_o >> 2;
- TRACE_STABLEPTR("hs_free_stable_ptr");
+ TRACE_STABLEPTR("hs_free_stable_ptr")
if(h$stablePtrData[slot] !== null) {
h$stablePtrData[slot] = null;
h$stablePtrFree.push(slot);
@@ -68,8 +68,8 @@ function h$hs_free_stable_ptr(stable_d, stable_o) {
// not strictly stableptr, but we make it work only for stable pointers
function h$addrToAny(addr_v, addr_o) {
- TRACE_STABLEPTR("addrToAny");
- TRACE_STABLEPTR(addr_v === h$stablePtrBuf);
+ TRACE_STABLEPTR("addrToAny")
+ TRACE_STABLEPTR(addr_v === h$stablePtrBuf)
var slot = addr_o >> 2;
return h$stablePtrData[slot];
}
=====================================
rts/js/stm.js
=====================================
@@ -19,7 +19,7 @@ var h$stmTransactionActive = 0;
var h$stmTransactionWaiting = 4;
/** @constructor */
function h$Transaction(o, parent) {
- TRACE_STM("h$Transaction: " + o + " -> " + parent);
+ TRACE_STM("h$Transaction: " + o + " -> " + parent)
this.action = o;
// h$TVar -> h$WrittenTVar, transaction-local changed values
this.tvars = new h$Map();
@@ -42,7 +42,7 @@ function h$WrittenTVar(tv,v) {
var h$TVarN = 0;
/** @constructor */
function h$TVar(v) {
- TRACE_STM("creating TVar, value: " + h$collectProps(v));
+ TRACE_STM("creating TVar, value: " + h$collectProps(v))
this.val = v; // current value
this.blocked = new h$Set(); // threads that get woken up if this TVar is updated
this.m = 0; // gc mark
@@ -63,7 +63,7 @@ function h$TVarsWaiting(s) {
// local view of a TVar
/** @constructor */
function h$LocalTVar(v) {
- TRACE_STM("creating TVar view for: " + h$collectProps(v));
+ TRACE_STM("creating TVar view for: " + h$collectProps(v))
this.readVal = v.val; // the value when read from environment
this.val = v.val; // the current uncommitted value
this.tvar = v;
@@ -75,7 +75,7 @@ function h$atomically(o) {
}
function h$stmStartTransaction(o) {
- TRACE_STM("starting transaction: " + h$collectProps(o));
+ TRACE_STM("starting transaction: " + h$collectProps(o))
var t = new h$Transaction(o, null);
h$currentThread.transaction = t;
h$r1 = o;
@@ -89,7 +89,7 @@ function h$stmCommitTransaction() {
var tvs = t.tvars;
var wtv, i = tvs.iter();
if(t.parent === null) { // top-level commit
- TRACE_STM("committing top-level transaction");
+ TRACE_STM("committing top-level transaction")
// write new value to TVars and collect blocked threads
var thread, threadi, blockedThreads = new h$Set();
while((wtv = i.nextVal()) !== null) {
@@ -102,7 +102,7 @@ function h$stmCommitTransaction() {
h$wakeupThread(thread);
}
} else { // commit subtransaction
- TRACE_STM("committing subtransaction");
+ TRACE_STM("committing subtransaction")
var tpvs = t.parent.tvars;
while((wtv = i.nextVal()) !== null) tpvs.put(wtv.tvar, wtv);
}
@@ -161,7 +161,7 @@ function h$stmSuspendRetry() {
var tv, i = h$currentThread.transaction.accessed.iter();
var tvs = new h$Set();
while((tv = i.next()) !== null) {
- TRACE_STM("h$stmSuspendRetry, accessed: " + h$collectProps(tv));
+ TRACE_STM("h$stmSuspendRetry, accessed: " + h$collectProps(tv))
tv.blocked.add(h$currentThread);
tvs.add(tv);
}
@@ -212,17 +212,17 @@ function h$readLocalTVar(t, tv) {
while(t0 !== null) {
var v = t0.tvars.get(tv);
if(v !== null) {
- TRACE_STM("h$readLocalTVar: found locally modified value: " + h$collectProps(v));
+ TRACE_STM("h$readLocalTVar: found locally modified value: " + h$collectProps(v))
return v.val;
}
t0 = t0.parent;
}
var lv = t.accessed.get(tv);
if(lv !== null) {
- TRACE_STM("h$readLocalTVar: found TVar value: " + h$collectProps(lv));
+ TRACE_STM("h$readLocalTVar: found TVar value: " + h$collectProps(lv))
return lv.val;
} else {
- TRACE_STM("h$readLocalTVar: TVar value not found, adding: " + h$collectProps(tv));
+ TRACE_STM("h$readLocalTVar: TVar value not found, adding: " + h$collectProps(tv))
t.accessed.put(tv, new h$LocalTVar(tv));
return tv.val;
}
@@ -238,7 +238,7 @@ function h$setLocalTVar(t, tv, v) {
}
function h$stmCommitTVar(tv, v, threads) {
- TRACE_STM("committing tvar: " + tv._key + " " + (v === tv.val));
+ TRACE_STM("committing tvar: " + tv._key + " " + (v === tv.val))
if(v !== tv.val) {
var thr, iter = tv.blocked.iter();
while((thr = iter.next()) !== null) threads.add(thr);
=====================================
rts/js/thread.js
=====================================
@@ -135,14 +135,14 @@ function h$fork(a, inherit) {
function h$forkThread(a, inherit) {
var t = new h$Thread();
- TRACE_SCHEDULER("sched: forking: " + h$threadString(t));
+ TRACE_SCHEDULER("sched: forking: " + h$threadString(t))
if(inherit && h$currentThread) {
t.mask = h$currentThread.mask;
}
#ifdef GHCJS_PROF
t.ccs = h$CCS_MAIN;
#endif
- // TRACE_SCHEDULER("sched: action forked: " + a.f.n);
+ // TRACE_SCHEDULER("sched: action forked: " + a.f.n)
t.stack[4] = h$ap_1_0;
t.stack[5] = a;
t.stack[6] = h$return;
@@ -173,7 +173,7 @@ var h$delayed = new h$HeapSet();
function h$wakeupDelayed(now) {
while(h$delayed.size() > 0 && h$delayed.peekPrio() < now) {
var t = h$delayed.pop();
- TRACE_SCHEDULER("delay timeout expired: " + t.tid);
+ TRACE_SCHEDULER("delay timeout expired: " + t.tid)
// might have been woken up early, don't wake up again in that case
if(t.delayed) {
t.delayed = false;
@@ -193,7 +193,7 @@ function h$sleep(secs) {
function h$delayThreadMs(ms) {
var now = Date.now();
- TRACE_SCHEDULER("delaying " + h$threadString(h$currentThread) + " " + ms + "ms (" + (now+ms) + ")");
+ TRACE_SCHEDULER("delaying " + h$threadString(h$currentThread) + " " + ms + "ms (" + (now+ms) + ")")
h$delayed.add(now+ms, h$currentThread);
h$currentThread.delayed = true;
h$currentThread.interruptible = true;
@@ -219,7 +219,7 @@ function h$yield() {
// raise the async exception in the thread if not masked
function h$killThread(t, ex) {
- TRACE_SCHEDULER("killThread: " + h$threadString(t));
+ TRACE_SCHEDULER("killThread: " + h$threadString(t))
if(t === h$currentThread) {
// if target is self, then throw even if masked
h$sp += 2;
@@ -227,7 +227,7 @@ function h$killThread(t, ex) {
h$stack[h$sp] = h$return;
return h$throw(ex,true);
} else {
- TRACE_SCHEDULER("killThread mask: " + t.mask);
+ TRACE_SCHEDULER("killThread mask: " + t.mask)
if(t.mask === 0 || (t.mask === 2 && t.interruptible)) {
if(t.stack) { // finished threads don't have a stack anymore
h$forceWakeupThread(t);
@@ -252,12 +252,12 @@ function h$killThread(t, ex) {
}
function h$maskStatus() {
- TRACE_SCHEDULER("mask status: " + h$currentThread.mask);
+ TRACE_SCHEDULER("mask status: " + h$currentThread.mask)
return h$currentThread.mask;
}
function h$maskAsync(a) {
- TRACE_SCHEDULER("mask: thread " + h$threadString(h$currentThread));
+ TRACE_SCHEDULER("mask: thread " + h$threadString(h$currentThread))
if(h$currentThread.mask !== 2) {
if(h$currentThread.mask === 0 && h$stack[h$sp] !== h$maskFrame && h$stack[h$sp] !== h$maskUnintFrame) {
h$stack[++h$sp] = h$unmaskFrame;
@@ -272,7 +272,7 @@ function h$maskAsync(a) {
}
function h$maskUnintAsync(a) {
- TRACE_SCHEDULER("mask unint: thread " + h$threadString(h$currentThread));
+ TRACE_SCHEDULER("mask unint: thread " + h$threadString(h$currentThread))
if(h$currentThread.mask !== 1) {
if(h$currentThread.mask === 2) {
h$stack[++h$sp] = h$maskFrame;
@@ -286,7 +286,7 @@ function h$maskUnintAsync(a) {
}
function h$unmaskAsync(a) {
- TRACE_SCHEDULER("unmask: " + h$threadString(h$currentThread));
+ TRACE_SCHEDULER("unmask: " + h$threadString(h$currentThread))
if(h$currentThread.excep.length > 0) {
h$currentThread.mask = 0;
h$sp += 3;
@@ -320,7 +320,7 @@ function h$pendingAsync() {
function h$postAsync(alreadySuspended,next) {
var t = h$currentThread;
var v = t.excep.shift();
- TRACE_SCHEDULER("posting async to " + h$threadString(t) + " mask status: " + t.mask + " remaining exceptions: " + t.excep.length);
+ TRACE_SCHEDULER("posting async to " + h$threadString(t) + " mask status: " + t.mask + " remaining exceptions: " + t.excep.length)
var tposter = v[0]; // posting thread, blocked
var ex = v[1]; // the exception
if(v !== null && tposter !== null) {
@@ -338,7 +338,7 @@ function h$postAsync(alreadySuspended,next) {
// wakeup thread, thread has already been removed
// from any queues it was blocked on
function h$wakeupThread(t) {
- TRACE_SCHEDULER("sched: waking up: " + h$threadString(t));
+ TRACE_SCHEDULER("sched: waking up: " + h$threadString(t))
if(t.status === THREAD_BLOCKED) {
t.blockedOn = null;
t.status = THREAD_RUNNING;
@@ -353,7 +353,7 @@ function h$wakeupThread(t) {
// force wakeup, remove this thread from any
// queue it's blocked on
function h$forceWakeupThread(t) {
- TRACE_SCHEDULER("forcing wakeup of: " + h$threadString(t));
+ TRACE_SCHEDULER("forcing wakeup of: " + h$threadString(t))
if(t.status === THREAD_BLOCKED) {
h$removeThreadBlock(t);
h$wakeupThread(t);
@@ -371,8 +371,8 @@ function h$removeThreadBlock(t) {
h$delayed.remove(t);
t.delayed = false;
} else if(o instanceof h$MVar) {
- TRACE_SCHEDULER("blocked on MVar");
- TRACE_SCHEDULER("MVar before: " + o.readers.length() + " " + o.writers.length() + " " + o.waiters.length);
+ TRACE_SCHEDULER("blocked on MVar")
+ TRACE_SCHEDULER("MVar before: " + o.readers.length() + " " + o.writers.length() + " " + o.waiters.length)
// fixme this is rather inefficient
var r, rq = new h$Queue();
while((r = o.readers.dequeue()) !== null) {
@@ -392,13 +392,13 @@ function h$removeThreadBlock(t) {
}
o.waiters = wa;
}
- TRACE_SCHEDULER("MVar after: " + o.readers.length() + " " + o.writers.length() + " " + o.waiters.length);
+ TRACE_SCHEDULER("MVar after: " + o.readers.length() + " " + o.writers.length() + " " + o.waiters.length)
/* } else if(o instanceof h$Fd) {
- TRACE_SCHEDULER("blocked on fd");
+ TRACE_SCHEDULER("blocked on fd")
h$removeFromArray(o.waitRead,t);
h$removeFromArray(o.waitWrite,t); */
} else if(o instanceof h$Thread) {
- TRACE_SCHEDULER("blocked on async exception");
+ TRACE_SCHEDULER("blocked on async exception")
// set thread (first in pair) to null, exception will still be delivered
// but this thread not woken up again
// fixme: are these the correct semantics?
@@ -411,7 +411,7 @@ function h$removeThreadBlock(t) {
} else if (o instanceof h$TVarsWaiting) {
h$stmRemoveBlockedThread(o, t)
} else if(IS_BLACKHOLE(o)) {
- TRACE_SCHEDULER("blocked on blackhole");
+ TRACE_SCHEDULER("blocked on blackhole")
h$removeFromArray(BLACKHOLE_QUEUE(o),t);
} else {
throw ("h$removeThreadBlock: blocked on unknown object: " + h$collectProps(o));
@@ -432,7 +432,7 @@ function h$removeFromArray(a,o) {
}
function h$finishThread(t) {
- TRACE_SCHEDULER("sched: finishing: " + h$threadString(t));
+ TRACE_SCHEDULER("sched: finishing: " + h$threadString(t))
t.status = THREAD_FINISHED;
h$blocked.remove(t);
t.stack = null;
@@ -448,7 +448,7 @@ function h$finishThread(t) {
}
function h$blockThread(t,o,resume) {
- TRACE_SCHEDULER("sched: blocking: " + h$threadString(t));
+ TRACE_SCHEDULER("sched: blocking: " + h$threadString(t))
if(t !== h$currentThread) {
throw "h$blockThread: blocked thread is not the current thread";
}
@@ -469,7 +469,7 @@ function h$blockThread(t,o,resume) {
var h$lastGc = Date.now();
var h$gcInterval = GHCJS_GC_INTERVAL; // ms
function h$scheduler(next) {
- TRACE_SCHEDULER("sched: scheduler: " + h$sp);
+ TRACE_SCHEDULER("sched: scheduler: " + h$sp)
// if we have a running synchronous thread, the only thing we can do is continue
if(h$currentThread &&
h$currentThread.isSynchronous &&
@@ -481,7 +481,7 @@ function h$scheduler(next) {
// find the next runnable thread in the run queue
// remove non-runnable threads
if(h$currentThread && h$pendingAsync()) {
- TRACE_SCHEDULER("sched: received async exception, continuing thread");
+ TRACE_SCHEDULER("sched: received async exception, continuing thread")
if(h$currentThread.status !== THREAD_RUNNING) {
h$forceWakeupThread(h$currentThread);
h$currentThread.status = THREAD_RUNNING;
@@ -495,7 +495,7 @@ function h$scheduler(next) {
}
// if no other runnable threads, just continue current (if runnable)
if(t === null) {
- TRACE_SCHEDULER("sched: no other runnable threads");
+ TRACE_SCHEDULER("sched: no other runnable threads")
if(h$currentThread && h$currentThread.status === THREAD_RUNNING) {
// do gc after a while
if(now - h$lastGc > h$gcInterval) {
@@ -518,10 +518,10 @@ function h$scheduler(next) {
h$stack = h$currentThread.stack;
h$sp = h$currentThread.sp
}
- TRACE_SCHEDULER("sched: continuing: " + h$threadString(h$currentThread));
+ TRACE_SCHEDULER("sched: continuing: " + h$threadString(h$currentThread))
return (next===h$reschedule || next === null)?h$stack[h$sp]:next; // just continue
} else {
- TRACE_SCHEDULER("sched: pausing");
+ TRACE_SCHEDULER("sched: pausing")
h$currentThread = null;
#ifdef GHCJS_PROF
h$reportCurrentCcs();
@@ -534,23 +534,23 @@ function h$scheduler(next) {
return null; // pause the haskell runner
}
} else { // runnable thread in t, switch to it
- TRACE_SCHEDULER("sched: switching to: " + h$threadString(t));
+ TRACE_SCHEDULER("sched: switching to: " + h$threadString(t))
if(h$currentThread !== null) {
if(h$currentThread.status === THREAD_RUNNING) {
h$threads.enqueue(h$currentThread);
}
// if h$reschedule called, thread takes care of suspend
if(next !== h$reschedule && next !== null) {
- TRACE_SCHEDULER("sched: suspending: " + h$threadString(h$currentThread));
+ TRACE_SCHEDULER("sched: suspending: " + h$threadString(h$currentThread))
// suspend thread: push h$restoreThread stack frame
h$suspendCurrentThread(next);
} else {
- TRACE_SCHEDULER("sched: no suspend needed, reschedule called from: " + h$threadString(h$currentThread));
+ TRACE_SCHEDULER("sched: no suspend needed, reschedule called from: " + h$threadString(h$currentThread))
h$currentThread.sp = h$sp;
}
if(h$pendingAsync()) h$postAsync(true, next);
} else {
- TRACE_SCHEDULER("sched: no suspend needed, no running thread");
+ TRACE_SCHEDULER("sched: no suspend needed, no running thread")
}
// gc if needed
if(now - h$lastGc > h$gcInterval) {
@@ -567,22 +567,22 @@ function h$scheduler(next) {
#ifdef GHCJS_PROF
h$reportCurrentCcs();
#endif
- TRACE_SCHEDULER("sched: scheduling " + h$threadString(t) + " sp: " + h$sp);
- // TRACE_SCHEDULER("sp thing: " + h$stack[h$sp].n);
+ TRACE_SCHEDULER("sched: scheduling " + h$threadString(t) + " sp: " + h$sp)
+ // TRACE_SCHEDULER("sp thing: " + h$stack[h$sp].n)
// h$dumpStackTop(h$stack,0,h$sp);
return h$stack[h$sp];
}
}
function h$scheduleMainLoop() {
- TRACE_SCHEDULER("scheduling next main loop wakeup");
+ TRACE_SCHEDULER("scheduling next main loop wakeup")
if(h$mainLoopImmediate) return;
h$clearScheduleMainLoop();
if(h$delayed.size() === 0) {
#ifndef GHCJS_BROWSER
if(typeof setTimeout !== 'undefined') {
#endif
- TRACE_SCHEDULER("scheduling main loop wakeup in " + h$gcInterval + "ms");
+ TRACE_SCHEDULER("scheduling main loop wakeup in " + h$gcInterval + "ms")
h$mainLoopTimeout = setTimeout(h$mainLoop, h$gcInterval);
#ifndef GHCJS_BROWSER
}
@@ -595,7 +595,7 @@ function h$scheduleMainLoop() {
if(typeof setTimeout !== 'undefined') {
#endif
if(delay >= 1) {
- TRACE_SCHEDULER("scheduling main loop wakeup in " + delay + "ms");
+ TRACE_SCHEDULER("scheduling main loop wakeup in " + delay + "ms")
// node.js 0.10.30 has trouble with non-integral delays
h$mainLoopTimeout = setTimeout(h$mainLoop, Math.round(delay));
} else {
@@ -627,7 +627,7 @@ function h$clearScheduleMainLoop() {
}
function h$startMainLoop() {
- TRACE_SCHEDULER("start main loop: " + h$running);
+ TRACE_SCHEDULER("start main loop: " + h$running)
if(h$running) return;
#ifndef GHCJS_BROWSER
if(typeof setTimeout !== 'undefined') {
@@ -706,7 +706,7 @@ function h$actualMainLoop() {
}
// yield to js after h$busyYield (default value GHCJS_BUSY_YIELD)
if(!h$currentThread.isSynchronous && Date.now() - start > h$busyYield) {
- TRACE_SCHEDULER("yielding to js");
+ TRACE_SCHEDULER("yielding to js")
if(c !== h$reschedule) h$suspendCurrentThread(c);
h$nextThread = h$currentThread;
h$currentThread = null;
@@ -821,7 +821,7 @@ function h$reportMainLoopException(e, isMainThread) {
function h$handleBlockedSyncThread(c) {
- TRACE_SCHEDULER("handling blocked sync thread");
+ TRACE_SCHEDULER("handling blocked sync thread")
/*
if we have a blocked synchronous/non-preemptible thread,
and it's blocked on a black hole, first try to clear
@@ -831,7 +831,7 @@ function h$handleBlockedSyncThread(c) {
if(h$currentThread.status === THREAD_BLOCKED &&
IS_BLACKHOLE(bo) &&
h$runBlackholeThreadSync(bo)) {
- TRACE_SCHEDULER("blackhole succesfully removed");
+ TRACE_SCHEDULER("blackhole succesfully removed")
c = h$stack[h$sp];
}
/*
@@ -843,7 +843,7 @@ function h$handleBlockedSyncThread(c) {
h$currentThread.isSynchronous = false;
h$currentThread.continueAsync = false;
} else if(h$currentThread.isSynchronous) {
- TRACE_SCHEDULER("blocking synchronous thread: exception");
+ TRACE_SCHEDULER("blocking synchronous thread: exception")
h$sp += 2;
h$currentThread.sp = h$sp;
h$stack[h$sp-1] = h$baseZCGHCziJSziPrimziInternalziwouldBlock;
@@ -858,7 +858,7 @@ function h$handleBlockedSyncThread(c) {
// run the supplied IO action in a new thread
// returns immediately, thread is started in background
function h$run(a) {
- TRACE_SCHEDULER("sched: starting thread");
+ TRACE_SCHEDULER("sched: starting thread")
var t = h$forkThread(a, false);
h$startMainLoop();
return t;
@@ -917,7 +917,7 @@ function h$setCurrentThreadResultValue(v) {
*/
function h$runSyncReturn(a, cont) {
var t = new h$Thread();
- TRACE_SCHEDULER("h$runSyncReturn created thread: " + h$threadString(t));
+ TRACE_SCHEDULER("h$runSyncReturn created thread: " + h$threadString(t))
var aa = MK_AP1(h$baseZCGHCziJSziPrimziInternalzisetCurrentThreadResultValue, a);
h$runSyncAction(t, aa, cont);
if(t.status === THREAD_FINISHED) {
@@ -946,7 +946,7 @@ function h$runSyncReturn(a, cont) {
*/
function h$runSync(a, cont) {
var t = new h$Thread();
- TRACE_SCHEDULER("h$runSync created thread: " + h$threadString(t));
+ TRACE_SCHEDULER("h$runSync created thread: " + h$threadString(t))
h$runSyncAction(t, a, cont);
if(t.resultIsException) {
if(t.result instanceof h$WouldBlock) {
@@ -1017,7 +1017,7 @@ function h$runSyncAction(t, a, cont) {
// run other threads synchronously until the blackhole is 'freed'
// returns true for success, false for failure, a thread blocks
function h$runBlackholeThreadSync(bh) {
- TRACE_SCHEDULER("trying to remove black hole");
+ TRACE_SCHEDULER("trying to remove black hole")
var ct = h$currentThread;
var sp = h$sp;
var success = false;
@@ -1026,7 +1026,7 @@ function h$runBlackholeThreadSync(bh) {
// we don't handle async exceptions here,
// don't run threads with pending exceptions
if(BLACKHOLE_TID(bh).excep.length > 0) {
- TRACE_SCHEDULER("aborting due to queued async exceptions");
+ TRACE_SCHEDULER("aborting due to queued async exceptions")
return false;
}
h$currentThread = BLACKHOLE_TID(bh);
@@ -1036,7 +1036,7 @@ function h$runBlackholeThreadSync(bh) {
h$reportCurrentCcs();
#endif
var c = (h$currentThread.status === THREAD_RUNNING)?h$stack[h$sp]:h$reschedule;
- TRACE_SCHEDULER("switched thread status running: " + (h$currentThread.status === THREAD_RUNNING));
+ TRACE_SCHEDULER("switched thread status running: " + (h$currentThread.status === THREAD_RUNNING))
try {
while(true) {
while(c !== h$reschedule && IS_BLACKHOLE(currentBh)) {
@@ -1050,7 +1050,7 @@ function h$runBlackholeThreadSync(bh) {
// perhaps new blackhole, then continue with that thread,
// otherwise fail
if(IS_BLACKHOLE(h$currentThread.blockedOn)) {
- TRACE_SCHEDULER("following another black hole");
+ TRACE_SCHEDULER("following another black hole")
bhs.push(currentBh);
currentBh = h$currentThread.blockedOn;
h$currentThread = BLACKHOLE_TID(h$currentThread.blockedOn);
@@ -1064,15 +1064,15 @@ function h$runBlackholeThreadSync(bh) {
#endif
c = (h$currentThread.status === THREAD_RUNNING)?h$stack[h$sp]:h$reschedule;
} else {
- TRACE_SCHEDULER("thread blocked on something that's not a black hole, failing");
+ TRACE_SCHEDULER("thread blocked on something that's not a black hole, failing")
break;
}
} else { // blackhole updated: suspend thread and pick up the old one
- TRACE_SCHEDULER("blackhole updated, switching back (" + h$sp + ")");
- TRACE_SCHEDULER("next: " + c.toString());
+ TRACE_SCHEDULER("blackhole updated, switching back (" + h$sp + ")")
+ TRACE_SCHEDULER("next: " + c.toString())
h$suspendCurrentThread(c);
if(bhs.length > 0) {
- TRACE_SCHEDULER("to next black hole");
+ TRACE_SCHEDULER("to next black hole")
currentBh = bhs.pop();
h$currentThread = BLACKHOLE_TID(currentBh);
h$stack = h$currentThread.stack;
@@ -1081,7 +1081,7 @@ function h$runBlackholeThreadSync(bh) {
h$reportCurrentCcs();
#endif
} else {
- TRACE_SCHEDULER("last blackhole removed, success!");
+ TRACE_SCHEDULER("last blackhole removed, success!")
success = true;
break;
}
@@ -1111,7 +1111,7 @@ function h$main(a) {
#ifdef GHCJS_PROF
t.ccs = a.cc;
#endif
- //TRACE_SCHEDULER("sched: starting main thread");
+ //TRACE_SCHEDULER("sched: starting main thread")
t.stack[0] = h$doneMain_e;
#ifndef GHCJS_BROWSER
if(!h$isBrowser() && !h$isGHCJSi()) {
@@ -1186,7 +1186,7 @@ function h$exitProcess(code) {
var h$mvarId = 0;
/** @constructor */
function h$MVar() {
- TRACE_SCHEDULER("h$MVar constructor");
+ TRACE_SCHEDULER("h$MVar constructor")
this.val = null;
this.readers = new h$Queue();
this.writers = new h$Queue();
@@ -1204,17 +1204,17 @@ function h$notifyMVarEmpty(mv) {
if(w !== null) {
var thread = w[0];
var val = w[1];
- TRACE_SCHEDULER("notifyMVarEmpty(" + mv.id + "): writer ready: " + h$threadString(thread));
+ TRACE_SCHEDULER("notifyMVarEmpty(" + mv.id + "): writer ready: " + h$threadString(thread))
mv.val = val;
// thread is null if some JavaScript outside Haskell wrote to the MVar
if(thread !== null) {
h$wakeupThread(thread);
}
} else {
- TRACE_SCHEDULER("notifyMVarEmpty(" + mv.id + "): no writers");
+ TRACE_SCHEDULER("notifyMVarEmpty(" + mv.id + "): no writers")
mv.val = null;
}
- TRACE_SCHEDULER("notifyMVarEmpty(" + mv.id + "): " + mv.val);
+ TRACE_SCHEDULER("notifyMVarEmpty(" + mv.id + "): " + mv.val)
}
// set the MVar to val unless there are readers
@@ -1222,7 +1222,7 @@ function h$notifyMVarFull(mv,val) {
if(mv.waiters && mv.waiters.length > 0) {
for(var i=0;i<mv.waiters.length;i++) {
var w = mv.waiters[i];
- TRACE_SCHEDULER("notifyMVarFull: notifying waiter: " + h$threadString(w));
+ TRACE_SCHEDULER("notifyMVarFull: notifying waiter: " + h$threadString(w))
w.sp += 2;
w.stack[w.sp-1] = val;
w.stack[w.sp] = h$return;
@@ -1232,21 +1232,21 @@ function h$notifyMVarFull(mv,val) {
}
var r = mv.readers.dequeue();
if(r !== null) {
- TRACE_SCHEDULER("notifyMVarFull(" + mv.id + "): reader ready: " + h$threadString(r));
+ TRACE_SCHEDULER("notifyMVarFull(" + mv.id + "): reader ready: " + h$threadString(r))
r.sp += 2;
r.stack[r.sp-1] = val;
r.stack[r.sp] = h$return;
h$wakeupThread(r);
mv.val = null;
} else {
- TRACE_SCHEDULER("notifyMVarFull(" + mv.id + "): no readers");
+ TRACE_SCHEDULER("notifyMVarFull(" + mv.id + "): no readers")
mv.val = val;
}
- TRACE_SCHEDULER("notifyMVarFull(" + mv.id + "): " + mv.val);
+ TRACE_SCHEDULER("notifyMVarFull(" + mv.id + "): " + mv.val)
}
function h$takeMVar(mv) {
- TRACE_SCHEDULER("h$takeMVar(" + mv.id + "): " + mv.val + " " + h$threadString(h$currentThread));
+ TRACE_SCHEDULER("h$takeMVar(" + mv.id + "): " + mv.val + " " + h$threadString(h$currentThread))
if(mv.val !== null) {
h$r1 = mv.val;
h$notifyMVarEmpty(mv);
@@ -1259,7 +1259,7 @@ function h$takeMVar(mv) {
}
function h$tryTakeMVar(mv) {
- TRACE_SCHEDULER("h$tryTakeMVar(" + mv.id + "): " + mv.val);
+ TRACE_SCHEDULER("h$tryTakeMVar(" + mv.id + "): " + mv.val)
if(mv.val === null) {
RETURN_UBX_TUP2(0, null);
} else {
@@ -1270,7 +1270,7 @@ function h$tryTakeMVar(mv) {
}
function h$readMVar(mv) {
- TRACE_SCHEDULER("h$readMVar(" + mv.id + "): " + mv.val);
+ TRACE_SCHEDULER("h$readMVar(" + mv.id + "): " + mv.val)
if(mv.val === null) {
if(mv.waiters) {
mv.waiters.push(h$currentThread);
@@ -1286,7 +1286,7 @@ function h$readMVar(mv) {
}
function h$putMVar(mv,val) {
- TRACE_SCHEDULER("h$putMVar(" + mv.id + "): " + mv.val);
+ TRACE_SCHEDULER("h$putMVar(" + mv.id + "): " + mv.val)
if(mv.val !== null) {
mv.writers.enqueue([h$currentThread,val]);
h$currentThread.interruptible = true;
@@ -1298,7 +1298,7 @@ function h$putMVar(mv,val) {
}
function h$tryPutMVar(mv,val) {
- TRACE_SCHEDULER("h$tryPutMVar(" + mv.id + "): " + mv.val);
+ TRACE_SCHEDULER("h$tryPutMVar(" + mv.id + "): " + mv.val)
if(mv.val !== null) {
return 0;
} else {
@@ -1311,10 +1311,10 @@ function h$tryPutMVar(mv,val) {
function h$writeMVarJs1(mv,val) {
var v = MK_DATA1_1(val);
if(mv.val !== null) {
- TRACE_SCHEDULER("h$writeMVarJs1: was full");
+ TRACE_SCHEDULER("h$writeMVarJs1: was full")
mv.writers.enqueue([null,v]);
} else {
- TRACE_SCHEDULER("h$writeMVarJs1: was empty");
+ TRACE_SCHEDULER("h$writeMVarJs1: was empty")
h$notifyMVarFull(mv,v);
}
}
@@ -1322,10 +1322,10 @@ function h$writeMVarJs1(mv,val) {
function h$writeMVarJs2(mv,val1,val2) {
var v = MK_DATA1_2(val1, val2);
if(mv.val !== null) {
- TRACE_SCHEDULER("h$writeMVarJs2: was full");
+ TRACE_SCHEDULER("h$writeMVarJs2: was full")
mv.writers.enqueue([null,v]);
} else {
- TRACE_SCHEDULER("h$writeMVarJs2: was empty");
+ TRACE_SCHEDULER("h$writeMVarJs2: was empty")
h$notifyMVarFull(mv,v);
}
}
@@ -1357,12 +1357,12 @@ function h$atomicModifyMutVar2(mv, fun) {
// Black holes and updates
// caller must save registers on stack
function h$blockOnBlackhole(c) {
- TRACE_SCHEDULER("blackhole, blocking: " + h$collectProps(c));
+ TRACE_SCHEDULER("blackhole, blocking: " + h$collectProps(c))
if(BLACKHOLE_TID(c) === h$currentThread) {
- TRACE_SCHEDULER("NonTermination");
+ TRACE_SCHEDULER("NonTermination")
return h$throw(h$baseZCControlziExceptionziBasezinonTermination, true);
}
- TRACE_SCHEDULER("blackhole, blocking thread: " + h$threadString(h$currentThread));
+ TRACE_SCHEDULER("blackhole, blocking thread: " + h$threadString(h$currentThread))
if(BLACKHOLE_QUEUE(c) === null) {
SET_BLACKHOLE_QUEUE(c,[h$currentThread]);
} else {
@@ -1384,7 +1384,7 @@ function h$makeResumable(bh,start,end,extra) {
if(extra) {
s = s.concat(extra);
}
-// TRACE_SCHEDULER("making resumable " + (h$debugResumableId+1) + ", stack: ");
+// TRACE_SCHEDULER("making resumable " + (h$debugResumableId+1) + ", stack: ")
// h$dumpStackTop(s,0,s.length-1);
MAKE_RESUMABLE(bh, s);
}
@@ -1415,7 +1415,7 @@ function h$mkForeignCallback(x) {
// event listeners through MVar
function h$makeMVarListener(mv, stopProp, stopImmProp, preventDefault) {
var f = function(event) {
- TRACE_SCHEDULER("MVar listener callback");
+ TRACE_SCHEDULER("MVar listener callback")
h$writeMVarJs1(mv,event);
if(stopProp) { event.stopPropagation(); }
if(stopImmProp) { event.stopImmediatePropagation(); }
=====================================
rts/js/weak.js
=====================================
@@ -16,7 +16,7 @@ function h$finalizeWeaks(toFinalize) {
var mark = h$gcMark;
var i, w;
- TRACE_WEAK("to finalize: " + toFinalize.length);
+ TRACE_WEAK("to finalize: " + toFinalize.length)
// start a finalizer thread if any finalizers need to be run
if(toFinalize.length > 0) {
var t = new h$Thread();
@@ -41,7 +41,7 @@ function h$Weak(key, val, finalizer) {
if(typeof key !== 'object') {
// can't attach a StableName to objects with unboxed storage
// our weak ref will be finalized soon.
- TRACE_WEAK("WARNING: making weak for object with unboxed storage");
+ TRACE_WEAK("WARNING: making weak for object with unboxed storage")
this.keym = new h$StableName(0);
} else {
if(typeof key.m !== 'object') {
@@ -52,7 +52,7 @@ function h$Weak(key, val, finalizer) {
}
this.keym = key.m;
}
- TRACE_WEAK("making weak of: " + h$stableNameInt(this.keym));
+ TRACE_WEAK("making weak of: " + h$stableNameInt(this.keym))
this.keym = key.m;
this.val = val;
this.finalizer = null;
@@ -68,17 +68,17 @@ function h$Weak(key, val, finalizer) {
}
function h$makeWeak(key, val, fin) {
- TRACE_WEAK("h$makeWeak");
+ TRACE_WEAK("h$makeWeak")
return new h$Weak(key, val, fin)
}
function h$makeWeakNoFinalizer(key, val) {
- TRACE_WEAK("h$makeWeakNoFinalizer");
+ TRACE_WEAK("h$makeWeakNoFinalizer")
return new h$Weak(key, val, null);
}
function h$finalizeWeak(w) {
- TRACE_WEAK("finalizing weak of " + h$stableNameInt(w.keym));
+ TRACE_WEAK("finalizing weak of " + h$stableNameInt(w.keym))
w.val = null;
if(w.finalizer === null || w.finalizer.finalizer === null) {
RETURN_UBX_TUP2(null, 0);
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/af7f81f8e25074070caf6cb82925f198b4eff315
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/af7f81f8e25074070caf6cb82925f198b4eff315
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221014/60da23d1/attachment-0001.html>
More information about the ghc-commits
mailing list