traced that the external module invokation was introducting one more call-back into the success continuation of the trampoline. Ugh.
This commit is contained in:
parent
deb6c235ce
commit
0ff8fd1a61
|
@ -54,6 +54,7 @@
|
||||||
(define goto-target (GotoStatement-target next-stmt))
|
(define goto-target (GotoStatement-target next-stmt))
|
||||||
(cond
|
(cond
|
||||||
[(Label? goto-target)
|
[(Label? goto-target)
|
||||||
|
(log-debug (format "merging label ~a and ~a" last-stmt (Label-name goto-target)))
|
||||||
(ufind:union-set a-forest last-stmt (Label-name goto-target))
|
(ufind:union-set a-forest last-stmt (Label-name goto-target))
|
||||||
(loop (rest stmts) next-stmt)]
|
(loop (rest stmts) next-stmt)]
|
||||||
[else
|
[else
|
||||||
|
|
|
@ -179,19 +179,25 @@ EOF
|
||||||
};"
|
};"
|
||||||
(assemble-label (make-Label (BasicBlock-name a-basic-block)))
|
(assemble-label (make-Label (BasicBlock-name a-basic-block)))
|
||||||
(assemble-label (make-Label (BasicBlock-name a-basic-block)))
|
(assemble-label (make-Label (BasicBlock-name a-basic-block)))
|
||||||
(string-join (assemble-block-statements (BasicBlock-stmts a-basic-block)
|
(string-join (assemble-block-statements (BasicBlock-name a-basic-block)
|
||||||
|
(BasicBlock-stmts a-basic-block)
|
||||||
blockht
|
blockht
|
||||||
entry-points)
|
entry-points)
|
||||||
"\n")))
|
"\n")))
|
||||||
|
|
||||||
|
|
||||||
(: assemble-block-statements ((Listof UnlabeledStatement) Blockht (Setof Symbol) -> (Listof String)))
|
(: assemble-block-statements (Symbol (Listof UnlabeledStatement) Blockht (Setof Symbol) -> (Listof String)))
|
||||||
(define (assemble-block-statements stmts blockht entry-points)
|
(define (assemble-block-statements name stmts blockht entry-points)
|
||||||
|
|
||||||
(: default (UnlabeledStatement -> (Listof String)))
|
(: default (UnlabeledStatement -> (Listof String)))
|
||||||
(define (default stmt)
|
(define (default stmt)
|
||||||
|
(when (and (empty? (rest stmts))
|
||||||
|
(not (GotoStatement? stmt)))
|
||||||
|
(log-debug (format "Last statement of the block ~a is not a goto" name)))
|
||||||
|
|
||||||
(cons (assemble-statement stmt)
|
(cons (assemble-statement stmt)
|
||||||
(assemble-block-statements (rest stmts)
|
(assemble-block-statements name
|
||||||
|
(rest stmts)
|
||||||
blockht
|
blockht
|
||||||
entry-points)))
|
entry-points)))
|
||||||
|
|
||||||
|
@ -244,12 +250,14 @@ EOF
|
||||||
[(set-contains? entry-points (TestAndJumpStatement-label stmt))
|
[(set-contains? entry-points (TestAndJumpStatement-label stmt))
|
||||||
(list (assemble-jump (make-Label (TestAndJumpStatement-label stmt))))]
|
(list (assemble-jump (make-Label (TestAndJumpStatement-label stmt))))]
|
||||||
[else
|
[else
|
||||||
(assemble-block-statements (BasicBlock-stmts
|
(assemble-block-statements (BasicBlock-name
|
||||||
|
(hash-ref blockht (TestAndJumpStatement-label stmt)))
|
||||||
|
(BasicBlock-stmts
|
||||||
(hash-ref blockht (TestAndJumpStatement-label stmt)))
|
(hash-ref blockht (TestAndJumpStatement-label stmt)))
|
||||||
blockht
|
blockht
|
||||||
entry-points)])
|
entry-points)])
|
||||||
"} else {"
|
"} else {"
|
||||||
,@(assemble-block-statements (rest stmts) blockht entry-points)
|
,@(assemble-block-statements name (rest stmts) blockht entry-points)
|
||||||
"}")]
|
"}")]
|
||||||
|
|
||||||
[(GotoStatement? stmt)
|
[(GotoStatement? stmt)
|
||||||
|
@ -261,7 +269,9 @@ EOF
|
||||||
(default stmt)]
|
(default stmt)]
|
||||||
[else
|
[else
|
||||||
(log-debug (format "Assembling inlined jump into ~a" (Label-name target)) )
|
(log-debug (format "Assembling inlined jump into ~a" (Label-name target)) )
|
||||||
(assemble-block-statements (BasicBlock-stmts
|
(assemble-block-statements (BasicBlock-name
|
||||||
|
(hash-ref blockht (Label-name target)))
|
||||||
|
(BasicBlock-stmts
|
||||||
(hash-ref blockht (Label-name target)))
|
(hash-ref blockht (Label-name target)))
|
||||||
blockht
|
blockht
|
||||||
entry-points)])]
|
entry-points)])]
|
||||||
|
|
|
@ -53,7 +53,10 @@
|
||||||
var oldErrorHandler = MACHINE.params['currentErrorHandler'];
|
var oldErrorHandler = MACHINE.params['currentErrorHandler'];
|
||||||
var afterGoodInvoke = function (MACHINE) {
|
var afterGoodInvoke = function (MACHINE) {
|
||||||
MACHINE.params['currentErrorHandler'] = oldErrorHandler;
|
MACHINE.params['currentErrorHandler'] = oldErrorHandler;
|
||||||
succ();
|
if (isInternal) { succ(); }
|
||||||
|
else {
|
||||||
|
throw new plt.runtime.HaltError(succ)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.isInvoked) {
|
if (this.isInvoked) {
|
||||||
|
|
|
@ -562,7 +562,7 @@
|
||||||
|
|
||||||
// Executes all programs that have been labeled as a main module
|
// Executes all programs that have been labeled as a main module
|
||||||
var invokeMains = function(machine, succ, fail) {
|
var invokeMains = function(machine, succ, fail) {
|
||||||
runtime.ready(function() {
|
runtime.ready(function invokeMain() {
|
||||||
setReadyFalse();
|
setReadyFalse();
|
||||||
machine = machine || runtime.currentMachine;
|
machine = machine || runtime.currentMachine;
|
||||||
succ = succ || function() {};
|
succ = succ || function() {};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user