GCC/ObjC enhancements, comments requested
Ovidiu Predescu
ovidiu@aracnet.com
Sun Feb 8 22:32:00 GMT 1998
On 08 Feb 1998 12:59:30, marcusd@cathcart.sysc.pdx.edu (Marcus G. Daniels) wrote:
> >>>>> "OP" == Ovidiu Predescu <ovidiu@aracnet.com> writes:
>
> OP> The way I originally saw this runtime construction of a call is to
> OP> make GCC generate this knowledge and implement generic functions
> OP> in a runtime library (libgcc or libobjc) that uses that knowledge
> OP> to build the call.
>
> Hey, if worse came to worst, "gcc -g" generates this knowledge.
> Looks to me like "objdump --debugging" reports everything that's needed.
> Link in GNU BFD and load up them reflection data structures!
What we're trying to build is a system that allows us to build a function
call at _runtime_, knowing the address of the function, the argument types
and the return value. The types would be encoded in a similar way with how
ObjC currently encodes them, in C strings. GCC currently implements only half
of this support with the __builtin_apply() and __builtin_return()
pseudo-functions.
BFD can't help us here because it gives information only on the name of the
functions contained in an object file, the argument types are lost (at least
for C and C++ functions, ObjC does encode the argument and return value types
of each method).
What is needed is a way to access and set the arguments in the frame passed
to __builtin_apply() and the return value respectively in __builtin_return().
The knowledge to do this is definitely contained inside GCC, as it is able
to generate these functions. We need a way to export this knowledge to an
external library like libgcc.
I think this can be done relatively easy by exporting the tables and the
register and mode information used by expand_builtin_apply() and
expand_builtin_return() in expr.c. We can then implement a simple C API that
works with them to access the __builtin_apply frame; the algorithms
implemented would duplicate the ones used by the above functions.
--
Ovidiu Predescu <ovidiu@net-community.com> (NeXTMail, MIME)
http://www.net-community.com/Users/~ovidiu
More information about the Gcc
mailing list