use dynamic trampoline for all getters and setters#3029
Conversation
43d7554 to
0acca88
Compare
0acca88 to
aeb7c29
Compare
aeb7c29 to
1ea57cb
Compare
|
Ok, I've pushed a commit which removes the use of I've added some TODO where we could add some validation that only one |
I think this is no longer a disadvantage, as I've added the "name" and "doc" members to this too, which addresses an older TODO to avoid naively leaking those things. |
|
bors r+ |
|
Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
This is an extension to the "trampoline" changes made in #2705 to re-use a single trampoline for all
#[getter]s (and similar for all#[setters]). It works by setting the currently-unusedclosuremember of theffi::PyGetSetDefstructure to point at a newstruct GetSetDefClosurewhich contains function pointers to thegetter/setterimplementations.A universal trampoline for all
getter, for example, then works by reading the actual getter implementation out of theGetSetDefClosure.Advantages of doing this:
test_getter_settergenerated size, which is an exaggerated result as most code will probably have lots of bulk that isn't just the macro code.Disadvantages:
getterandsettertrampolines and accompanying code.GetSetDefClosureobjects alive, I've added them to the staticLazyTypeObjectinner.Overall I'm happy to either merge or close this based on what reviewers think!