On Oct-26, Leopold Toetsch wrote: > Steve Fink <[EMAIL PROTECTED]> wrote: > > I am getting a seg fault when doing a very simple subroutine call with > > IMCC: > > > .sub _main > > newsub $P4, .Sub, _two_of > > $P6 = new PerlHash > > .pcc_begin prototyped > ^^^^^^^^^^ > > .pcc_sub _two_of non_prototyped > ^^^^^^^^^^^^^^ > > You are stating explicitely conflicting call types. That can't work. > When you remove "non_prototyped" in the sub, its prepared to be called > either way and it works.
That is working for me now for the parameter passing, but not for return values. The below code seg faults because it is attempting to pry return values out of P3; it works if I switch the line .pcc_begin non_prototyped to .pcc_begin prototyped
I'm not sure if this is implemented yet, though.
Code follows:
.sub __main .local Sub main_sub main_sub = newsub _main .pcc_begin non_prototyped .pcc_call main_sub ret: .result $I0 .result $I1 .pcc_end print "Returned " print $I0 print "," print $I1 print "\n" end .end
.pcc_sub _main prototyped .pcc_begin_return .return 10 .return 20 .pcc_end_return .end
It is still the same issue. This code explicitly mixes 2 call conventions. _main is declared as prototyped so it will return 1 in I0 which signals that it is returning its values in registers in prototyped convention. Your call explicitly calls in non_prototyped mode which does not generate any code to check the return convention since you are saying by your code that you _know_ what the call convention is.
However, I see your point. To be orthogonal would suggest that we
implement the same feature for .pcc_call that we do for the .pcc_sub
declaration. If you left off the calling convention to .pcc_call it would generate code
to check for either. Although this would really bloat the code, it might
be wise to support the feature for some instances.
-Melvin