All --

I don't understand how .globalconst fits in with the IMCC policy
of everything being in a .sub.

The Jako compiler emits stuff like this right now (in my sandbox).
It used to emit the constants as .const right where the were found
lexically, but I've introduced code motion to collect all inline
code into the __MAIN sub at the end, which put the .const stuff
there (which I've changed to .globalconst in the case where it
is something from the top level File block).

  .sub ___MAIN
    bsr __MAIN
    end
  .end

  .sub some_real_sub
    # calling conv args get
    print X
    # calling conv result put
    ret
  .end

  .sub __MAIN
    .globalconst int X = 43;

     # calling conv call set up and arg put
     call some_real_func
     # calling conv call tear down and result get

    ret
  .end

This doesn't work. IMCC complains about the use of X in
some_real_sub.

So, where am I supposed to put these .globalconsts if they
have to be in a .sub?

Generally, making me move the code around like this is a bit
of a PITA, since technically lexical accessibility of variables
inside subroutines defined after them but not those defined
before them ends up being a problem.

I suppose I could collect every chunk of uninterrupted code
into .sub __INLINE_N sections still interspersed, and have
__MAIN call __INLINE_1 and __INLINE_1 goto __INLINE_2 and the
last one ret to __MAIN, but I'd want some input before going
to all that trouble.

What is the right way to do this stuff???


Regards,

-- Gregor

-- 
Gregor Purdy                            [EMAIL PROTECTED]
Focus Research, Inc.               http://www.focusresearch.com/

Reply via email to