Skip to content
Browse files

Junction bind failover.

Gets almost all of the junction tests passing that to on Rakudo Parrot
as well as helping many other test files that depend on this somehow.
  • Loading branch information...
1 parent 01fc34b commit 51f4ebe38e484a99e45683ff1f16856c425255af @jnthn jnthn committed
Showing with 20 additions and 1 deletion.
  1. +11 −0 src/vm/jvm/Perl6/Ops.nqp
  2. +9 −1 src/vm/jvm/runtime/org/perl6/rakudo/Ops.java
View
11 src/vm/jvm/Perl6/Ops.nqp
@@ -50,10 +50,21 @@ $ops.add_hll_op('perl6', 'p6bindsig', -> $qastcomp, $op {
$il.append(JAST::Instruction.new( :op('aload'), '__args' ));
$il.append(JAST::Instruction.new( :op('invokestatic'), $TYPE_P6OPS,
"p6bindsig", $TYPE_CSD, $TYPE_TC, $TYPE_CSD, "[$TYPE_OBJ" ));
+ $il.append(JAST::Instruction.new( :op('dup') ));
+
+ my $natlbl := JAST::Label.new( :name('p6bindsig_no_autothread') );
+ $il.append(JAST::Instruction.new( :op('ifnonnull'), $natlbl ));
+ $il.append(JAST::Instruction.new( :op('aload'), 'cf' ));
+ $il.append(JAST::Instruction.new( :op('invokevirtual'),
+ $TYPE_CF, 'leave', 'Void' ));
+ $il.append(JAST::Instruction.new( :op('return') ));
+ $il.append($natlbl);
+
$il.append(JAST::Instruction.new( :op('astore'), 'csd' ));
$il.append(JAST::Instruction.new( :op('aload_1') ));
$il.append(JAST::Instruction.new( :op('getfield'), $TYPE_TC, 'flatArgs', "[$TYPE_OBJ" ));
$il.append(JAST::Instruction.new( :op('astore'), '__args' ));
+
$ops.result($il, $RT_VOID);
});
$ops.map_classlib_hll_op('perl6', 'p6isbindable', $TYPE_P6OPS, 'p6isbindable', [$RT_OBJ, $RT_OBJ], $RT_INT, :tc);
View
10 src/vm/jvm/runtime/org/perl6/rakudo/Ops.java
@@ -270,7 +270,15 @@ public static CallSiteDescriptor p6bindsig(ThreadContext tc, CallSiteDescriptor
case Binder.BIND_RESULT_FAIL:
throw ExceptionHandling.dieInternal(tc, error[0]);
case Binder.BIND_RESULT_JUNCTION:
- throw ExceptionHandling.dieInternal(tc, "Junction re-dispatch NYI");
+ /* Invoke the auto-threader. */
+ csd = csd.injectInvokee(tc, args, cf.codeRef.codeObject);
+ args = tc.flatArgs;
+ org.perl6.nqp.runtime.Ops.invokeDirect(tc, gcx.AutoThreader, csd, args);
+ org.perl6.nqp.runtime.Ops.return_o(
+ org.perl6.nqp.runtime.Ops.result_o(cf), cf);
+
+ /* Return null to indicate immediate return to the routine. */
+ return null;
}
/* The binder may, for a variety of reasons, wind up calling Perl 6 code and overwriting flatArgs, so it needs to be set at the end to return reliably */

0 comments on commit 51f4ebe

Please sign in to comment.
Something went wrong with that request. Please try again.