At 06:57 PM 6/1/2003 +0200, Leopold Toetsch wrote:
Clinton A. Pierce <[EMAIL PROTECTED]> wrote:
> The following code:

> push_integer() not implemented in class 'PerlHash'

> This is, as far as I can tell, because the same register is used by IMCC
> for both the READDATA and RESTOREINFO locals, thus by the time that the sub
> _data gets around to being run, READDATA has become a PerlHash (imcc -t):

>>PC=0; OP=821 (new_p_ic); ARGS=(P0, 14)
>>PC=3; OP=821 (new_p_ic); ARGS=(P0, 15)

Yep. Good analysis.

You could tell it a bug. Imcc should follow the code path into the
subroutine. But he problem is: the subroutine isn't known, when _main is
compiled. So IMCC only sees one usage of the Array and one usage of the
Hash amd assigns both to the same register P0.

Makes sense.



If you want really use such constructs, you can't put them in different
compilation units, because they are basically one unit.

So a BASIC IMCC program, with all of the builtin functions it needs, plus the actual user program itself as one compilation unit? All for the sake of a few needed globals? Sounds ghastly.


Much better is to implement some kind of calling conventions.

Except that these represent true global data structures that the entire BASIC machine needs. They're not really things to be passed around from place to place and the thought of having a Px register to hold the "state of BASIC" and passing it (potentially) everywhere seems kinda silly for a language that isn't really threaded in any incarnation and is ever only going to need one state.


I've *got* good, sound calling conventions now but there are things (sofar, only half a dozen*) that exist in an outermost scope that need initialization.

I could turn the whole thing upside-down (subs first, main last) except that I'd need a token outer main() to call the initialization routine. And from a quick test IMCC can tell that the execution path jumped down, and optimizes those registers away anyway. Nevermind.

Further suggestions, given better info?


* Examples of things that are really global in a BASIC machine: current random number seed, cursor column position, console current character attributes, last value picked up from a READ/DATA combo (line & position), structure definition table, and a GOSUB call-stack lookback specifically for "RETURN x".





Reply via email to