contining to do things to shrink code space
This commit is contained in:
parent
9f978f5592
commit
6bc6a0aad9
|
@ -159,7 +159,7 @@
|
||||||
var modrec = M.modules[~s];
|
var modrec = M.modules[~s];
|
||||||
var exports = {};
|
var exports = {};
|
||||||
modrec.isInvoked = true;
|
modrec.isInvoked = true;
|
||||||
(function(MACHINE, RUNTIME, EXPORTS){~a})(M, plt.runtime, exports);
|
(function(MACHINE, EXPORTS){~a})(M, exports);
|
||||||
~a
|
~a
|
||||||
modrec.privateExports = exports;
|
modrec.privateExports = exports;
|
||||||
return M.control.pop().label(M);"
|
return M.control.pop().label(M);"
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -212,11 +212,11 @@
|
||||||
|
|
||||||
var Machine = function() {
|
var Machine = function() {
|
||||||
this.callsBeforeTrampoline = STACK_LIMIT_ESTIMATE;
|
this.callsBeforeTrampoline = STACK_LIMIT_ESTIMATE;
|
||||||
this.val = undefined;
|
this.val = undefined; // value register
|
||||||
this.proc = undefined;
|
this.proc = undefined; // procedure register
|
||||||
this.argcount = undefined;
|
this.argcount = undefined; // argument count
|
||||||
this.env = [];
|
this.env = []; // environment
|
||||||
this.control = []; // Arrayof (U Frame CallFrame PromptFrame)
|
this.control = []; // control: Arrayof (U Frame CallFrame PromptFrame)
|
||||||
this.running = false;
|
this.running = false;
|
||||||
this.modules = {}; // String -> ModuleRecord
|
this.modules = {}; // String -> ModuleRecord
|
||||||
this.mainModules = []; // Arrayof String
|
this.mainModules = []; // Arrayof String
|
||||||
|
@ -444,17 +444,16 @@
|
||||||
|
|
||||||
|
|
||||||
Machine.prototype.trampoline = function(initialJump) {
|
Machine.prototype.trampoline = function(initialJump) {
|
||||||
var MACHINE = this;
|
|
||||||
var thunk = initialJump;
|
var thunk = initialJump;
|
||||||
var startTime = (new Date()).valueOf();
|
var startTime = (new Date()).valueOf();
|
||||||
MACHINE.callsBeforeTrampoline = STACK_LIMIT_ESTIMATE;
|
this.callsBeforeTrampoline = STACK_LIMIT_ESTIMATE;
|
||||||
MACHINE.params.numBouncesBeforeYield =
|
this.params.numBouncesBeforeYield =
|
||||||
MACHINE.params.maxNumBouncesBeforeYield;
|
this.params.maxNumBouncesBeforeYield;
|
||||||
MACHINE.running = true;
|
this.running = true;
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
try {
|
try {
|
||||||
thunk(MACHINE);
|
thunk(this);
|
||||||
break;
|
break;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// There are a few kinds of things that can get thrown
|
// There are a few kinds of things that can get thrown
|
||||||
|
@ -479,35 +478,36 @@
|
||||||
// The running flag is set to false.
|
// The running flag is set to false.
|
||||||
if (typeof(e) === 'function') {
|
if (typeof(e) === 'function') {
|
||||||
thunk = e;
|
thunk = e;
|
||||||
MACHINE.callsBeforeTrampoline = STACK_LIMIT_ESTIMATE;
|
this.callsBeforeTrampoline = STACK_LIMIT_ESTIMATE;
|
||||||
|
|
||||||
if (MACHINE.params.numBouncesBeforeYield-- < 0) {
|
if (this.params.numBouncesBeforeYield-- < 0) {
|
||||||
recomputeMaxNumBouncesBeforeYield(
|
recomputeMaxNumBouncesBeforeYield(
|
||||||
MACHINE,
|
this,
|
||||||
(new Date()).valueOf() - startTime);
|
(new Date()).valueOf() - startTime);
|
||||||
scheduleTrampoline(MACHINE, thunk);
|
scheduleTrampoline(this, thunk);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (e instanceof Pause) {
|
} else if (e instanceof Pause) {
|
||||||
var restart = makeRestartFunction(MACHINE);
|
var restart = makeRestartFunction(this);
|
||||||
e.onPause(restart);
|
e.onPause(restart);
|
||||||
return;
|
return;
|
||||||
} else if (e instanceof HaltError) {
|
} else if (e instanceof HaltError) {
|
||||||
MACHINE.running = false;
|
this.running = false;
|
||||||
e.onHalt(MACHINE);
|
e.onHalt(this);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// General error condition: just exit out
|
// General error condition: just exit out
|
||||||
// of the trampoline and call the current error handler.
|
// of the trampoline and call the current error handler.
|
||||||
MACHINE.running = false;
|
this.running = false;
|
||||||
MACHINE.params.currentErrorHandler(MACHINE, e);
|
this.params.currentErrorHandler(this, e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MACHINE.running = false;
|
this.running = false;
|
||||||
|
var that = this;
|
||||||
setTimeout(
|
setTimeout(
|
||||||
function() { MACHINE.params.currentSuccessHandler(MACHINE); },
|
function() { that.params.currentSuccessHandler(that); },
|
||||||
0);
|
0);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user