Skip to content

Instantly share code, notes, and snippets.

@jnthn
Created October 19, 2009 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnthn/213359 to your computer and use it in GitHub Desktop.
Save jnthn/213359 to your computer and use it in GitHub Desktop.
diff --git a/src/classes/Routine.pir b/src/classes/Routine.pir
index f873bde..16a9c87 100644
--- a/src/classes/Routine.pir
+++ b/src/classes/Routine.pir
@@ -42,7 +42,7 @@ wrappable executable objects.
# If not, need to create a new candidate list with the current sub,
# and install the wrap helper that will start dispatching at the
# start of the candidate list.
- .local pmc p6i
+ .local pmc p6i, p6i_copy
cand_list = root_new ['parrot';'ResizablePMCArray']
unshift cand_list, cur_sub
p6i = root_new ['parrot';'P6Invocation'], cand_list
@@ -51,6 +51,7 @@ wrappable executable objects.
$P0 = newclosure $P0
setattribute self, ['Sub'], 'proxy', $P0
setprop $P0, '@!candidates', cand_list
+ p6i_copy = p6i
# We need to clone the wrapper, then tweak it to have an outer of
# !wrap_clholder_helper, which we use to hold the candidate list,
@@ -82,6 +83,10 @@ wrappable executable objects.
handle = box $I0
setprop $P1, '$!handle', handle
unshift cand_list, $P1
+
+ if null p6i_copy goto done
+ p6i = p6i_copy
+ done:
.return (handle)
.end
.sub '!wrap_start_helper' :anon :outer('wrap')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment