Re: Garbage collection problems
- From: "cr88192" <cr88192@xxxxxxxxxxx>
- Date: Thu, 22 Nov 2007 00:19:56 +1000
"jacob navia" <jacob@xxxxxxxxxx> wrote in message
news:fi1c6s$pvc$1@xxxxxxxxxxx
cr88192 wrote:
"jacob navia" <jacob@xxxxxxxxxx> wrote in message
news:fi13tb$rbr$2@xxxxxxxxxxx
cr88192 wrote:
"CBFalconer" <cbfalconer@xxxxxxxxx> wrote in messageMr Falconer has his own world, as many people here around.
news:47439D4C.F140EE6C@xxxxxxxxxxxx
Paul Hsieh wrote:errm?...
... snip ...
It forces call stack uniformity (the EH needs to be able to crawl upTo bring things back to reality, there is no reason to have a stack
the stack and unwind the stack in a uniform way.) So for example,
in any C system.
what kind of 'reality' is it you are living in?...
A stack is not necessary, one complement or sign magnitude
representations rule the world, etc etc.
I think we have touched a trap representation
:-)
yes, ok.
but, it is maybe interesting from a theoretical perspective, aka:
a C-implementation allocating all the call frames on a heap.
so, we want a call frame?
grab it from a free-list (or, somehow, allocate more if needed).
need to store locals? grab a chunk of memory for this and attach to call
frame.
need space for args? likewise, grab a chunk of memory, evaluate and store
in the args, and attach it to the (newly created) call frame of the
function being called.
So, you are implementig the stack in software. Instead of doing a
single register subtract, you allocate memory, put that in the list
of active frames, etc etc!
That would be really bad for performance
yes, as noted in the prev post, a notable performance hit...
a special purpse allocator would be needed hopefully to keep the performance
from being too horrible (in this case, allocating each frame would consist
of a few operations to grab the pieces from the appropriate free-lists).
for example:
;grab a frame
mov ecx, [__magic_frame_free_list]
mov eax, [ecx]
mov [__magic_frame_free_list], eax
;grab args
mov edx, [__magic_args_free_list2]
mov eax, [edx]
mov [__magic_args_free_list2], eax
;do other stuff
....
note that, some means would be needed to make sure free-lists are never
empty (that, or, insert code to check, but this is worse...).
though, it may not be worthwhile in terms of supporting continuations, it
could be worthwhile in allowing an implementation which allows lexical
scoping and closures (assuming some more explicit and cheaper means were not
used in implementing closures instead).
...
afaik, this particular approach is used in many scheme implementations,
for the reason that it makes implementing call/cc really fast and easy
(we can jump outword to some enclosing call frame, do stuff, or jump
right back into a call frame we had previously jumped out of).
call/cc is completely UNREADABlE. You do not see in the program text
where the program is going, you have to figure out what is the current
continuation!!!!!
That was something completely NUTS!
yes...
well, in some of my previous VMs, I generally ended up preferring stacks
over heap-based frames, since function calls are all the time, but
continuations are rare...
it is then acceptable to allow call/cc to do some pretty drastic stuff
(stack cloning, ...), but otherwise have fairly fast execution...
actually, in my last lang which still had continuations, I ended up
initially spliting full and partial continuations, allowing much faster
exit-only continuations (since, IME, this is about the only way I ever
really used them).
I think in this case I may have neglected to fully implement full
continuations.
some people have used call/cc as a way of implementing multithreading
from within scheme itself, ...
Fine... When it works. When it doesn't, I would not like to be
the one debugging that stuff.
yeah, I had typically implemented more traditional threading.
interesting? maybe.
practical? probably not.
I agree with that!
yes.
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
.
- References:
- Garbage collection problems
- From: jacob navia
- Re: Garbage collection problems
- From: Tor Rustad
- Re: Garbage collection problems
- From: cr88192
- Re: Garbage collection problems
- From: Richard Heathfield
- Re: Garbage collection problems
- From: cr88192
- Re: Garbage collection problems
- From: Charlton Wilbur
- Re: Garbage collection problems
- From: Chris Dollin
- Re: Garbage collection problems
- From: Ben Bacarisse
- Re: Garbage collection problems
- From: Chris Dollin
- Re: Garbage collection problems
- From: Ben Bacarisse
- Re: Garbage collection problems
- From: Chris Dollin
- Re: Garbage collection problems
- From: Paul Hsieh
- Re: Garbage collection problems
- From: CBFalconer
- Re: Garbage collection problems
- From: cr88192
- Re: Garbage collection problems
- From: jacob navia
- Re: Garbage collection problems
- From: cr88192
- Re: Garbage collection problems
- From: jacob navia
- Garbage collection problems
- Prev by Date: Re: Determine which sum is larger
- Next by Date: Re: Defeating Optimisation for memcmp()
- Previous by thread: Re: Garbage collection problems
- Next by thread: Re: Garbage collection problems
- Index(es):
Relevant Pages
|