1. 31 Mar, 2002 5 kayıt (commit)
  2. 30 Mar, 2002 13 kayıt (commit)
    • Jack Jansen's avatar
      e7f776af
    • Jack Jansen's avatar
    • Jack Jansen's avatar
      77afbc0b
    • Jack Jansen's avatar
      Modified to allow it to run in MachoPython in a reasonable way. It still · 4092606d
      Jack Jansen yazdı
      needs a decent commandline interface, though.
      4092606d
    • Tim Peters's avatar
      It's once again thought safe to call the pymalloc free/realloc with an · c2ce91af
      Tim Peters yazdı
      address obtained from system malloc/realloc without holding the GIL.
      
      When the vector of arena base addresses has to grow, the old vector is
      deliberately leaked.  This makes "stale" x-thread references safe.
      arenas and narenas are also declared volatile, and changed in an order
      that prevents a thread from picking up a value of narenas too large
      for the value of arenas it sees.
      
      Added more asserts.
      
      Fixed an old inaccurate comment.
      
      Added a comment explaining why it's safe to call pymalloc free/realloc
      with an address obtained from system malloc/realloc even when arenas is
      still NULL (this is obscure, since the ADDRESS_IN_RANGE macro
      appears <wink> to index into arenas).
      c2ce91af
    • Tim Peters's avatar
      new_arena(): In error cases, reset the number of available pools to 0. · 7b85b4aa
      Tim Peters yazdı
      Else the pymalloc malloc will go insane the next time it's called.
      7b85b4aa
    • Tim Peters's avatar
      Changed the #-of-arenas counters to uints -- no need to be insane about · 1d99af8d
      Tim Peters yazdı
      this.  But added an overflow check just in case there is.
      
      Got rid of the ushort macro.  It wasn't used anymore (it was only used
      in the no-longer-exists off_t macro), and there's no plausible use for it.
      1d99af8d
    • Tim Peters's avatar
      Eliminate DONT_SHARE_SHORT_STRINGS. · 8deda70b
      Tim Peters yazdı
      8deda70b
    • Martin v. Löwis's avatar
    • Tim Peters's avatar
    • Tim Peters's avatar
      Now that we're no longer linking arenas together, there's no need to · 3c83df20
      Tim Peters yazdı
      waste the first pool if malloc happens to return a pool-aligned address.
      
      This means the number of pools per arena can now vary by 1.  Unfortunately,
      the code counted up from 0 to a presumed constant number of pools.  So
      changed the increasing "watermark" counter to a decreasing "nfreepools"
      counter instead, and fiddled various stuff accordingly.  This also allowed
      getting rid of two more macros.
      
      Also changed the code to align the first address to a pool boundary
      instead of a page boundary.  These are two parallel sets of macro #defines
      that happen to be identical now, but the page macros are in theory more
      restrictive (bigger), and there's simply no reason I can see that it
      wasn't aligning to the less restrictive pool size all along (the code
      only relies on pool alignment).
      
      Hmm.  The "page size" macros aren't used for anything *except* defining
      the pool size macros, and the comments claim the latter isn't necessary.
      So this has the feel of a layer of indirection that doesn't serve a
      purpose; should probably get rid of the page macros now.
      3c83df20
    • Tim Peters's avatar
      Retract the claim that this is always safe if PyMem_{Del, DEL, Free, FREE} · 12300686
      Tim Peters yazdı
      are called without the GIL.  It's incredibly unlikely to fail, but I can't
      make this bulletproof without either adding a lock for exclusion, or
      giving up on growing the arena base-address vector (it would be safe if
      this were a static array).
      12300686
    • Tim Peters's avatar
      Lots of changes: · d97a1c00
      Tim Peters yazdı
      + A new scheme for determining whether an address belongs to a pymalloc
        arena.  This should be 100% reliable.  The poolp->pooladdr and
        poolp->magic members are gone.  A new poolp->arenaindex member takes
        their place.  Note that the pool header overhead doesn't actually
        shrink, though, since the header is padded to a multiple of 8 bytes.
      
      + _PyMalloc_Free and _PyMalloc_Realloc should now be safe to call for
        any legit address, whether obtained from a _PyMalloc function or from
        the system malloc/realloc.  It should even be safe to call
         _PyMalloc_Free when *not* holding the GIL, provided that the passed-in
        address was obtained from system malloc/realloc.  Since this is
        accomplished without any locks, you better believe the code is subtle.
        I hope it's sufficiently commented.
      
      + The above implies we don't need the new PyMalloc_{New, NewVar, Del}
        API anymore, and could switch back to PyObject_XXX without breaking
        existing code mixing PyObject_XXX with PyMem_{Del, DEL, Free, FREE}.
        Nothing is done here about that yet, and I'd like to see this new
        code exercised more first.
      
      + The small object threshhold is boosted to 256 (the max).  We should
        play with that some more, but the old 64 was way too small for 2.3.
      
      + Getting a new arena is now done via new function new_arena().
      
      + Removed some unused macros, and squashed out some macros that were
        used only once to define other macros.
      
      + Arenas are no longer linked together.  A new vector of arena base
        addresses had to be created anyway to make address classification
        bulletproof.
      
      + A lot of the patch size is an illusion:  given the way address
        classification works now, it was more convenient to switch the
        sense of the prime "if" tests in the realloc and free functions,
        so the "if" and "else" blocks got swapped.
      
      + Assorted minor code, comment and whitespace cleanup.
      
      Back to the Windows installer <wink>.
      d97a1c00
  3. 29 Mar, 2002 22 kayıt (commit)