fixing issue 83: javascript-translated functions didn't release the exclusive lock upon call. Whoops.

This commit is contained in:
Danny Yoo 2012-02-18 23:03:57 -05:00
parent 00ce581fbd
commit 21631c6959

View File

@ -137,14 +137,20 @@
MACHINE.exclusiveLock.acquire(
"js-as-closure",
function(releaseLock) {
succ = succ || function () {};
fail = fail || function () {};
var wrappedSucc = function() {
releaseLock();
(succ || function () {}).apply(null, arguments);
};
var wrappedFail = function(err) {
releaseLock();
(fail || function () {})(err);
};
if (!(baselib.arity.isArityMatching(v.racketArity, args.length - 2))) {
var msg = baselib.format.format(
"arity mismatch: ~s expected ~s argument(s) but received ~s",
[v.displayName, v.racketArity, args.length - 2]);
releaseLock();
return fail(new baselib.exceptions.RacketError(
return wrappedFail(new baselib.exceptions.RacketError(
msg,
baselib.exceptions.makeExnFailContractArity(msg,
MACHINE.captureContinuationMarks())));
@ -163,7 +169,7 @@
MACHINE.v = oldVal;
MACHINE.a = oldArgcount;
MACHINE.p = oldProc;
succ(returnValue);
wrappedSucc(returnValue);
});
};
afterGoodInvoke.mvr = function (MACHINE) {
@ -177,7 +183,7 @@
MACHINE.v = oldVal;
MACHINE.a = oldArgcount;
MACHINE.p = oldProc;
succ.apply(null, returnValues);
wrappedSucc.apply(null, returnValues);
});
};
@ -194,7 +200,7 @@
MACHINE.v = oldVal;
MACHINE.a = oldArgcount;
MACHINE.p = oldProc;
fail(e);
wrappedFail(e);
};
MACHINE._trampoline(v.label, false, releaseLock);