-
Notifications
You must be signed in to change notification settings - Fork 138
/
calling.t
2681 lines (2480 loc) · 46 KB
/
calling.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!perl
# Copyright (C) 2001-2011, Parrot Foundation.
use strict;
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
use Parrot::Test tests => 104;
=head1 NAME
t/op/calling.t - Parrot Calling Conventions
=head1 SYNOPSIS
% prove t/op/calling.t
=head1 DESCRIPTION
Tests Parrot calling conventions.
=cut
pasm_output_is( <<'CODE', <<'OUTPUT', "set_args - parsing" );
.pcc_sub :main main:
noop
set_args "0, 0", P0, I0
print "Ok 1\n"
set_args ""
print "Ok 2\n"
end
CODE
Ok 1
Ok 2
OUTPUT
pasm_output_is( <<'CODE', <<'OUTPUT', "var_args - parsing" );
.pcc_sub :main main:
print "Ok 1\n"
set_args "0, 0", P0, I0
find_name P1, "foo"
print "Ok 2\n"
invokecc P1
print "Ok 5\n"
get_results "0", I0
print "Ok 6\n"
end
.pcc_sub foo:
get_params "0, 0", P0, I0
print "Ok 3\n"
set_returns "0", 42
print "Ok 4\n"
returncc
CODE
Ok 1
Ok 2
Ok 3
Ok 4
Ok 5
Ok 6
OUTPUT
pasm_output_is( <<'CODE', <<'OUTPUT', "call - i, ic" );
.pcc_sub :main main:
set I16, 77
set_args "0, 0", 42, I16
find_name P1, "foo"
invokecc P1
print "back\n"
end
.pcc_sub foo:
get_params "0, 0", I16, I17
print I16
print "\n"
print I17
print "\n"
returncc
CODE
42
77
back
OUTPUT
pasm_output_is( <<'CODE', <<'OUTPUT', "call - i, ic, return i, ic" );
.pcc_sub :main main:
set I16, 77
set_args "0, 0", 42, I16
find_name P1, "foo"
invokecc P1
get_results "0, 0", I16, I17
print I16
print "\n"
print I17
print "\nback\n"
end
.pcc_sub foo:
get_params "0, 0", I16, I17
print I16
print "\n"
print I17
print "\n"
set I16, 88
set_returns "0, 0", 99, I16
returncc
CODE
42
77
99
88
back
OUTPUT
pasm_output_is( <<'CODE', <<'OUTPUT', "call - i, ic, return i, ic - adjust sig" );
.pcc_sub :main main:
set I16, 77
set_args "0, 0", 42, I16
find_name P1, "foo"
invokecc P1
get_results "0, 0", I16, I17
print I16
print "\n"
print I17
print "\nback\n"
end
.pcc_sub foo:
get_params "0, 0", I16, I17
print I16
print "\n"
print I17
print "\n"
set I16, 88
set_returns "0, 0", 99, I16
returncc
CODE
42
77
99
88
back
OUTPUT
pasm_output_is( <<'CODE', <<'OUTPUT', "all together now" );
.pcc_sub :main main:
set I16, 77
set N16, 2.3
set S16, "ok 1\n"
new P16, 'Integer'
set P16, 101
set_args "0, 0, 0, 0, 0, 0, 0", 42, I16, 4.5, N16, S16, "ok 2\n", P16
find_name P1, "foo"
invokecc P1
get_results "0, 0, 0, 0", I16, N16, S16, P16
print I16
print "\n"
print N16
print "\n"
print S16
print P16
end
.pcc_sub foo:
get_params "0, 0, 0, 0, 0, 0, 0", I16, I17, N16, N17, S16, S17, P16
print I16
print "\n"
print I17
print "\n"
print N16
print "\n"
print N17
print "\n"
print S16
print S17
print P16
print "\n"
set I16, 88
set N16, 5.5
set S16, "ok 3\n"
new P16, 'String'
set P16, "ok 4\n"
set_returns "0, 0, 0, 0", I16, N16, S16, P16
returncc
CODE
42
77
4.5
2.3
ok 1
ok 2
101
88
5.5
ok 3
ok 4
OUTPUT
pasm_output_is( <<'CODE', <<'OUTPUT', "flatten arg" );
.pcc_sub :main main:
new P16, 'String'
set P16, "ok 1\n"
new P17, 'ResizablePMCArray'
push P17, "ok 2\n"
push P17, "ok 3\n"
push P17, "ok 4\n"
new P18, 'String'
set P18, "ok 5\n"
set_args "0, 0x20, 0", P16, P17, P18
find_name P1, "foo"
invokecc P1
print "back\n"
end
.pcc_sub foo:
get_params "0, 0, 0, 0, 0", P1, P2, P3, P4, P5
print P1
print P2
print P3
print P4
print P5
returncc
CODE
ok 1
ok 2
ok 3
ok 4
ok 5
back
OUTPUT
pasm_output_is( <<'CODE', <<'OUTPUT', "slurpy param" );
.pcc_sub :main main:
new P16, 'String'
set P16, "ok 1\n"
new P17, 'String'
set P17, "ok 2\n"
new P18, 'String'
set P18, "ok 3\n"
set_args "0, 0, 0", P16, P17, P18
find_name P1, "foo"
invokecc P1
print "back\n"
end
.pcc_sub foo:
get_params "0, 0x20", P1, P2
print P1
set I0, P2
print I0
print "\n"
set S0, P2[0]
print S0
set S0, P2[1]
print S0
returncc
CODE
ok 1
2
ok 2
ok 3
back
OUTPUT
pir_error_output_like( <<'CODE', qr/Invalid operation on null string/, "return :flat" );
.sub main :main
.local string s, r
.local pmc arr
say "get"
s = s_get()
r = substr s, 0, 1
print "'"
print r
print "'"
say " done"
.end
.sub s_get
.local pmc arr
arr = new ["ResizableStringArray"]
# push arr, "xy"
.return(arr :flat )
.end
CODE
pir_output_is( <<'CODE', <<'OUTPUT', "use it in PIR" );
.sub main :main
$P0 = new 'String'
$P0 = "hello\n"
find_name $P1, "foo"
# set_args and invoke must be adjacent
set_args "0", $P0
invokecc $P1
.end
.sub foo
get_params "0", $P0
print $P0
.end
CODE
hello
OUTPUT
pasm_output_is( <<'CODE', <<'OUTPUT', "flatten + slurpy param" );
.pcc_sub :main main:
new P16, 'String'
set P16, "ok 1\n"
new P19, 'ResizablePMCArray'
new P17, 'String'
set P17, "ok 2\n"
push P19, P17
new P18, 'String'
set P18, "ok 3\n"
push P19, P18
new P20, 'ResizablePMCArray'
new P17, 'String'
set P17, "ok 4\n"
push P20, P17
new P18, 'String'
set P18, "ok 5\n"
push P20, P18
new P21, 'String'
set P21, "ok 6\n"
set_args "0, 0x20, 0x20, 0", P16, P19, P20, P21
find_name P1, "foo"
invokecc P1
print "back\n"
end
.pcc_sub foo:
get_params "0, 0x20", P1, P2
print P1
set I0, P2
print I0
print "\n"
set S0, P2[0]
print S0
set S0, P2[1]
print S0
set S0, P2[2]
print S0
set S0, P2[3]
print S0
set S0, P2[4]
print S0
set P0, P2[5]
if_null P0, ok
print "not ok 7\n"
ok:
returncc
CODE
ok 1
5
ok 2
ok 3
ok 4
ok 5
ok 6
back
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "use it in PIR" );
.sub main :main
$P0 = new 'String'
$P0 = "hello\n"
find_name $P1, "foo"
# set_args and invoke must be adjacent
set_args "0", $P0
invokecc $P1
.end
.sub foo
get_params "0", $P0
print $P0
.end
CODE
hello
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "type conversion - autobox" );
.sub main :main
$P0 = new 'String'
$P0 = "hello"
find_name $P1, "foo"
# set_args and invoke must be adjacent
set_args "0,0,0", $P0, 42, "bar"
invokecc $P1
.end
.sub foo
get_params "0x20", $P0
$S0 = $P0[0]
print $S0
print ' '
$S0 = $P0[1]
print $S0
print ' '
$S0 = $P0[2]
print $S0
print "\n"
.end
CODE
hello 42 bar
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "more autobox" );
.sub main :main
foo( 101, 0.77, 'seven and seven is' )
.end
.sub foo
.param pmc some_int
.param pmc some_float
.param pmc some_string
$S0 = typeof some_int
print $S0
print "\n"
$S0 = typeof some_float
print $S0
print "\n"
$S0 = typeof some_string
print $S0
print "\n"
.return()
.end
CODE
Integer
Float
String
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "type conversion - fetch" );
.sub main :main
$P0 = new 'String'
$P0 = "hello"
$P1 = new 'Integer'
$P1 = 42
$P2 = new 'String'
$P2 = "again"
$P3 = new 'Float'
$P3 = 47.11
find_name $P10, "foo"
# set_args and invoke must be adjacent
set_args "0,0,0,0", $P0, $P1, $P2, $P3
invokecc $P10
.end
.sub foo
get_params "0,0,0,0", $P0, $I0, $S0, $N0
print $P0
print ' '
print $I0
print ' '
print $S0
print ' '
print $N0
print "\n"
returncc
.end
CODE
hello 42 again 47.11
OUTPUT
pir_error_output_like( <<'CODE', <<'OUTPUT', "argc mismatch, too few" );
.sub main :main
.include "errors.pasm"
errorson .PARROT_ERRORS_PARAM_COUNT_FLAG
$P0 = new 'String'
$P0 = "hello\n"
find_name $P1, "foo"
set_args "0", $P0
invokecc $P1
.end
.sub foo
get_params "0,0", $P0, $P1
print $P0
.end
CODE
/too few positional arguments/
OUTPUT
pir_output_like(
<<'CODE', <<'OUTPUT', "argc mismatch, too many - no getparams", todo => 'no get_params at all' );
.sub main :main
.include "errors.pasm"
errorson .PARROT_ERRORS_PARAM_COUNT_FLAG
foo(5)
.end
.sub foo
print "nada"
.end
CODE
/too many arguments passed/
OUTPUT
pir_error_output_like( <<'CODE', <<'OUTPUT', "argc mismatch, too many - force get_params" );
.macro no_params
get_params '()'
.endm
.sub main :main
.include "errors.pasm"
errorson .PARROT_ERRORS_PARAM_COUNT_FLAG
foo(5)
.end
.sub foo
.no_params
print "nada"
.end
CODE
/too many positional arguments/
OUTPUT
pir_error_output_like( <<'CODE', <<'OUTPUT', "argc mismatch, too many" );
.sub main :main
.include "errors.pasm"
errorson .PARROT_ERRORS_PARAM_COUNT_FLAG
$P0 = new 'String'
$P0 = "hello\n"
find_name $P1, "foo"
set_args "0,0", $P0, 77
invokecc $P1
.end
.sub foo
get_params "0", $P0
print $P0
.end
CODE
/too many positional arguments/
OUTPUT
pir_output_like( <<'CODE', <<'OUTPUT', "argc mismatch, too many - catch exception" );
.sub main :main
.include "errors.pasm"
errorson .PARROT_ERRORS_PARAM_COUNT_FLAG
$P0 = new 'String'
$P0 = "hello\n"
find_name $P1, "foo"
set_args "0,0", $P0, 77
invokecc $P1
.end
.sub foo
push_eh arg_handler
get_params "0", $P0
print $P0
print "never\n"
arg_handler:
get_results "0", $P1
$S0 = $P1
print "caught: "
print $S0
# $S1 = typeof $P1
# print "\nexception type: "
# print $S1
.end
CODE
/^caught: too many positional arguments/
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "argc mismatch, optional" );
.sub main :main
.include "errors.pasm"
errorson .PARROT_ERRORS_PARAM_COUNT_FLAG
$P0 = new 'String'
$P0 = "hello\n"
find_name $P1, "foo"
set_args "0", $P0
invokecc $P1
.end
.sub foo
get_params "0,0x80,0x100", $P0, $P1, $I0
print $P0
if_null $P1, ok
print "not "
ok:
print "ok\n"
.end
CODE
hello
ok
OUTPUT
pir_error_output_like( <<'CODE', <<'OUTPUT', "argc mismatch, optional" );
.sub main :main
.include "errors.pasm"
errorson .PARROT_ERRORS_PARAM_COUNT_FLAG
.local pmc ar
ar = new 'ResizableIntegerArray'
push ar, 1
push ar, 2
push ar, 3
push ar, 4
foo(ar :flat)
print "never\n"
.end
.sub foo
.param int i
.param int j :optional
.param int got_j :opt_flag
.param int k :optional
.param int got_k :opt_flag
.end
CODE
/too many positional arguments/
OUTPUT
pasm_output_is( <<'CODE', <<'OUTPUT', "get_param later" );
.pcc_sub :main main:
set I16, 77
set_args "0, 0", 42, I16
find_name P1, "foo"
invokecc P1
get_results "0, 0", I16, I17
print I16
print "\n"
print I17
print "\nback\n"
end
.pcc_sub foo:
noop
get_params "0, 0", I16, I17
print I16
print "\n"
print I17
print "\n"
set I16, 88
set_returns "4, 0", 99, I16
returncc
CODE
42
77
99
88
back
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "tailcall 1" );
.sub main :main
.const 'Sub' f = "foo"
print "main\n"
invokecc f
get_results "0", $S0
print $S0
.end
.sub foo
.const 'Sub' b = "bar"
print "foo\n"
tailcall b
.end
.sub bar
print "bar\n"
set_returns "0", "bar_ret\n"
returncc
.end
CODE
main
foo
bar
bar_ret
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "tailcall 2 - pass arg" );
.sub main :main
.const 'Sub' f = "foo"
print "main\n"
invokecc f
get_results "0", $S0
print $S0
.end
.sub foo
.const 'Sub' b = "bar"
print "foo\n"
set_args "0", "from_foo\n"
tailcall b
.end
.sub bar
get_params "0", $S0
print "bar\n"
print $S0
set_returns "0", "bar_ret\n"
returncc
.end
CODE
main
foo
bar
from_foo
bar_ret
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "tailcall 3 - pass arg" );
.sub main :main
.const 'Sub' f = "foo"
print "main\n"
invokecc f
get_results "0", $S0
print $S0
.end
.sub foo
.const 'Sub' b = "bar"
print "foo\n"
set_args "0", "from_foo\n"
tailcall b
.end
.sub bar
get_params "0", $S0
print "bar\n"
print $S0
set_returns "0", "bar_ret\n"
returncc
.end
CODE
main
foo
bar
from_foo
bar_ret
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "empty args" );
.sub main :main
$P0 = new 'String'
$P0 = "hello\n"
find_name $P1, "foo"
set_args ""
invokecc $P1
.end
.sub foo
get_params "0x80, 0x100", $P1, $I0
if_null $P1, ok
print "not "
ok:
print "ok\n"
.end
CODE
ok
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "optional args" );
.sub main :main
$P0 = new 'String'
$P0 = "hello\n"
find_name $P1, "foo"
set_args "0x0", $P0
invokecc $P1
.end
.sub foo
get_params "0x80, 0x100", $P1, $I0
unless_null $P1, ok
print "not "
ok:
print "ok\n"
.end
CODE
ok
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "pir uses no ops" );
.sub main :main
$I0 = 77
foo(42, $I0)
print "back\n"
.end
.sub foo
get_params "0, 0", $I16, $I17
print $I16
print "\n"
print $I17
print "\n"
set_returns ""
returncc
.end
CODE
42
77
back
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "pir call evaled code" );
.sub main :main
.local string s
s = ".sub foo\n"
s .= ".param int i\n"
s .= ".param int j\n"
s .= "print i\n"
s .= "print ' '\n"
s .= "print j\n"
s .= "print \"\\n\"\n"
s .= ".return(99)\n"
s .= ".end\n"
.local pmc comp
comp = compreg "PIR"
$P0 = comp(s)
$I0 = 77
$I0 = foo(42, $I0)
print $I0
print "\n"
.end
CODE
42 77
99
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "tailcall 4 - pir calls" );
.sub main :main
.const 'Sub' f = "foo"
print "main\n"
$S0 = f()
print $S0
.end
.sub foo
.const 'Sub' b = "bar"
print "foo\n"
.tailcall b("from_foo\n")
.end
.sub bar
.param string s
print "bar\n"
print s
.return ("bar_ret\n")
.end
CODE
main
foo
bar
from_foo
bar_ret
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "type conversion - native" );
.sub main :main
foo_int(42, "42", 42.20)
foo_float(42, "42", 42.20)
foo_string(42, "42", 42.20)
.end
.sub foo_int
get_params "0,0,0", $I0, $I1, $I2
print $I0
print ' '
print $I1
print ' '
print $I2
print "\n"
.end
.sub foo_float
get_params "0,0,0", $N0, $N1, $N2
print $N0
print ' '
print $N1
print ' '
print $N2
print "\n"
.end
.sub foo_string
get_params "0,0,0", $S0, $S1, $S2
print $S0
print ' '
print $S1
print ' '
print $S2
print "\n"
.end
CODE
42 42 42
42 42 42.2
42 42 42.2
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "type conversion - PIR const" );
.const int MYCONST = -2
.sub main :main
$P0 = new 'String'
"foo"(MYCONST)
.end
.sub "foo"
.param string str1 :optional
.param int has_s :opt_flag
print str1
print "\n"
.end
CODE
-2
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "optional args, :opt_flag" );
.sub main :main
$P0 = new 'String'
$P0 = "hello\n"
foo($P0)
foo()
.end
.sub foo
.param pmc p1 :optional
.param int i1 :opt_flag
if_null p1, skip
print p1
skip:
print i1
print "\n"
.end
CODE
hello
1
0
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "optional multiple :opt_flag" );
.sub main :main
$P0 = new 'String'
$P0 = "ok 1\n"
foo($P0, "ok 2\n", "ok 3\n")
.end
.sub foo
.param pmc p1 :optional
.param int i1 :opt_flag
.param pmc p2 :optional
.param int i2 :opt_flag
.param pmc p3 :optional
.param int i3 :opt_flag
.param pmc p4 :optional
.param int i4 :opt_flag
print p1
print p2
print p3
if_null p4, ok
print "not "
ok:
print "ok 4\n"
print i1
print ' '
print i2
print ' '
print i3
print ' '
print i4
print "\n"
.end
CODE
ok 1
ok 2
ok 3
ok 4
1 1 1 0
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "optional returns, void ret" );
.sub main :main
.local pmc f
$I0 = 99
f = get_global "foo"
.begin_call
.call f
.get_result $P0 :optional
.get_result $I0 :opt_flag
.end_call
unless $I0, ex
print "not "
ex:
print "ok 1\n"
.end
.sub foo
.end
CODE
ok 1
OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "tailcall 5 - arg/param conflict" );
.sub main :main
.local pmc a, b
a = new 'Integer'
a = 1
b = new 'Integer'
b = 2
.local pmc c, d
(c, d) = foo(a, b)
eq_addr a, c, ok1
print "not "
ok1:
print "ok 1\n"
eq_addr b, d, ok2
print "not "
ok2:
print "ok 2\n"
.end
.sub foo
.param pmc a
.param pmc b
$P0 = new 'Integer'
$P0 = 3
.tailcall bar($P0, a, b)
.end
.sub bar
.param pmc x
.param pmc a
.param pmc b
.return (a, b)
.end
CODE