These are chat archives for dropbox/pyston

26th
Nov 2015
Marius Wachtler
@undingen
Nov 26 2015 10:00
I will jump in and give try to answer your questions until @kmod is around:
  1. We try to be as compatible as possible so we corrently don't have list of things where we think we don't need to be compatible. For example currently we use a GC instead of refcounting as pypy does. And it turned out that while from a python point thats fine it causes a lot of small differences to cpython (see pypys http://doc.pypy.org/en/latest/cpython_differences.html#differences-related-to-garbage-collection-strategies) so we might switch back to refcounting.
  2. Take for example a look at nonzero which is a easy example https://github.com/dropbox/pyston/blob/master/src/runtime/objmodel.cpp#L2512
    all the code which operates on a rewriter inside this function/file is our tracing stuff. For example if we want to create an IC for nonzero(int) we will first add a guard which makes sure the class stays the same addAttrGuard and than we are adding code to extract the int value out of the object convert it o a boolean value and return it.
    if (obj->cls == int_cls) {
        if (rewriter.get()) {
            RewriterVar* n = r_obj->getAttr(offsetof(BoxedInt, n), rewriter->getReturnDestination());
            RewriterVar* b = n->toBool(rewriter->getReturnDestination());
            rewriter->commitReturning(b);
        }
Xavier Combelle
@xcombelle
Nov 26 2015 11:03
@undingen so manual anotation is pure C code ?
Marius Wachtler
@undingen
Nov 26 2015 11:04
yes it's pure manually written c++ code
as kmod mentioned this makes it quite hard to write but has the benefit that we can generated the best code for a particular operation because of the flexibility we have
Marius Wachtler
@undingen
Nov 26 2015 11:10
but most of the traces are longer than the code I posted because they involve attribute lookups & calls... so the example a both is a quite uncommon case for a trace...