These are chat archives for dropbox/pyston

23rd
Mar 2015
Marius Wachtler
@undingen
Mar 23 2015 15:18
should the gc handler of BoxedClassobj and BoxedInstance call GCVisitor::visit on the bases, name, and inst_cls (maybe also on the HCAttrs attrs)?
Chris Toshok
@toshok
Mar 23 2015 19:41
i would think so, yeah
so, interp2.py does a ton of string allocations, with many, many of them corresponding to string literals in the python code
“visit_” is allocated anew every time we enter visit(), for instance
we could have a table per module of string literals. either populated lazily or created at module load time. as long as the module’s alive, the string literals would be alive. then all references to those string literals could be replaced with module->getStringLiteral(literal_id)
Chris Toshok
@toshok
Mar 23 2015 19:47
or, probably module->getStringLiteral(literal_id, “visit_”) in the lazy case. We probably wouldn’t have to worry about interning them. we’d still be saving orders and orders of magnitude even if “visit_” were used 1000 times in interp2.py
setting a bp on strAdd shows a different lhs pointer (always “visit_”), and 10000 hits of that breakpoint only has gotten the output up to 97. (it goes to 4999)
Travis Hance
@tjhance
Mar 23 2015 19:50
would it make sense to do it do the AST level, and just give every string literal node a BoxedString*?
or is the intent to not limit us to string literals that actually appear in the source?
Chris Toshok
@toshok
Mar 23 2015 19:54
oh I was just thinking of string literals that appear. that would work, as long as they’re rooted to the module
trying to figure out where the actual boxString call is inserted by the jit. I’ve found the STR_CONSTANT ValuedCompilerType<> instantiation
Kevin Modzelewski
@kmod
Mar 23 2015 20:31
oh, yeah I was thinking they could be put on the CompiledFunction, but that would mean we would have to start involving those in the GC system
but the modules already are so it sounds easier to store them there
I guess we'll have to start getting careful to not free the module if any of the functions in it are getting used
but I think we don't free modules right now :)
Chris Toshok
@toshok
Mar 23 2015 20:52
another optimization that might be generally useful and definitely would be for interp is destructively updating a box used for a temp
hm, actually that wouldn’t work for interp (if we’re colocating strings data with the boxedstring)