Re: Event handling

2003-07-17 Thread Jerome Vouillon
On Thu, Jul 17, 2003 at 09:52:35PM +0200, Leopold Toetsch wrote: > Remaining is: > 1) save & fill the byte_code with event handler ops. > 2) use address relative to op_func_table > 3) Or the "official" way: do regular checks. > I estimate 2) to be best for prederefed code. I'm not sure about this.

Re: [perl #22633] [PATCH] convert parrot to continuation passing style

2003-06-11 Thread Jerome Vouillon
On Tue, Jun 10, 2003 at 04:00:07PM -0700, Jonathan Sillito wrote: > > -Original Message- > > From: Jerome Vouillon [mailto:[EMAIL PROTECTED] > > > > The python interpreter seems rather slow. I get these numbers with the > > Ocaml bytecode interpreter. &

Re: [perl #22633] [PATCH] convert parrot to continuation passing style

2003-06-11 Thread Jerome Vouillon
On Tue, Jun 10, 2003 at 04:59:50PM -0700, Robert Spier wrote: > > > mistral-jerome:/tmp > time python test.py > > > python test.py 2,59s user 0,00s system 100% cpu 2,582 total > > > mistral-jerome:/tmp > ocamlc -o tst test.ml; time ./tst > > > ./tst 0,14s user 0,00s system 106% cp

Re: [perl #22633] [PATCH] convert parrot to continuation passing style

2003-06-10 Thread Jerome Vouillon
On Tue, Jun 10, 2003 at 06:07:31PM +, Jonathan Sillito wrote: > I am not satisfied with the time taken to make a call. I did some rough > benchmarking and the parrot implementation makes us slower than python > 2.2.1. The most expensive part of our call is the saveall/restoreall that > wraps th

Re: [RFC] imcc calling conventions

2003-02-25 Thread Jerome Vouillon
On Mon, Feb 24, 2003 at 05:29:26PM +, Piers Cawley wrote: [Tail-call optimization] > Under caller saves, this is easy to do. Under callee saves, b's second > call to c() cannot simply return to Continuation A but must unwind the > call stack via b to make sure that the right things are restored

Re: [RFC] imcc calling conventions

2003-02-25 Thread Jerome Vouillon
On Tue, Feb 25, 2003 at 08:47:55AM +0100, Leopold Toetsch wrote: > >Um... no. tail call optimization implies being able to replace *any* > >tail call, not just a recursive one with a simple goto. Consider the > >following calling sequence: > > > > b(arg) -> Push Continuation A onto the continua

Re: YARL - yet another run loop: CSwitch

2003-02-14 Thread Jerome Vouillon
On Sat, Feb 08, 2003 at 05:36:58PM +0100, Leopold Toetsch wrote: > Jason Gloudon wrote: > >On Fri, Feb 07, 2003 at 05:49:35PM +0100, Leopold Toetsch wrote: > >>I don't know yet, how multi threading will be done. But when multiple > >>interpreters share the ->code data member (as newinterp/runinter

Re: [CVS ci] CGP - CGoto Prederefed runloop

2003-02-06 Thread Jerome Vouillon
On Thu, Feb 06, 2003 at 01:37:42PM +0100, Leopold Toetsch wrote: > This is one thing I allways wanted to try ;-) > > fast_core MOps: 11 > Prederef: 17.5 > CGoto MOps: 19.4 > CGP MOps: 27.5 > CGP -O3 MOps: 65 !!!1 > > This runloop combines the faster dispatch of opcodes via compu

Re: Infant mortality

2003-01-03 Thread Jerome Vouillon
On Tue, Dec 31, 2002 at 06:32:42PM -0800, Steve Fink wrote: > On Dec-31, Jerome Vouillon wrote: > > The temporary objects could be stored in a stack, which is popped when > > leaving the current function (both with normal exits and longjmp). > > This should make it a lot less

Re: Infant mortality

2002-12-31 Thread Jerome Vouillon
On Mon, Dec 30, 2002 at 04:00:55PM -0800, Steve Fink wrote: > =head1 Solution 3: Explicity root set augmentation > > A final possible solution is to provide a mechanism to temporarily > anchor an otherwise unanchored object to the root set. (eg, have an > array of objects associated with the inter

Re: Does ::: constrain the pattern engine implementation?

2002-08-29 Thread Jerome Vouillon
On Wed, Aug 28, 2002 at 10:36:54AM -0700, Larry Wall wrote: > That is a worthy consideration, but expressiveness takes precedence > over it in this case. DFAs are really only good for telling you > *whether* and *where* a pattern matches as a whole. They are > relatively useless for telling you

Re: Lexical variables, scratchpads, closures, ...

2002-08-04 Thread Jerome Vouillon
On Sat, Aug 03, 2002 at 01:42:06AM -0400, Melvin Smith wrote: > Here is an attempt. I'm assuming the stack of pads is a singly-linked list > of pads with children pointing to parents, and multiple children can refer > to the same parent. If they are created on the fly, the creation of > a Sub or C

Re: Lexical variables, scratchpads, closures, ...

2002-08-04 Thread Jerome Vouillon
On Fri, Aug 02, 2002 at 09:06:31PM +0100, Nicholas Clark wrote: > On Fri, Aug 02, 2002 at 06:43:49PM +0200, Jerome Vouillon wrote: > > Allocating a hash will certainly remain a lot more expensive than > > allocating an array. And we are going to allocate pads pretty > > oft

Re: Lexical variables, scratchpads, closures, ...

2002-08-02 Thread Jerome Vouillon
On Fri, Aug 02, 2002 at 08:50:27AM -0700, Sean O'Rourke wrote: > On Fri, 2 Aug 2002, Jerome Vouillon wrote: > > > On Thu, Aug 01, 2002 at 10:57:34AM -0700, Sean O'Rourke wrote: > > > My naive implementation would have an array of hashes for each sub, with > >

Re: maybe-PATCH: sub/continuation/dlsym/coroutine clean-up

2002-08-02 Thread Jerome Vouillon
On Tue, Jul 30, 2002 at 09:07:11PM -0700, Sean O'Rourke wrote: > - take a look at "new" in core.ops. Creating a new continuation captures > context, but the register holding that continuation is part of the > context. Unfortunately, it doesn't know what register it's in until after > it captures

Re: Lexical variables, scratchpads, closures, ...

2002-08-02 Thread Jerome Vouillon
On Thu, Aug 01, 2002 at 10:57:34AM -0700, Sean O'Rourke wrote: > My naive implementation would have an array of hashes for each sub, with > one entry for each level of scope within. I would use an array of arrays or a linked-list of arrays. This is hardly more difficult to implement (you just ne

Re: Lexical variables, scratchpads, closures, ...

2002-08-01 Thread Jerome Vouillon
On Wed, Jul 31, 2002 at 11:40:39AM -0600, Jonathan Sillito wrote: > So here is my take on a slightly simpler example: > > sub foo { > my $x = 13; > return sub { print "$x\n"; }; > } > > $foo() Melvin, I think it would really help if you could explain us how you would compile this

Re: Lexical variables, scratchpads, closures, ...

2002-08-01 Thread Jerome Vouillon
On Wed, Jul 31, 2002 at 11:22:56PM -0400, Melvin Smith wrote: > At 06:25 PM 7/31/2002 +0200, Jerome Vouillon wrote: > >Closures > > > > A subroutine must have access to the scratchpads of all the > > englobing blocks. As the scratchpads are linked, it is sufficient &

Re: Lexical variables, scratchpads, closures, ...

2002-07-31 Thread Jerome Vouillon
On Wed, Jul 31, 2002 at 11:40:39AM -0600, Jonathan Sillito wrote: > new_pad # push this on the lexical stack > # some constant descriptor should also be passed > # to the new_pad op which would then know about > # the lexical variable 'x', and would

Lexical variables, scratchpads, closures, ...

2002-07-31 Thread Jerome Vouillon
Let us think a bit about the implementation of lexical variables. Assignement First, let us consider how to compile a variable assignement such as: $x = $y where both $x and $y are lexical variables. At first, one may think that this can be compiled simply into a register assignme

Re: Stack and GC

2002-06-21 Thread Jerome Vouillon
On Fri, Jun 21, 2002 at 06:22:40PM -0400, Melvin Smith wrote: > At 10:22 PM 6/21/2002 +0200, Jerome Vouillon wrote: > >Ok. Then, you should do the converse to what you are mentionning in > >your patch: instead of inlining a context in the interpreter structure > >(Parrot_In

Re: Stack and GC

2002-06-21 Thread Jerome Vouillon
On Fri, Jun 21, 2002 at 02:33:33PM -0400, Melvin Smith wrote: > Now, if you look at it and say we can do a "lightweight" > interpreter, I think that is what I'm trying to accomplish, but I'm > calling it Parrot_Context. Ok. Then, you should do the converse to what you are mentionning in your pat

Re: Stack and GC

2002-06-21 Thread Jerome Vouillon
On Fri, Jun 21, 2002 at 12:49:27PM -0400, Melvin Smith wrote: > >- Each co-routine should probably have its own interpreter. > > I'm not sure about this one. I think we can accomplish it without > the full overhead of a new interpreter. I don't understand. It should not be much more expansive t

Re: Stack and GC

2002-06-21 Thread Jerome Vouillon
On Thu, Jun 20, 2002 at 12:26:11AM -0400, Melvin Smith wrote: > Given that it seems capturing and restoring a context is the most > expensive part, should we make default routines lightweight (execute > on caller stack rather than getting their own) and only make > continuations and co-routines ta

Re: Perl6 grammar

2002-06-18 Thread Jerome Vouillon
On Mon, Jun 17, 2002 at 04:59:05PM -0400, Melvin Smith wrote: > The hole I see is not having a Perl6 grammar to toss about. > You must sift through the apoc/exe pile to formulate it. Regardless of > which approach is taken, I'd like to see a BNF style grammar floating around > before we talk tools

Re: Subs for parrot

2002-06-10 Thread Jerome Vouillon
On Sun, Jun 09, 2002 at 05:18:31PM -0400, Dan Sugalski wrote: > Who says we're only using callcc to capture continuations? We can do > it anywhere, so we potentially need the registers stored so we can > properly restore state when we're invoked. I don't understand what you mean. In scheme, ca

Re: [COMMIT] Subs and co-routines in Parrot

2002-06-09 Thread Jerome Vouillon
On Sat, Jun 08, 2002 at 02:29:53PM -0400, Dan Sugalski wrote: > There's more than just exception handlers going on the control stack. > Anything that needs rolling back or undoing (like localized variables > or scope entry) will have an undo marker put on the control stack > that gets called wh

Re: [COMMIT] Subs and co-routines in Parrot

2002-06-09 Thread Jerome Vouillon
On Sat, Jun 08, 2002 at 03:54:06PM -0400, Melvin Smith wrote: > At 02:36 PM 6/8/2002 -0400, Dan Sugalski wrote: > >At 8:15 PM +0200 6/8/02, Jerome Vouillon wrote: > >>On Sat, Jun 08, 2002 at 12:30:36PM -0400, Melvin Smith wrote: > >>> The Java VM does this by popping

Re: Subs for parrot

2002-06-09 Thread Jerome Vouillon
On Sat, Jun 08, 2002 at 02:34:19PM -0400, Dan Sugalski wrote: > Indirect function calls will take maybe 50 cycles, so I'm not worried > about their time. Compared to perl 5, that's fast. With a JIT compiler, this starts to be significant, though. > >A continuation can be invoked just like any o

Re: [COMMIT] Subs and co-routines in Parrot

2002-06-09 Thread Jerome Vouillon
On Sat, Jun 08, 2002 at 02:39:33PM -0400, Dan Sugalski wrote: > >Instead of using some space on the stack, co-routines can store all > >their local variables into their closure. Then, there is no need to > >swap in any context. > > You still need to store the stack frames created since the start

Re: [COMMIT] Subs and co-routines in Parrot

2002-06-09 Thread Jerome Vouillon
On Sat, Jun 08, 2002 at 03:35:39PM -0400, Melvin Smith wrote: > At 08:30 PM 6/8/2002 +0200, Jerome Vouillon wrote: > >Instead of using some space on the stack, co-routines can store all > >their local variables into their closure. Then, there is no need to > >swap in any con

Re: [COMMIT] Subs and co-routines in Parrot

2002-06-08 Thread Jerome Vouillon
On Fri, Jun 07, 2002 at 07:40:14PM -0400, Melvin Smith wrote: > The support isn't complete, for example, co-routines, etc. need to > swap in their own context, which right now they don't do. Instead of using some space on the stack, co-routines can store all their local variables into their closu

Re: [COMMIT] Subs and co-routines in Parrot

2002-06-08 Thread Jerome Vouillon
On Sat, Jun 08, 2002 at 12:20:55PM -0400, Melvin Smith wrote: > At 09:50 AM 6/8/2002 +0200, Jerome Vouillon wrote: > >Alternatively, I think you can just replace the definition of yield > >by: > > > >inline op yield (in INT) { > > struct Parrot_Sub * su

Re: [COMMIT] Subs and co-routines in Parrot

2002-06-08 Thread Jerome Vouillon
On Sat, Jun 08, 2002 at 12:30:36PM -0400, Melvin Smith wrote: > Right now all it [ret] does is pop the return address from the global > interpreter control stack, but continuations, etc. will have their own > control stack, so they must restore the caller's before returning. Continuations never r

Re: Subs for parrot

2002-06-08 Thread Jerome Vouillon
On Fri, Jun 07, 2002 at 01:50:27AM -0400, Dan Sugalski wrote: > So, in total, we need: > > *) Original routine entry point > *) Current routine entry point > *) Native/bytecode flag > *) Opcode table > *) Global namespace chain > *) "default" lexical scope > *) All the register sets > *) All the

Re: [COMMIT] Subs and co-routines in Parrot

2002-06-08 Thread Jerome Vouillon
On Sat, Jun 08, 2002 at 01:15:48AM -0400, Dan Sugalski wrote: > First, we need to beef up ret, but that's a problem of definition. It > should walk the control stack until it hits something it can return, > so we can undo exception handler pushes, scope change, and suchlike > things. (My proble

Re: Stack

2002-06-06 Thread Jerome Vouillon
On Wed, Jun 05, 2002 at 04:52:22PM -0400, Dan Sugalski wrote: > Could be wrong, of course. Wouldn't be the first time. I'll need more > convincing for that, though. Is this enough? :) Stack usage === First, the stack are going to be used quite heavily: we need to save all live registers

Re: Stack

2002-06-05 Thread Jerome Vouillon
On Wed, Jun 05, 2002 at 12:07:26PM -0700, Sean O'Rourke wrote: > Another thing to toss into the discussion, preferably sooner rather than > later: continuations. From what I can tell, implementing continuations > relies on having an arbitrary graph of "stack" frames, and garbage > collecting them

Stack

2002-06-05 Thread Jerome Vouillon
My feeling is that the current implementations of stacks are not adequate: - the control stacks store too many registers at once; - the generic stack is typed, so it is slow; - none of these stacks provide any support for register spilling/reload: there is no opcode to get or set the n-th ele

Re: GC Benchmarking Tests

2002-05-30 Thread Jerome Vouillon
On Wed, May 29, 2002 at 02:08:25AM -0400, Mike Lambert wrote: > gc_generations.pbc > me trying to simulate behavior which should perform exceptionally > well under a genertaional collector, even though we don't have one :) > each memory allocation lasts either > a long time, a medium time, or

Re: GC, exceptions, and stuff

2002-05-29 Thread Jerome Vouillon
On Wed, May 29, 2002 at 11:45:45AM -0500, David M. Lloyd wrote: > Dan may have been referring to the fact that on some key platforms > (Solaris included) (sig)setjmp/longjmp are officially marked as unsafe for > use inside of threads. Is it really unsafe on these platforms? - According to the Uni

Re: [netlabs #629] [PATCH] Memory manager/garbage collector -major revision

2002-05-29 Thread Jerome Vouillon
On Tue, May 28, 2002 at 11:02:05AM -0400, [EMAIL PROTECTED] wrote: > I also agree its funny we are worrying > about performance when its not apparent > the allocation overhead even has anything > to do with the current performance problem. I don't think performance is really the issue here. Rath

Re: GC, exceptions, and stuff

2002-05-29 Thread Jerome Vouillon
On Tue, May 28, 2002 at 05:47:56PM -0700, Hong Zhang wrote: > > Important given: We can *not* use setjmp/longjmp. Period. Not an > > option--not safe with threads. At this point, having considered the > > alternatives, I wish it were otherwise but it's not. Too bad for us. > > I think this stat

Re: GC Benchmarking Tests

2002-05-29 Thread Jerome Vouillon
On Wed, May 29, 2002 at 02:08:25AM -0400, Mike Lambert wrote: > gc_alloc_new.pbc > allocates more and more memory > checks collection speed, and the ability to grow the heap > > gc_alloc_reuse.pbc > allocates more memory, but discards the old > checks collection speed, and the ability to reclaim

Re: GC design

2002-05-28 Thread Jerome Vouillon
On Mon, May 27, 2002 at 08:41:59AM -0700, Sean O'Rourke wrote: > Since our memory-allocating routines return NULL quite a ways back up the > call chain (all the way through e.g. string_grow()), here's another way to > do this -- if allocation returns NULL all the way to an op function, it > can ma

Re: [netlabs #629] [PATCH] Memory manager/garbage collector -major revision

2002-05-28 Thread Jerome Vouillon
On Tue, May 28, 2002 at 07:54:49AM -0700, Robert Spier wrote: > > >#define PARROT_str_local(d)\ > > STRING * d = NULL; \ > > frame frame_##d;\ > > int dummy_##d = ( \ > > (frame_##d.ptr = &d), \ > > (

Re: [netlabs #629] [PATCH] Memory manager/garbage collector -major revision

2002-05-28 Thread Jerome Vouillon
On Tue, May 28, 2002 at 03:45:58PM +0200, Jerome Vouillon wrote: > On Tue, May 28, 2002 at 08:30:52AM -0400, Mike Lambert wrote: > > PARROT_str_params_3(a, b, c); > > What's the point of this? With rule 5 that prevents function call nesting, > > you're guarant

Re: [netlabs #629] [PATCH] Memory manager/garbage collector -major revision

2002-05-28 Thread Jerome Vouillon
On Tue, May 28, 2002 at 08:30:52AM -0400, Mike Lambert wrote: > Can you provide an implementation of the macros you described above? I > have a few concerns which I'm not sure if they are addressed. For example: #define PARROT_start() \ frame * saved_top = stack_top; > PARROT_str_loca

Re: [netlabs #629] [PATCH] Memory manager/garbage collector -major revision

2002-05-28 Thread Jerome Vouillon
On Tue, May 28, 2002 at 04:57:01AM -0700, Brent Dax wrote: > I assume the lack of mentions of Buffers are an oversight. Right. It would be great if there was only one kind of parrot objects... > # (5) do not nest function calls > #(for instance, "e = string_concat (string_concat(a, b

Re: [netlabs #629] [PATCH] Memory manager/garbage collector -major revision

2002-05-28 Thread Jerome Vouillon
I propose the following alternate guidelines. First, the code would look something like this: STRING * concat (STRING* a, STRING* b, STRING* c) { PARROT_start(); PARROT_str_params_3(a, b, c); PARROT_str_local_2(d, e); d = string_concat(a, b); e = string_concat(d, c);

Re: [netlabs #629] [PATCH] Memory manager/garbage collector -major revision

2002-05-28 Thread Jerome Vouillon
On Tue, May 28, 2002 at 04:45:06AM -0400, Mike Lambert wrote: > When you call new_*_header, the neonate > flag is automatically turned on for you. As a programmer writing a > function, you explicitly turn off the neonate flag when you attach it to > the root set, or let it die on the stack. If you

Re: [netlabs #629] [PATCH] Memory manager/garbage collector - major revision

2002-05-28 Thread Jerome Vouillon
On Mon, May 27, 2002 at 04:33:07PM -, Peter Gibbs wrote: > These changes do cause a slight performance degradation, but I believe it is > worth it for the overall simplification of transparent protection of the > newborn. > Performance can only be a secondary goal, after correct behaviour. Wh

Re: GC design

2002-05-28 Thread Jerome Vouillon
On Mon, May 27, 2002 at 08:41:59AM -0700, Sean O'Rourke wrote: > But there are two kinds of "available" here: available without asking the > operating system for more; and available period. If we're in the first > situation, it seems reasonable to just ask the OS for a new block and keep > going,

Re: Hashtable+GC problems

2002-05-27 Thread Jerome Vouillon
On Sun, May 19, 2002 at 10:43:20PM -0400, Mike Lambert wrote: [...] > But if you'll notice down below in the body, it uses > string_compare. Due to transcoding issues, that can trigger a full GC, > which means you need to restore_invariants inside that loop. And that > invalidates your 'chain' whi

Re: GC design

2002-05-27 Thread Jerome Vouillon
On Sun, May 26, 2002 at 08:20:23AM -0700, Sean O'Rourke wrote: > I'm sure it's been discussed before somewhere, but why can't we guarantee > that we only do GC runs between ops? Each op would just have to guarantee > that all of its persistent data is reachable before it returns. It seems > like

Re: Parrot and Mono / .Net

2002-05-26 Thread Jerome Vouillon
On Fri, May 24, 2002 at 09:48:13AM -0400, Melvin Smith wrote: > I hate debugging stack operations. Its one of the hardest bug's to spot > in my limited experience. For this reason I'm glad that Parrot allows me > to think in registers, not stack locations. Given, everything I've said > relates