As I noted online and in the Perl 6 design meeting earlier today,
the attached patch (applied to r28973) causes imcc to hang
while building rakudo at the step
../../parrot -o perl6.pbc perl6.pir
This step never completes -- in fact, I inadvertently left
it running for four hours and it hadn't completed.
I'm reporting this because it's extremely odd; the patch itself
does nothing more than add a function to src/builtins/guts.pir;
in fact, Rakudo doesn't even use that function yet. Within the
function, simply changing the placement of the push_eh opcode
seems to be enough to get things to compile again.
Can anyone reproduce the problem on their systems?
Thanks,
Pm
Index: languages/perl6/src/builtins/guts.pir
===================================================================
--- languages/perl6/src/builtins/guts.pir (revision 28973)
+++ languages/perl6/src/builtins/guts.pir (working copy)
@@ -58,6 +58,54 @@
.end
+=item !OUTER(name [,'max'=>max])
+
+Helper function to obtain the lexical C<name> from the
+caller's outer scope. (Note that it never finds a lexical
+in the caller's lexpad -- use C<find_lex> for that.) The
+C<max> parameter specifies the maximum outer to search --
+the default value of 1 will search the caller's immediate
+outer scope and no farther. If the requested lexical is
+not found, C<!OUTER> returns null.
+
+=cut
+
+.sub '!OUTER'
+ .param string name
+ .param int max :named('max') :optional
+ .param int has_max :opt_flag
+
+ if has_max goto have_max
+ max = 1
+ have_max:
+
+ .local int min
+ min = 1
+
+ ## start with caller's outer scope (i.e., outer depth is 2)
+ .local int depth
+ depth = 2
+ .local pmc lexpad, value
+ null value
+ push_eh outer_err
+ loop:
+ unless max >= min goto done
+ $P0 = getinterp
+ lexpad = $P0['outer', depth]
+ unless lexpad goto next
+ value = lexpad[name]
+ unless null value goto done
+ next:
+ inc depth
+ dec max
+ goto loop
+ done:
+ pop_eh
+ outer_err:
+ .return (value)
+.end
+
+
=item !VAR
Helper function for implementing the VAR and .VAR macros.