greedom has quit [Remote host closed the connection]
rb has joined #pypy
<rb>
hey there! i was interested in how pypy stores values like integers, object references etc. in memory. where in the source code do you recommend i should look?
<Corbin>
Huh, weird RPython quirk. How do I declare a method as a standalone function (say, because it's some higher-order NOT_RPYTHON generator) an then import the function a a method into a class?
<Corbin>
I had tried using type() to build the class, but that doesn't seem to work.
<Corbin>
I'm trying something like `def build(inst): return lambda self: self.insts.append(inst)` and getting an error like https://bpa.st/BUOQ
<rb>
Corbin: thanks!
<Corbin>
rb: No worries. Maps aren't the whole story, so please feel free to ask followup questions for more details.
greedom has joined #pypy
<rb>
Corbin: hahaha, maps of course!
<rb>
the reason i asked is that i am working on an implementation of self, and was kind of stuck on how to use a value type to represent doubles while also preserving my 62-bit integers
<rb>
so i'm trying to get "inspired"
<rb>
it seems like everything comes back to self, eventually. v8, pypy, et al.
<Corbin>
rb: Ah. The RPython toolchain supports tagged pointers, and the documentation specifically mentions Smalltalk as a family which could benefit from it. But even in that case, I gather that folks box doubles.
<Corbin>
This could be because RPython JITs normally have no trouble unboxing.
<rb>
yeah, that's fair. i was thinking of swapping the exponent and mantissa of a double, and then reserving 2 bits of the exponent to have a "reduced range" double, but that seems like it would be way too slow in practice
<rb>
so i'll probably just have a boxed double as well, with the actual double residing in byte array segment
<Corbin>
Cool idea, though.
<rb>
right, a problem that someone had mentioned is what happens when nan :P
<rb>
i don't want to create my own ieee754 spinoff, so i shelved that idea
<mattip>
rb: see rpython/rlib/rstruct/ieee.py for some conversion routines
<rb>
cheers
greedom has quit [Remote host closed the connection]