1. 10 Jun, 2015 1 commit
    • Man Cao's avatar
      Add allocation stack traces for HPROF dump. · 8c2ff641
      Man Cao authored
      This feature is currently only enabled when DDMS's allocation tracking
      is enabled. In the future there should be a way to enable this feature
      before an application starts.
      
      Also updates DDMS's recent allocation tracking to use a new backend
      data structure that is shared with this feature.
      
      The following system properties controls customizable parameters:
      dalvik.vm.allocTrackerMax: max number of objects that have allocation
                                 records, default 512K;
      
      dalvik.vm.recentAllocMax:  max number of records that are sent to DDMS
                                 when clicking "Get allocation" button,
                                 default 64K-1 (limit of the protocol);
      
      dalvik.vm.allocStackDepth: max number of stack frames in an allocation
                                 record, default 4.
      
      Bug: 20037135
      Change-Id: I26ed378a5613678bd3c43e846025f90470a8e059
      8c2ff641
  2. 30 May, 2015 1 commit
    • Mathieu Chartier's avatar
      Move mirror::ArtMethod to native · e401d146
      Mathieu Chartier authored
      Optimizing + quick tests are passing, devices boot.
      
      TODO: Test and fix bugs in mips64.
      
      Saves 16 bytes per most ArtMethod, 7.5MB reduction in system PSS.
      Some of the savings are from removal of virtual methods and direct
      methods object arrays.
      
      Bug: 19264997
      Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d
      e401d146
  3. 26 May, 2015 1 commit
    • Vladimir Marko's avatar
      ART: Clean up arm64 kNumberOfXRegisters usage. · 80afd020
      Vladimir Marko authored
      Avoid undefined behavior for arm64 stemming from 1u << 32 in
      loops with upper bound kNumberOfXRegisters.
      
      Create iterators for enumerating bits in an integer either
      from high to low or from low to high and use them for
      <arch>Context::FillCalleeSaves() on all architectures.
      
      Refactor runtime/utils.{h,cc} by moving all bit-fiddling
      functions to runtime/base/bit_utils.{h,cc} (together with
      the new bit iterators) and all time-related functions to
      runtime/base/time_utils.{h,cc}. Improve test coverage and
      fix some corner cases for the bit-fiddling functions.
      
      Bug: 13925192
      Change-Id: I704884dab15b41ecf7a1c47d397ab1c3fc7ee0f7
      80afd020
  4. 03 May, 2015 1 commit
  5. 01 May, 2015 1 commit
  6. 22 Apr, 2015 1 commit
    • Mathieu Chartier's avatar
      Replace NULL with nullptr · 2cebb24b
      Mathieu Chartier authored
      Also fixed some lines that were too long, and a few other minor
      details.
      
      Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
      2cebb24b
  7. 11 Mar, 2015 1 commit
  8. 23 Jan, 2015 1 commit
  9. 02 Dec, 2014 1 commit
  10. 01 Dec, 2014 1 commit
  11. 30 Sep, 2014 1 commit
    • Andreas Gampe's avatar
      ART: Fix some -Wpedantic errors · c8ccf68b
      Andreas Gampe authored
      Remove extra semicolons.
      
      Dollar signs in C++ identifiers are an extension.
      
      Named variadic macros are an extension.
      
      Binary literals are a C++14 feature.
      
      Enum re-declarations are not allowed.
      
      Overflow.
      
      Change-Id: I7d16b2217b2ef2959ca69de84eaecc754517714a
      c8ccf68b
  12. 13 Sep, 2014 1 commit
  13. 21 Aug, 2014 2 commits
    • Mathieu Chartier's avatar
      Check pending exception result in AllocObjectWithAllocator. · 8e705191
      Mathieu Chartier authored
      Possible previous bug:
      Allocation fails due to OOM and the collector transitions.
      This caused us to incorrectly retry the allocation with a pending
      exception. We now return null if there is a pending exception.
      
      Bug: 17164348
      
      (cherry picked from commit 27f5ae83)
      
      Change-Id: I8e7ecafbade7f0b955812df3dd7c94fdc696c856
      8e705191
    • Mathieu Chartier's avatar
      Check pending exception result in AllocObjectWithAllocator. · 27f5ae83
      Mathieu Chartier authored
      Possible previous bug:
      Allocation fails due to OOM and the collector transitions.
      This caused us to incorrectly retry the allocation with a pending
      exception. We now return null if there is a pending exception.
      
      Bug: 17164348
      Change-Id: I22eab472afb2fdea6e800963ccb35ec0755ba0e6
      27f5ae83
  14. 14 Jul, 2014 2 commits
    • Mathieu Chartier's avatar
      Fix infinite loop when calling SetStatus after OOM. · 59fe711f
      Mathieu Chartier authored
      There was a problem where we would call SetStatus when we had an OOM
      error. This results in attempting to find the ExceptionInInitializer
      class which if not loaded does more allocations resulting in an
      infinite loop.
      
      Also some cleanup addressing other comments.
      
      Bug: 16082350
      
      (cherry picked from commit fd22d5ba)
      
      Change-Id: Ie291eb0f52ba9c63f24591fae691dd9f393e6ccb
      59fe711f
    • Mathieu Chartier's avatar
      Fix infinite loop when calling SetStatus after OOM. · fd22d5ba
      Mathieu Chartier authored
      There was a problem where we would call SetStatus when we had an OOM
      error. This results in attempting to find the ExceptionInInitializer
      class which if not loaded does more allocations resulting in an
      infinite loop.
      
      Also some cleanup addressing other comments.
      
      Bug: 16082350
      Change-Id: I5c1e638a03ddf700ab4e9cad9a3077d2b1b26c43
      fd22d5ba
  15. 11 Jul, 2014 1 commit
    • Mathieu Chartier's avatar
      Faster TLAB allocator. · 14cc9be4
      Mathieu Chartier authored
      New TLAB allocator doesn't increment bytes allocated until we allocate
      a new TLAB. This increases allocation performance by avoiding a CAS.
      
      MemAllocTest:
      Before GSS TLAB: 3400ms.
      After GSS TLAB: 2750ms.
      
      Bug: 9986565
      
      Change-Id: I1673c27555330ee90d353b98498fa0e67bd57fad
      14cc9be4
  16. 02 Jun, 2014 1 commit
    • Tim Murray's avatar
      DO NOT MERGE · ffddfdf6
      Tim Murray authored
      Merge ART from AOSP to lmp-preview-dev.
      
      Change-Id: I0f578733a4b8756fd780d4a052ad69b746f687a9
      ffddfdf6
  17. 23 May, 2014 1 commit
    • Mathieu Chartier's avatar
      Add reserve area to allocation stacks. · c179016f
      Mathieu Chartier authored
      This fixes an issue with heap verification which was caused when
      the allocation stack overflowed. This resulted in heap verification
      failures since we were storing the newly allocated object in a
      handle scope without having it be live either in the live bitmap
      or allocation stack. We now push the object in the reserve area
      before we do a GC due to allocation stack overflow.
      
      Change-Id: I83b42c4b3250d7eaab1b49e53066e21c8656a740
      c179016f
  18. 21 May, 2014 1 commit
  19. 13 May, 2014 1 commit
    • Mathieu Chartier's avatar
      Add Handle/HandleScope and delete SirtRef. · eb8167a4
      Mathieu Chartier authored
      Delete SirtRef and replaced it with Handle. Handles are value types
      which wrap around StackReference*.
      
      Renamed StackIndirectReferenceTable to HandleScope.
      
      Added a scoped handle wrapper which wraps around an Object** and
      restores it in its destructor.
      
      Renamed Handle::get -> Get.
      
      Bug: 8473721
      
      Change-Id: Idbfebd4f35af629f0f43931b7c5184b334822c7a
      eb8167a4
  20. 03 Apr, 2014 1 commit
    • Hiroshi Yamauchi's avatar
      Fix Object::Clone()'s pre-fence barrier. · 4cd662e5
      Hiroshi Yamauchi authored
      Pass in a pre-fence barrier object that sets in the array length
      instead of setting it after returning from AllocObject().
      
      Fix another potential bug due to the wrong default pre-fence barrier
      parameter value. Since this appears error-prone, removed the default
      parameter value and make it an explicit parameter.
      
      Fix another potential moving GC bug due to a lack of a SirtRef.
      
      Bug: 13097759
      Change-Id: I466aa0e50f9e1a5dbf20be5a195edee619c7514e
      4cd662e5
  21. 01 Apr, 2014 1 commit
  22. 20 Mar, 2014 1 commit
  23. 15 Mar, 2014 1 commit
    • Hiroshi Yamauchi's avatar
      Use the card table to speed up the GSS collector. · 38e68e99
      Hiroshi Yamauchi authored
      Scan only dirty cards, as opposed to the whole space, to find
      references from the non-moving spaces to the bump pointer spaces at
      bump pointer space only collections.
      
      With this change, the Ritz MemAllocTest speeds up by 8-10% on host and
      2-3% on N4. The Ritz EvaluateFibonacci speeds up by 8% and its average
      pause time is reduced by 43% on N4.
      
      Bug: 11650816
      Change-Id: I1eefe75776bc37e24673b301ffa65a25f9bd4cde
      38e68e99
  24. 11 Mar, 2014 1 commit
    • Hiroshi Yamauchi's avatar
      Put the post zygote non-moving space next to the malloc space. · 5ccd498d
      Hiroshi Yamauchi authored
      This change fixes the following problem with the GSS collector: if the
      post zygote non-moving space happens to be located after the bump
      pointer spaces, the bump pointer space is treated wrongfully as an
      immune space. The reasons are 1) the immune space is represented by a
      simple address range and 2) the GSS collector treats the post zygote
      non-moving space as an immune space at a bump pointer space only
      collection.
      
      In addition, this change makes it a reality that all the non-moving
      spaces are adjacent, which we tend to assume in the code (eg. the
      notion of the immune space represented by a simple address range.)
      This should help avoid potential confusions in the future.
      
      Fix a DCHECK failure where usable_size isn't set properly when
      -XX:UseTLAB is used.
      
      Change-Id: I585920e433744a390f87e9a25bef6114b2a4623f
      5ccd498d
  25. 07 Mar, 2014 2 commits
    • Mathieu Chartier's avatar
      Add more VerifyObject calls. · c645f1dd
      Mathieu Chartier authored
      Added verify object calls to SirtRef, IndirectReferenceTable,
      ReferenceTable.
      
      Removed un-needed verify object in ScopedObjectAccess / DecodeJObject
      since object sources are handled.
      
      Bug: 12934910
      Change-Id: I55a46a8ea61fed2a77526eda27fd2cce97a9b125
      c645f1dd
    • Mathieu Chartier's avatar
      Restore obj after RequestConcurrentGC. · f517f1a9
      Mathieu Chartier authored
      RequestConcurrentGC can cause thread suspension, this means that
      another thread could transition the heap or cause moving GC.
      
      Bug: 12934910
      
      Change-Id: I5c07161e2e849d7acbdf939f1c24e1ba361a1d6a
      f517f1a9
  26. 27 Feb, 2014 3 commits
    • Mathieu Chartier's avatar
      Enable large object space for command line runs. · bd0a6533
      Mathieu Chartier authored
      Added a dynamic large_object_threshold_ variable which is max int
      when the large object space is disabled.
      
      No longer clear timing logger timings after zygote creation since
      it is not required and removes the boot semispace timings.
      
      Change-Id: I693865f4699cc32381199377239854c6ec42f37e
      bd0a6533
    • Ian Rogers's avatar
      Ensure usable space data is zeroed in arrays. · a55cf41c
      Ian Rogers authored
      Address other outstanding review comments.
      
      Change-Id: Iaffe04de080772a0d0c5fd973bcac0e23c8c3e25
      a55cf41c
    • Ian Rogers's avatar
      Make allocations report usable size. · 6fac4475
      Ian Rogers authored
      Work-in-progress to allow arrays to fill usable size. Bug: 13028925.
      Use C++11's override keyword on GCC >= 2.7 to ensure that we override GC and
      allocator methods.
      Move initial mirror::Class set up into a Functor so that all allocated objects
      have non-zero sizes. Use this property to assert that all objects are never
      larger than their usable size.
      Other bits of GC related clean-up, missing initialization, missing use of
      const, hot methods in .cc files, "unimplemented" functions that fail at
      runtime in header files, reducing header file includes, move valgrind's space
      into its own files, reduce number of array allocation routines.
      
      Change-Id: Id5760041a2d7f94dcaf17ec760f6095ec75dadaa
      6fac4475
  27. 25 Feb, 2014 1 commit
    • Hiroshi Yamauchi's avatar
      (Experimental) Add Brooks pointers. · 9d04a20b
      Hiroshi Yamauchi authored
      This feature is disabled by default.
      
      Verified that the Brooks pointers are installed correctly by using the
      CMS/SS collectors.
      
      Change-Id: Ia9be9814ab6e29169ac85edc4792ce8c81d552a9
      9d04a20b
  28. 21 Feb, 2014 1 commit
    • Mathieu Chartier's avatar
      Fix and optimize verify object. · 4e30541a
      Mathieu Chartier authored
      VerifyObject no longer resides in heap. You can now enable
      VerifyObject for non-debug builds. VerifyStack is still slow, so it
      is now guarded by its own flag.
      
      Fixed the image writer to not use verification at places where
      verification fails due to invalid reads.
      
      Fixed RosAlloc to use SizeOf which doesn't call verify object.
      
      Added a flag paremeter to some of the mirror getters / setters to
      be able to selectively disable VerifyObject on certain calls.
      
      Optimized the GC to not verify each object multiple times during
      object scanning if verify object is enabled.
      
      Added 3 verification options: verify reads, verify this, and verify
      writes so that you can select how much verification you want for
      mirror getters and setters.
      
      Removed some useless DCHECKs which would slow debug builds without
      providing any benefits.
      
      TODO: RosAlloc verification doesn't currently work with verify
      objects.
      
      Bug: 12934910
      Bug: 12879358
      
      Change-Id: Ic61033104dfc334543f89b0fc0ad8cd4f4015d69
      4e30541a
  29. 13 Feb, 2014 1 commit
  30. 08 Jan, 2014 1 commit
    • Mathieu Chartier's avatar
      Background compaction support. · e6da9af8
      Mathieu Chartier authored
      When the process state changes to a state which does not perceives
      jank, we copy from the main free-list backed allocation space to
      the bump pointer space and enable the semispace allocator.
      
      When we transition back to foreground, we copy back to a free-list
      backed space.
      
      Create a seperate non-moving space which only holds non-movable
      objects. This enables us to quickly wipe the current alloc space
      (DlMalloc / RosAlloc) when we transition to background.
      
      Added multiple alloc space support to the sticky mark sweep GC.
      
      Added a -XX:BackgroundGC option which lets you specify
      which GC to use for background apps. Passing in
      -XX:BackgroundGC=SS makes the heap compact the heap for apps which
      do not perceive jank.
      
      Results:
      Simple background foreground test:
      0. Reboot phone, unlock.
      1. Open browser, click on home.
      2. Open calculator, click on home.
      3. Open calendar, click on home.
      4. Open camera, click on home.
      5. Open clock, click on home.
      6. adb shell dumpsys meminfo
      
      PSS Normal ART:
      Sample 1:
          88468 kB: Dalvik
           3188 kB: Dalvik Other
      Sample 2:
          81125 kB: Dalvik
           3080 kB: Dalvik Other
      
      PSS Dalvik:
      Total PSS by category:
      Sample 1:
          81033 kB: Dalvik
          27787 kB: Dalvik Other
      Sample 2:
          81901 kB: Dalvik
          28869 kB: Dalvik Other
      
      PSS ART + Background Compaction:
      Sample 1:
          71014 kB: Dalvik
           1412 kB: Dalvik Other
      Sample 2:
          73859 kB: Dalvik
           1400 kB: Dalvik Other
      
      Dalvik other reduction can be explained by less deep allocation
      stacks / less live bitmaps / less dirty cards.
      
      TODO improvements: Recycle mem-maps which are unused in the current
      state. Not hardcode 64 MB capacity of non movable space (avoid
      returning linear alloc nightmares). Figure out ways to deal with low
      virtual address memory problems.
      
      Bug: 8981901
      
      Change-Id: Ib235d03f45548ffc08a06b8ae57bf5bada49d6f3
      e6da9af8
  31. 20 Dec, 2013 1 commit
  32. 17 Dec, 2013 1 commit
    • Mathieu Chartier's avatar
      Thread local bump pointer allocator. · 692fafd9
      Mathieu Chartier authored
      Added a thread local allocator to the heap, each thread has three
      pointers which specify the thread local buffer: start, cur, and
      end. When the remaining space in the thread local buffer isn't large
      enough for the allocation, the allocator allocates a new thread
      local buffer using the bump pointer allocator.
      
      The bump pointer space had to be modified to accomodate thread
      local buffers. These buffers are called "blocks", where a block
      is a buffer which contains a set of adjacent objects. Blocks
      aren't necessarily full and may have wasted memory towards the
      end. Blocks have an 8 byte header which specifies their size and is
      required for traversing bump pointer spaces.
      
      Memory usage is in between full bump pointer and ROSAlloc since
      madvised memory limits wasted ram to an average of 1/2 page per
      block.
      
      Added a runtime option -XX:UseTLAB which specifies whether or
      not to use the thread local allocator. Its a NOP if the garbage
      collector is not the semispace collector.
      
      TODO: Smarter block accounting to prevent us reading objects until
      we either hit the end of the block or GetClass() == null which
      signifies that the block isn't 100% full. This would provide a
      slight speedup to BumpPointerSpace::Walk.
      
      Timings: -XX:HeapMinFree=4m -XX:HeapMaxFree=8m -Xmx48m
      ritzperf memalloc:
      Dalvik -Xgc:concurrent: 11678
      Dalvik -Xgc:noconcurrent: 6697
      -Xgc:MS: 5978
      -Xgc:SS: 4271
      -Xgc:CMS: 4150
      -Xgc:SS -XX:UseTLAB: 3255
      
      Bug: 9986565
      Bug: 12042213
      
      Change-Id: Ib7e1d4b199a8199f3b1de94b0a7b6e1730689cad
      692fafd9
  33. 11 Dec, 2013 1 commit
    • Mathieu Chartier's avatar
      Enable moving classes. · c528dba3
      Mathieu Chartier authored
      Slight reduction in Zygote size, memory savings are in the noise.
      Before: Zygote size: 8739224
      After: Zygote size: 8733568
      
      Fixed a bug where we didn't set the concurrent start bytes after
      switching the allocator from bump pointer to ROSAlloc in the
      zygote. This caused excessive memory usage.
      
      Added the method verifiers as roots to fix an issue caused by
      RegTypes holding a Class*.
      
      Added logic to clear card table in the SemiSpace collector, this
      reduces DalvikOther from ~2400k -> ~1760k when using the SemiSpace
      collector.
      
      Added a missing lock to the timing loggers which caused a rare
      one time crash in std::set.
      
      Bug: 11771255
      Bug: 8499494
      Bug: 10802951
      
      Change-Id: I99d2b528cd51c1c5ed7012e3220b3aefded680ae
      c528dba3
  34. 09 Dec, 2013 1 commit
  35. 06 Dec, 2013 1 commit
    • Hiroshi Yamauchi's avatar
      Fix valgrind-test-art-host-gtest-object_test. · e4e23c0b
      Hiroshi Yamauchi authored
      This had been failing with the error message:
      
      object_test F  2360  2360 art/runtime/gc/heap-inl.h:139] Check failed: !running_on_valgrind_
      
      Then, this failing DCHECK was removed in a refactoring in
      cbb2d20b, I believe.
      
      This change adds back a DCHECK that's equivalent to the old one and
      fixes ObjectTest.CheckAndAllocArrayFromCode by replacing a
      CheckAndAllocArrayFromCode call with a
      CheckAndAllocArrayFromCodeInstrumented call.
      
      Bug: 11670287
      Change-Id: Ica2f707b9a9ff48ef973b9e326a4d9786c1781f8
      e4e23c0b