1. 06 May, 2016 3 commits
  2. 04 May, 2016 6 commits
    • Kevin Modzelewski's avatar
    • Kevin Modzelewski's avatar
      Switch GCArray to PyObject_Malloc · 8618e750
      Kevin Modzelewski authored
      8618e750
    • Kevin Modzelewski's avatar
      Avoid allocations in pyElements() · 67943c23
      Kevin Modzelewski authored
      I had added an allocation to deal with the requirements refcounting
      added.  To remove that allocation, I added a "SmallUniquePtr" class
      which is similar to unique_ptr but it allocates the object in-line.
      
      It's a bit tricky to use since if the containing object gets moved around
      then the pointers become invalid.
      67943c23
    • Kevin Modzelewski's avatar
      Add RewriterVar::replaceAttr() · 27b94e48
      Kevin Modzelewski authored
      Previously, to replace a refcounted object in memory, we would do something like
      
      array->getAttr(offset)->setType(OWNED);
      array->setAttr(offset, new_val);
      
      The problem is that this ends up emitting something like
      x = array[offset];
      Py_DECREF(x);
      array[offset] = new_val;
      
      which is not safe, since x can have a destructor that runs.
      In this particular case, the destructor changed the value of array[offset].
      
      It's actually pretty hard to get the right behavior (decref after setting the
      new value) from outside the rewriter class, so add a new replaceAttr that does
      these steps.
      27b94e48
    • Kevin Modzelewski's avatar
      Add some lifetime information to temporaries in the cfg · ca2ed310
      Kevin Modzelewski authored
      By adding a 'is_kill' flag to AST_Name nodes, which say that
      this is the last use of this name.  This handles some common cases
      of keeping temporaries alive for too long.
      
      For some rare cases, there is no AST_Name that is a last use:
      for example, the iterator object of a for loop is live after
      every time it is used, but dies when exiting the loop.
      
      For those, we insert a `del #foo` instead.
      
      The interpreter and bjit use these flags to remove temporaries
      from the vregs.
      
      The LLVM jit ignores them since it has its own way of handling
      lifetime.  It ignores any `del` statements on temporary names
      as an optimization.
      
      This does not handle decref'ing temporaries on an exception.
      ca2ed310
    • Kevin Modzelewski's avatar
      Minor: mark these as noexcept · ae919c9f
      Kevin Modzelewski authored
      ae919c9f
  3. 03 May, 2016 2 commits
  4. 02 May, 2016 9 commits
  5. 01 May, 2016 1 commit
  6. 29 Apr, 2016 9 commits
  7. 28 Apr, 2016 8 commits
    • Kevin Modzelewski's avatar
      Trying an optimization · 5247cb08
      Kevin Modzelewski authored
      I think I don't quite understand the existing optimization so just
      turn my new one off for now.
      5247cb08
    • Kevin Modzelewski's avatar
      Re-enable the "block-local" bjit optimization · eb3a0fe4
      Kevin Modzelewski authored
      Also fix the is_live handling and make the get and set
      cases look more similar to each other.
      eb3a0fe4
    • Kevin Modzelewski's avatar
      Fix deinitFrame on deopt · c079bc47
      Kevin Modzelewski authored
      Our convention is that on deopt, the callee is responsible for calling deinitFrame().
      This is tricky, since for OSR our convention is the opposite, that the caller calls deinitFrame().
      
      This means that if we OSR and then deopt(), the top and bottom frames both think they should call
      deinitFrame() (since one is the caller of an OSR and the other is the callee of a deopt).
      
      This commit fixes + extends the "disable deinitFrame for this frame" approach we kind of had.
      For performance, deinitFrame() stays the same, but any site that might have its deinitFrame disabled
      (namely, in the interpreter), it should call deinitFrameMaybe() instead.
      c079bc47
    • Kevin Modzelewski's avatar
      Don't create Register decref-info entries · f1c12342
      Kevin Modzelewski authored
      They might be ok if we allowed allocating callee-save registers, but
      since we don't, they mean we are asking the unwinder to restore a
      clobbered register.
      
      This was happening in some places where we didn't call setupCall()
      before calling a function.  This was previously ok since those cases would
      always throw an exception and nothing would want the values of the
      then-clobbered registers.
      f1c12342
    • Kevin Modzelewski's avatar
      Rewriter setattr checking · 4aaaa6f2
      Kevin Modzelewski authored
      A kind-of hacky way of identifying places that do unsafe (for refcounting)
      setattrs.  When calling RewriterVar::setattr() with an owned reference,
      you need to either promise to call refUsed() or refConsumed() afterwards.
      4aaaa6f2
    • Kevin Modzelewski's avatar
      Fix some bjit/rewriter crashes · a9b95959
      Kevin Modzelewski authored
      Need a 'refUsed()' function like we have in the llvm jit, for when we pass args
      through an args array.
      a9b95959
    • Marius Wachtler's avatar
      generate a decref info table and fix the bjit · 61dc4620
      Marius Wachtler authored
      we need this map to know which object refcounter we have to decrement in case an exception gets throwen inside an IC or the bjit.
      in addition fix all bjit related problems
      61dc4620
    • Marius Wachtler's avatar
      move Location from rewriter.h to types.h · 4eb5b941
      Marius Wachtler authored
      4eb5b941
  8. 22 Apr, 2016 2 commits