Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion COWed stack bug (was: IMCC - PerlArray getting trounced)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Leopold Toetsch  
View profile  
 More options Jan 28 2004, 3:48 pm
Newsgroups: perl.perl6.internals
From: l...@toetsch.at (Leopold Toetsch)
Date: Wed, 28 Jan 2004 10:00:54 +0100
Local: Wed, Jan 28 2004 4:00 am
Subject: COWed stack bug (was: IMCC - PerlArray getting trounced)

Will Coleda wrote:
> Well, that was festive. "I can reproduce that bug in 22 lines!"

Great.

The bug (and other reported curruptions) are definitely coming from the
COW logic in register.c. This is what happens:

Setting up the exception handler (which is a continuation) triggers COW
setting of the register stacks. Then on first subroutine return from
__inner, the register stack is unCOWed (the chunk is copied). When then
returning from __outer stack->top->used is still 2 end the same chunk
gets popped off the stack, because the interpreter's stack is still
unchanged.

The register restoring memcpy is the same *twice*:

memcpy (dstpp=0x824ca50, srcpp=0x4017d9a0, len=64)

So returning from __outer places P17 (the RetContinuation of __inner) in
mains registers and ruins the PerlUndef that you wanted to print.

> :get_string() not implemented in class 'RetContinuation'

... which then causes this error.

Just returning from mark_register_stack_cow() makes the bug vanish

(but doesn't fix anything)

As mentioned several times, a COWed buffer needs distinct buffer headers
and shared buffer memory. The current implementation in register *and*
other stacks is broken. *Fixes welcome*.

You can currently avoid the bug by not using Continuations and Exception
Handlers.

Thanks for your test program,
leo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.