On Apr 30, 2008, at 10:58 PM, Marvin Humphrey wrote:

There's one significant problem left that I'm aware of: Perl's SUPER mechanism is broken with the vtable override.

The solution, I believe, is to have the XS bindings not invoke via the vtable, but instead invoke the implementing function directly. Unfortunately, that means a lot more binding code, because each override requires its own binding.


I finally got around to implementing this, and it turns out to have been surprisingly easy. The commit diff was only 137 lines long.

http://www.rectangular.com/pipermail/kinosearch-commits/2008-June/001277.html

The size of the autogenerated binding file, KinoSearch.xs, went from 13442 to 18401 lines. On my Core 2 Duo MacBook Pro, compile time increased from about 15 to 20 seconds for that file, and from about 55 to 60 seconds for all of KS. That's perfectly acceptable, and a smaller increase than I'd expected.

The behavior of vtable methods is now virtually indistinguishable from that of native Perl methods from the point of view of the library user. The only difference is that because the vtable pointers for subclasses are set when the DynamicVirtualTable object is created (the first time it is needed by a new object), dynamically generated methods created after that time won't trigger an override. That's an esoteric use case, and I don't think it's even worth mentioning in the documentation.

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/

Reply via email to