PMCs use Vtables for almost all their functionality *and* for stuff that in Perl5 term is "magic" (or they should AFAIK).

E.g. setting the "_ro" property of a PMC (that supports it[1]) swaps in the Const$PMC vtable, where all vtable methods that would change the PMC thrown an exception.
Or: setting a PMC shared, whould swap in a vtable, that locks e.g. internal aggregate state on access. That is a non-shared PMC doesn't suffer of any locking slowdown.
Tieing will very likely swap in just another vtable and so on.


The questions are:
- Where and how should we store these vtables?
- Are these PMC variants distinct types (with class_enum and name)
- Or are these sub_types (BTW what is vtable->subtype)? E.g. hanging off from the "main" vtable?


Comments welcome,
leo


[1] This still needs more work: Real constant PMCs are allocated in a separate arena which isn't scanned during DOD, *but* all items, that the PMC may refer too have to be constant too, including Buffers it may use. But swapping in the vtable is working.




Reply via email to