develooper Front page | perl.perl6.internals | Postings from July 2002

[COMMIT] Parrot_Context

Thread Next
From:
Melvin Smith
Date:
July 4, 2002 14:11
Subject:
[COMMIT] Parrot_Context
Message ID:
5.1.0.14.2.20020704164305.034733c8@pop.mindspring.com
I added the Parrot_Context struct and inlined all regs and stacks
into it. The save/restore context routines simply copy it in 1 swoop.

Since context switches are not the norm (and register/stack accesses _are_)
we decided to use a memcpy to switch them rather than using a
pointer to a context. Using a pointer would slow down the common cases
of access due to an extra dereference.

    interpreter->ctx->int_reg.registers

and would also kill the current JIT design.

So we end up:

    interpreter->int_reg.registers[0]
    interpreter->user_stack

changes to:

    interpreter->ctx.int_reg.registers[0]
    interpreter->ctx.user_stack

Also, keep in mind, save_context currently sets COW on stacks, and
will eventually do the same for register frames.

This is only important for co-routines and continuations. Common subs
shouldn't need to switch in their own context.

[large patch omitted, see cvs-parrot@perl.org]

-Melvin


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About