@@ -390,6 +390,8 @@ protected void createShorthandDispatchers(ClassContext c) {
390
390
// get the arity of the capture we got passed
391
391
mv .visitVarInsn (Opcodes .ALOAD , 3 ); // csd
392
392
mv .visitFieldInsn (Opcodes .GETFIELD , TYPE_CSD .getInternalName (), "numPositionals" , "I" );
393
+ emitInteger (mc , 1 ); // arity
394
+ mv .visitInsn (Opcodes .ISUB );
393
395
394
396
for (Iterator <Map .Entry <Integer , List <String >>> in_it = descriptors_by_arity .entrySet ().iterator (); in_it .hasNext (); ) {
395
397
Map .Entry <Integer , List <String >> in_ent = in_it .next ();
@@ -510,7 +512,7 @@ protected void createAdaptorMethod(ClassContext c, Method tobind) {
510
512
c .arities .get (name ).get (arity ).add (desc );
511
513
// stash the method away for later generation of shorthand methods.
512
514
c .methods .put (desc , tobind );
513
- MethodContext cc = startCallout (c , ptype . length + 1 , "method/" + tobind .getName () + "/" + desc );
515
+ MethodContext cc = startCallout (c , arity + 1 , "method/" + tobind .getName () + "/" + desc );
514
516
515
517
int parix = 1 ;
516
518
preMarshalIn (cc , tobind .getReturnType (), 0 );
@@ -868,13 +870,11 @@ protected void endCallout(MethodContext c) {
868
870
Label handler = new Label ();
869
871
Label notcontrol = new Label ();
870
872
871
- System .out .println ("making the endTry piece" );
872
873
mv .visitLabel (endTry );
873
874
mv .visitVarInsn (Opcodes .ALOAD , 5 ); //cf
874
875
mv .visitMethodInsn (Opcodes .INVOKEVIRTUAL , TYPE_CF .getInternalName (), "leave" , "()V" );
875
876
mv .visitInsn (Opcodes .RETURN );
876
877
877
- System .out .println ("making the handler piece" );
878
878
mv .visitLabel (handler );
879
879
mv .visitInsn (Opcodes .DUP );
880
880
mv .visitTypeInsn (Opcodes .INSTANCEOF , "org/perl6/nqp/runtime/ControlException" );
@@ -883,19 +883,15 @@ protected void endCallout(MethodContext c) {
883
883
mv .visitMethodInsn (Opcodes .INVOKEVIRTUAL , TYPE_CF .getInternalName (), "leave" , "()V" );
884
884
mv .visitInsn (Opcodes .ATHROW );
885
885
886
- System .out .println ("making the notcontrol piece" );
887
886
mv .visitLabel (notcontrol );
888
887
mv .visitVarInsn (Opcodes .ALOAD , 1 ); // tc
889
888
mv .visitInsn (Opcodes .SWAP );
890
889
mv .visitMethodInsn (Opcodes .INVOKESTATIC , "org/perl6/nqp/runtime/ExceptionHandling" , "dieInternal" ,
891
890
Type .getMethodDescriptor (Type .getType (RuntimeException .class ), TYPE_TC , Type .getType (Throwable .class )));
892
891
mv .visitInsn (Opcodes .ATHROW );
893
892
894
- System .out .println ("making the trycatch block" );
895
893
c .mv .visitTryCatchBlock (c .tryStart , endTry , handler , null );
896
- System .out .println ("visiting Maxs" );
897
894
c .mv .visitMaxs (0 ,0 );
898
- System .out .println ("visiting End" );
899
895
c .mv .visitEnd ();
900
896
}
901
897
0 commit comments