[M3devel] typenames vs. lexical scope vs. backend?

Rodney M. Bates rodney_bates at lcwb.coop
Mon Oct 25 19:17:48 CEST 2010



Jay K wrote:
>  > No different from names of variables, formals, constants, or procedures.
>  > I can't think why the backend would need them for code 
> generation/optimization.
> 
>  
> For debugging.
>  
> 
>  > They do belong in debug info, however.
>  
>  
> Exactly. Maybe.
> Except, I'm thinking..maybe only for entering expressions with casts?
> Maybe not for viewing any values?
>  
> I think the way the compiler is currently structured, it is a lot of 
> work to get this right,
> and not with much gain.
> The gain would be that typenames in expressions with casts would be 1) 
> evaluated
> relative to context 2) easier...typenames should probably be lengthened
> in order to have a context-independent name. The lexical scopes
> that introduce type names, in order of decreasing frequency would be 
> roughly:
>   module
>   toplevel function in a module
>   block or nested function
>  
> We could qualify typenames with Module or Module.Function or 
> Module.Function.NestedFunction.
> There's no obvious good name for blocks (WITH, FOR, etc.), but maybe 
> numbers 0, 1, 2, etc.

Whether it's either obvious or good remains subject to debate, but there is already
a system for this, used by m3gdb.  See doc/help/m3gdb/m3gdb-onepage.html, section
"linespecs that are qualified references".  As for the subterfuge behind the scenes,
wherein the compiler and m3gdb communicate info through stabs+, it's a mess.

>  
>  
> I think the frontend and frontend/backend interface need work.
> In this case there's not much to gain.
> I'll cover something else in a separate mail.
>  
>  
>  - Jay
>  



More information about the M3devel mailing list