[M3devel] a trouble with passing records by value..

Jay K jay.krell at cornell.edu
Fri Sep 3 04:57:52 CEST 2010


> To avoid going into assembly langauge in my C interpreter, on many platforms I did the
> following hack:
>
> Pack the parameters into a large struct (like struct big{char space[1000];} ), calculating
> parameter positions myself. The type of the space array was completely irrelevant -- as
> long as it ws big enough.
>
> Then I pass the struct by value to the called program, ignoring the types the called
> program wanted -- you can do this with enough casts.
>
> This worked for a *lot* of systems.
>
> To avoid wasting too much stack space, I had a variety of struct types available, of
> different sizes, each with its own code.
>
> -- hendrik


Debugging would suffer like it did/does today.
Code quality would suffer.


Hey, I wanted to pass the static link in an extra parameter concocted by the
frontend but Tony didn't want that loss of code quality.
(Letting gcc do the work here has a few advantages: the optimizer
can decide which locals even need to be in the struct, and 32bit x86
can use a register for the extra parameter, whereas it otherwise might not).


 - Jay
 		 	   		  


More information about the M3devel mailing list