Brandt Bucher <brandtbuc...@gmail.com> added the comment:

Ah, never mind, I think I understand what you meant. Special methods get 
0x0001-0xFFFF, all other functions get 0x00010000-0xFFFFFFFF. So we use 16-bit 
versions for special method caches, and 32-bit versions for normal call caches. 
"super().__init__()" and "object.__new__()" will specialize correctly, since 
special method versions are also valid function versions.

This seems like a solid idea, then, provided that we're reasonably confident 
this will actually improve real code. I guess the case this optimizes for is a 
program that specializes more than 2**16 normal calls, *then* tries to 
specialize a 2**16 special method calls? Seems uncommon, but not impossible.

(I think there might be a weird edge-case where a function is specialized first 
as a normal function, *then* as a special method. I imagine we just reassign it 
a special method version and continue as normal in that case, though.)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46097>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to