we've started a project (will have a web-page soon) that aims to port the
php-language (www.php.net) to run on top of parrot. we've written some
First of all, welcome! :)
I'll read your mail in depth and send a followup reply, but right off I have a suggestion.
In loops, your compiler should be able to analyse the full loop construct and detect what type to make the iterator. In the case you provided you don't need to make $i a PMC.
a) You could do the simple approach which wouldn't require much code analysis and just start $i as an INT, then morph it yourself with another temporary to a FLOAT.
b) The compiler can analyze the for() loop AST and the local basic blocks and detect that $i can simply be defined as a FLOAT register to start with to skip the eventual morph instruction.
Our eventual goal is to add optimization into IMCC that tries to use non-PMC registers where possible. For starters, your high level compiler should be able to analyze any assignment statement or expression to determine the type from the operands. You should be able to use non-PMCs anytime the source operands can be typed (literal or temporary).
In the case that you cannot determine it, then use a PMC. You'll have to do dataflow analysis if you want any more than that because once the data is morphed to a PMC, you'll have trouble typing it again to get it back without inserting some fancy conditional code.
Hope this helps,
-Melvin