tekknolagi / skybison

A fork of Instagram's experimental performance oriented greenfield implementation of Python. It features small objects; a moving GC; hidden classes; bytecode inline caching; type-specialized bytecode; an experimental template JIT.
Other
38 stars 3 forks source link

Add opcode to check for returning `None` in `__init__` #515

Open tekknolagi opened 1 year ago

tekknolagi commented 1 year ago

https://github.com/python/cpython/compare/main...faster-cpython:cpython:specialize-calls-to-python-classes

This is "easy" for normal def __init__ but harder for __init__ = x and ty.__init__ = x because you have to hook and re-instrument or something.

tekknolagi commented 1 year ago

Unless---oops---it actually puts that opcode after CALL_FUNCTION to type, instead of inside the method

tekknolagi commented 1 year ago

Oh it's a shim frame, neat

tekknolagi commented 1 year ago

I wonder how we could push that frame very fast without doing the sort of static-alloc and pointer link thing they do in CPython

tekknolagi commented 1 year ago

https://github.com/python/cpython/commit/04492cbc9aa45ac2c12d22083c406a0364c39f5b