As outlined in the analysis of dumper.t failures with the new register allocator, we have another problem with current calling or better return conventions.

Given this simple program:

$ cat ret.imc
.sub main @MAIN
    P5 = new PerlString
    P5 = "ok\n"
    foo()
    print P5
.end
.sub foo
    .local pmc ok
    ok = new PerlString
    ok = "bug\n"
    .return(ok)
.end

$ parrot ret.imc
bug

The usage of the register P5 in main isn't invalid: the register allocator might have (in a more complex program) just not found any other free register. And as the main program just calls a function in void context the register P5 could have been used.

Defining now that P5 has to be preserved in main, because it's a possible return result of foo() and therefore may be clobbered by foo() is meaning, that we have effectively just 16 registers per kind available for allocation around a function call.

If the latter is true according to current pdd03 then we are wasting half of our registers for a very doubtful advantage: being able to pass return values in R5..R15.

leo



Reply via email to