hi,

On Wed, Mar 16, 2005 at 02:48:56PM -0500, Robert Dewar wrote:
> Yes, but that avoids the difficulty, that's obvious so far.
> 
> The problem is to know exactly when to pop the stack, and that is
> not trivial (longjmp, exceptions, non local gotos).

hmm.. what's about doing it gc-like. Instead of a stack there simply is a
'pool' of trampolines from which trampolines are allocated and a pointer to
the trampoline is pushed on the stack.

When the last trampoline from the pool is allocated, a 'garbage collector'
is running over it and looking for pointers to trampolines between the
stack pointer and the stack start address. Every trampoline which isn't
possibly referenced is added to a free-list from which new trampolines are
allocated.

When no trampoline can be allocated, abort() is called (with or without
crossjumping ;-).

This may be a dirty hack and guessing a good size for the trampoline pool
is still an issue - but it could be implemented easily and would work...

Instead of adding the trampoline pool to libgcc (as suggested earlier in
this thread) I would suggest that gcc generates a trampoline pool in a
linkonce section every time a source file is compiled which requires
trampolines. That way there wouldn't be any trampoline pool in an
executeable which doesn't need one and a compiler option such as
-ftrampoline-pool-size=32 could be used the specify the size of the
trampoline pool on the command line.

The only issue I see with that is that the trampoline pool will actually
consist of two sections: one for the code and one for the data. Afair there
is a bug with linkonce sections connected to data sections. (triggered e.g.
when a big switch statement in function in a c++ template is compiled using
a jump table. this may lead to code-references in .data to dropped linkonce
code sections.) may this also become an issue here? or is the bug fixed
already?

yours,
 - clifford

--
ocaml graphics.cma <( echo 'open Graphics;;open_graph " 640x480"let
complex_mul(a,b)(c,d)=(a*.c-.b*.d,a*.d+.b*.c)let complex_add(a,b)(c
,d)=(a+.c,b+.d);;let rec mandel c n=if n>0 then let z=mandel c(n-1)
in complex_add(complex_mul z z)c else (0.0,0.0);; for x=0 to 640 do
for y=0 to 480 do let c=((float_of_int(x-450))/.200.0,(float_of_int
(y-240))/.200.0) in let cabs2(a,b)=(a*.a)+.(b*.b)in if cabs2(mandel
c 50)<4.0 then plot x y done done;;read_line()' )
 
M$ is not the answer. M$ is the question. No is the answer!
 

Attachment: pgpupBLHWsXdb.pgp
Description: PGP signature

Reply via email to