Random idea...

Rob Landley rob at landley.net
Wed Feb 22 03:05:14 UTC 2006


Missed this first time through, emailing the web server bounced it into my 
spam folder...

On Tuesday 21 February 2006 1:53 pm, Paul Fox wrote:
>  > We have lots of global variable stuff, and it's only used when one
>  > applet's going.
>  >
>  > Here's a thought:
>  >
>  > Group each applet's globals into a structure, ala:
>  >
>  > struct APPLET_globals
>  > {
>  >   blah blah blah;
>  > };
>  >
>  > And then have a big evil union, ala:
>  >
>  > union {
>  >   APPLET1_globals APPLET1;
>  >   APPLET2_globals APPLET2;
>  >   APPLET3_globals APPLET3;
>  > } bb_globals __attribute_(not_aliased_to_anything,really,I_mean_it);
>
> is it possible that there's linker magic that could make this
> happen automatically?

Um, ick?

> i'm talking through my hat here, but it 
> feels like you should be able to direct each applet's globals
> into an applet-specific region, and then do linker map magic of
> some sort to overlay all those applet-specific regions into one
> "real" region.

I've seen linker scripts.  They strike me as insanely compiler-specific and 
complicated and hard to maintain.  (This is largely the fact that I don't 
particuarly understand them talking, you understand...)

> obviously all of the cautions and concerns 
> already voiced with regard to reentrancy, applet-to-applet calls,
> etc, would still apply, but it might disrupt the codebase a lot
> less.

I'm much happy to disrupt the codebase in obvious and explicit ways than 
introduce black magic.

I could document it in programming.html if we did do this, but it still 
wouldn't be my first choice...

>  > The upside is collapsing together all the statics so we use less runtime
>  > memory.
>
> it's not real memory being saved, is it?  just page tables entries, or
> whatever they're called these days?

Depends on the platform, the compiler used, current lunar phase...

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list