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
Newsgroups: perl.perl6.internals
From: bk...@cornell.edu (Benjamin K. Stuhl)
Date: Thu, 22 Jan 2004 22:37:13 -0500
Local: Thurs, Jan 22 2004 10:37 pm
Subject: Re: Vtables organization
Dan Sugalski wrote: [sniping to reduce verbiage] >> The issue is that the PMC's original vtable assumes (and should, IMHO Yes, that's what I meant by the original vtable. :-) >> be _able_ to assume) that it has total control over the PMC's data, > Well... I think I'll disagree here. The *class* vtable can assume this. > In addition to the thread autolocking front end and debugging front end Going back to the idea of generating these vtables on the fly (and caching > vtable functions, both of which can be generic, there's the potential > for tracing and auditing front end functions, input data massaging > wrappers, and all manner of Truly Evil front (and back) end wrappers > that don't need to actually access the guts of the PMC, but can instead > rely on the other vtable functions to get the information that they need > to operate. > Not that this necessarily mandates passing in the vtable pointer to the them): each instance of a vtable gets a void* closure in the vtable itself, so at a certain expense in extra vtables, one could hang a structure off of that that includes a pointer to the original vtable. E.g. (pseudo-code) if (we don't have a tracing PerlInt in our cache) { } TraceVtable::get_number(INTERP, self) { FLOATVAL f; // I don't have the headers in front of me to get the right field names... VTABLE *my_vtbl = self->vtable; VTABLE *old_vtbl = my_vtbl->private; self->vtable = old_vtbl; return f; } With slightly more complicated closures, most of the listed uses can use this method. It's memory-heavy, but not too bad if we need a fair number of PMCs of each wrapped type and the cost gets amortized over them. And this does save an argument to every PMC function and just makes the wrapping classes pay. Where it's suboptimal is for classes like autolocking that really want a closure of their own on every PMC. But then again, that would again probably get into issues of data collisions (except for locking, which has its own reserved area). Just some thoughts. -- BKS 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.
| ||||||||||||||