1. 06 May, 2016 17 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 5 commits
    • Kevin Modzelewski's avatar
      Some test notes · b92bd743
      Kevin Modzelewski authored
      b92bd743
    • Kevin Modzelewski's avatar
      Add missing refcounting annotation · 30ee1b09
      Kevin Modzelewski authored
      30ee1b09
    • Kevin Modzelewski's avatar
      Fix some dict behavior · 4a5d4a76
      Kevin Modzelewski authored
      Large dict literals would crash the bjit since it would try to allocate
      scratch space to store all of the keys+values on the stack.
      
      This is also, in a small way, detectable to the user, since we would evaluate
      all subexpressions before doing any dict operations (which could trigger
      __hash__ and __eq__ calls).  I started working on this, but it looks
      like it's not just an issue in the JIT tiers, but it's also encoded in
      the CFG phase as well.  Punting on that for now since it's not a refcounting issue.
      4a5d4a76
    • Kevin Modzelewski's avatar
      Merge pull request #1144 from kmod/bjit · 6cdbb2a3
      Kevin Modzelewski authored
      Fix + reenable the bjit
      6cdbb2a3
    • Kevin Modzelewski's avatar
      Remove some duplicated refUsed annotations · 42804b7f
      Kevin Modzelewski authored
      - I think I've finally convinced myself that a refConsumed() annotation
        automatically includes a refUsed annotation as well.  Or rather, that if you
        call refConsumed, the refcounter won't try to add a decref anyway.
      - emitCallWithAllocatedArgs already does the equivalent of refUsed() on its `additional_uses`
        argument.
      42804b7f