On Fri, 2007-11-02 at 23:56 -0400, Robert Dewar wrote:
> skaller wrote:

> You really can't be serious in your comment about fs, if you
> understand the architecture ...

You're just not thinking the same way I am. A CPU has state,
the compiler and application program manage that state.

If the compiler can use a register, the application can too.
They're therefore competing for the use of the register.

If gcc wants to use it for TLS but I want to use it for
a different purpose, there's a conflict.

If the OS uses the register and denies it to the programmer,
or specifies a particular use, then BOTH the compiler and
application have to respect that.

Bottom line: gcc isn't the only code generator. I can write
assembler by hand. I can also access machine registers
directly with gcc (nice feature!)

GHC Haskell  takes the assembler output gcc produces and runs 
a Perl script over it to fix it up. It's called 'registering' 
the code. GHC uses continuation passing and gcc can't represent the
model very well .. that's GHC's solution: to trick gcc.
you can bet they're interested in what optimisations gcc
does because they have to find the 'fixup' points.

Mercury, Felix and Mlton use 'assembler labels' to work around
gcc's own inability to compile large functions, coupled
with C's lack of decent control structures (which can
be implemented in flat code that gcc can't compile).

In Mlton, it's known gcc can break it by duplicating the
code (and thus the assembler labels). This has never
happened with Felix, but in theory it might.

All these applications are using gcc with C plus tricks
to establish their own environment. So using a register
isn't free.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

Reply via email to