OSDN Git Service

android-x86/dalvik.git
13 years agoSamplingProfilerIntegration and SamplingProfiler improvements (1/3)
Brian Carlstrom [Mon, 28 Mar 2011 07:12:36 +0000 (00:12 -0700)]
SamplingProfilerIntegration and SamplingProfiler improvements (1/3)

Summary:

frameworks/base
- fix profiling to collect data beyond the first snapshot
- avoid many small files, accumulate data over process lifetime

libcore:
- add support for VM specific sampling, trying to cut down overhead
- added support for converting snapshot files to text format
- fixed race in profiler when stopping

dalvik
- added VMStack.setThreadStackTrace interface for filling a stack
  trace into an existing StackTraceElement[]

Details:

frameworks/base

    Changed snapshots from text to binary hprof format (bumping version to 3)
    Changed from one file per snapshot to one file per process lifetime.
    Restart profiling after snapshot.

core/java/com/android/internal/os/SamplingProfilerIntegration.java

    Add quick test in maybeSnapshot to avoid doing work when the
    SamplingProfilerIntegration is disabled. Make maybeSnapshot
    private. Remove unneeded memory allocation in handleLowMemory.

core/java/android/app/ActivityThread.java

libcore

    Added ThreadSampler interface. This allows VM specific thread
    sampling optimizations. The portable version continues to use
    Thread.getStackTrace().

dalvik/src/main/java/dalvik/system/profiler/ThreadSampler.java
dalvik/src/main/java/dalvik/system/profiler/PortableThreadSampler.java
dalvik/src/main/java/dalvik/system/profiler/SamplingProfiler.java

    Add VMStack.setThreadStackTrace and use in new DalvikThreadSampler
    to avoid allocating a full stack trace when only a limited depth
    is desired.

dalvik/src/main/java/dalvik/system/profiler/DalvikThreadSampler.java
dalvik/src/main/java/dalvik/system/VMStack.java

    Refactored BinaryHprof.readMagic out of BinaryHprofReader so it
    can be used by HprofBinaryToAscii converter to probing file
    types. Added magic number constant to be shared between readMagic
    and BinaryHprofWriter.

dalvik/src/main/java/dalvik/system/profiler/BinaryHprof.java
dalvik/src/main/java/dalvik/system/profiler/BinaryHprofReader.java
dalvik/src/main/java/dalvik/system/profiler/BinaryHprofWriter.java
dalvik/src/main/java/dalvik/system/profiler/HprofBinaryToAscii.java

    Removed unneeded HprofWriter interface. Changed to simpler static
    interface to write HprofData to binary and text formats.

dalvik/src/main/java/dalvik/system/profiler/HprofWriter.java
dalvik/src/main/java/dalvik/system/profiler/AsciiHprofWriter.java
dalvik/src/main/java/dalvik/system/profiler/BinaryHprofWriter.java
dalvik/src/test/java/dalvik/system/profiler/SamplingProfilerTest.java

    Added support for reading snapshot files created by
    SamplingProfilerIntegration by stripping the text header to allow
    easier conversion to the text format.

dalvik/src/main/java/dalvik/system/profiler/HprofBinaryToAscii.java

    Fixed race between Sampler and
    SamplingProfiler.stop. SamplingProfiler.stop previously simply
    called the Sampler's TimerTask.cancel method, but this does not
    wait for a currently running Sampler to finish. The TimerTask
    documentation says the only reliable way to do this is to have the
    run() cancel itself, so that is what is now done, with new code to
    ensure that SamplingProfiler.stop does not return until the
    Sampler has been terminated.

dalvik/src/main/java/dalvik/system/profiler/SamplingProfiler.java

dalvik

   Refactored VMStack_getThreadStackTrace to create helper getTraceBuf
   used to implement new VMStack_setThreadStackTrace. The new version
   interface fills an existing StackTraceElement[], avoid allocating
   unnecessary StackTraceElements.

vm/native/dalvik_system_VMStack.c

   Refactor dvmGetStackTraceRaw to create dvmSetStackTraceRaw which
   fills in an existing, potentially smaller, StackTraceElement[].

vm/Exception.c
vm/Exception.h

   Change stack depths to be size_t to avoid signed/unsigned comparison warnings.

vm/Ddm.c
vm/Exception.c
vm/Exception.h

Change-Id: Ie88a3f9e069f6984d790ee61c6f7ac5ed47d3388

13 years agoam 17aff091: am b1101e84: am 486ac3c0: Removing inaccurate and unmaintained docs.
Dan Bornstein [Thu, 24 Mar 2011 00:58:34 +0000 (17:58 -0700)]
am 17aff091: am b1101e84: am 486ac3c0: Removing inaccurate and unmaintained docs.

* commit '17aff091bad641b81e2609cfce69739986597d40':
  Removing inaccurate and unmaintained docs.

13 years agoam b1101e84: am 486ac3c0: Removing inaccurate and unmaintained docs.
Dan Bornstein [Thu, 24 Mar 2011 00:56:38 +0000 (17:56 -0700)]
am b1101e84: am 486ac3c0: Removing inaccurate and unmaintained docs.

* commit 'b1101e847312da8ee98a26e25058f93ba381f1ac':
  Removing inaccurate and unmaintained docs.

13 years agoam 486ac3c0: Removing inaccurate and unmaintained docs.
Dan Bornstein [Thu, 24 Mar 2011 00:53:04 +0000 (17:53 -0700)]
am 486ac3c0: Removing inaccurate and unmaintained docs.

* commit '486ac3c0a90b05be5af4b82801ef325e83241057':
  Removing inaccurate and unmaintained docs.

13 years agoRemoving inaccurate and unmaintained docs.
Dan Bornstein [Wed, 23 Mar 2011 22:26:58 +0000 (15:26 -0700)]
Removing inaccurate and unmaintained docs.

Change-Id: Ifef37063e844e4eb9ccc8111a1f1263fe26bd517

13 years agoMerge "x86: restore standard stack frame layout and fix stack alignment."
Bill Buzbee [Sat, 19 Mar 2011 17:16:14 +0000 (10:16 -0700)]
Merge "x86: restore standard stack frame layout and fix stack alignment."

13 years agoAdd a 'dalvik' shell script to launch dalvikvm on the host.
Jesse Wilson [Thu, 17 Mar 2011 23:58:18 +0000 (16:58 -0700)]
Add a 'dalvik' shell script to launch dalvikvm on the host.

Change-Id: I44ba2752b593a92c62872318cd8ac17185f52871
http://b/4128077

13 years agodalvik: remove LOCAL_PRELINK_MODULE
Iliyan Malchev [Mon, 14 Mar 2011 21:02:05 +0000 (14:02 -0700)]
dalvik: remove LOCAL_PRELINK_MODULE

Change-Id: I1d5652a0380138dc6cddd9f0ba926ff7a131d44b
Signed-off-by: Iliyan Malchev <malchev@google.com>
13 years agoBuild libdexdump_static.
Ying Wang [Fri, 11 Mar 2011 23:49:56 +0000 (15:49 -0800)]
Build libdexdump_static.

Which will be used in libdexdumpjni.

Change-Id: I7431fdcd006b4c4cf92e3565265830a39ccf3084

13 years agox86: restore standard stack frame layout and fix stack alignment.
Eugene Surovegin [Wed, 9 Mar 2011 20:38:29 +0000 (12:38 -0800)]
x86: restore standard stack frame layout and fix stack alignment.

Native x86 can contain SSE instructions, this requires 16-byte aligned stack
which is what GCC expects these days. Enforce this in dvmPlatformInvoke and
in mterp.

Also fix stack frame layout, so debuggers can produce backtraces across
dvmMterpStdRun invocations.

Change-Id: I43d00a6bf8210b7d3aa9276edabc08978084e4f2

13 years agoresolved conflicts for merge of d063e255 to honeycomb-plus-aosp
buzbee [Tue, 8 Mar 2011 15:17:52 +0000 (07:17 -0800)]
resolved conflicts for merge of d063e255 to honeycomb-plus-aosp

Change-Id: I3c4d6895209ccba61ec3a14c24274939a7fc65e8

13 years agoMerge "Update to allow x86-atom build for FI on Gingerbread"
David Turner [Sat, 5 Mar 2011 09:08:13 +0000 (01:08 -0800)]
Merge "Update to allow x86-atom build for FI on Gingerbread"

13 years agoFix build.
Raphael [Wed, 2 Mar 2011 22:37:37 +0000 (14:37 -0800)]
Fix build.

The build server is stuck waiting for the O_BINARY change
from system/core. This will unblock it.

Change-Id: Iedd5f7a6cb140ac07b5084948a69eb5d94e2070f

13 years agoam 7027ab61: am 88041260: am dd19f5b9: Merge "Fix for a crash when GC weak references."
Romain Guy [Wed, 2 Mar 2011 20:53:48 +0000 (12:53 -0800)]
am 7027ab61: am 88041260: am dd19f5b9: Merge "Fix for a crash when GC weak references."

* commit '7027ab6198f9d27b376e467971d55f14b160e40f':
  Fix for a crash when GC weak references.

13 years agoam 0c91e9d5: am 98e0347a: am 2b3d7e8e: Merge "Open dexdump files in binary mode."
Raphael Moll [Wed, 2 Mar 2011 20:53:46 +0000 (12:53 -0800)]
am 0c91e9d5: am 98e0347a: am 2b3d7e8e: Merge "Open dexdump files in binary mode."

* commit '0c91e9d5a4078bc1c6da2c225bde5fb703fd9d58':
  Open dexdump files in binary mode.

13 years agoam 88041260: am dd19f5b9: Merge "Fix for a crash when GC weak references."
Romain Guy [Tue, 1 Mar 2011 21:50:40 +0000 (13:50 -0800)]
am 88041260: am dd19f5b9: Merge "Fix for a crash when GC weak references."

* commit '88041260251335cc497db4708f0057d5367da8b4':
  Fix for a crash when GC weak references.

13 years agoam 98e0347a: am 2b3d7e8e: Merge "Open dexdump files in binary mode."
Raphael Moll [Tue, 1 Mar 2011 21:50:37 +0000 (13:50 -0800)]
am 98e0347a: am 2b3d7e8e: Merge "Open dexdump files in binary mode."

* commit '98e0347a7f016764403384567267db6e9dcf8edf':
  Open dexdump files in binary mode.

13 years agoam dd19f5b9: Merge "Fix for a crash when GC weak references."
Romain Guy [Tue, 1 Mar 2011 20:39:47 +0000 (12:39 -0800)]
am dd19f5b9: Merge "Fix for a crash when GC weak references."

* commit 'dd19f5b91a1032e60871febb143850fd81000c5a':
  Fix for a crash when GC weak references.

13 years agoam 2b3d7e8e: Merge "Open dexdump files in binary mode."
Raphael Moll [Tue, 1 Mar 2011 20:39:44 +0000 (12:39 -0800)]
am 2b3d7e8e: Merge "Open dexdump files in binary mode."

* commit '2b3d7e8eccd7cbf64b2ac41c05073a9191d0d3b3':
  Open dexdump files in binary mode.

13 years agoAdd notice file for dx.jar and dexdump
Xavier Ducrohet [Tue, 1 Mar 2011 02:16:32 +0000 (18:16 -0800)]
Add notice file for dx.jar and dexdump

Change-Id: I0094d382e866b8767383516abd367c98712da594

13 years agoMerge "Fix for a crash when GC weak references."
Romain Guy [Thu, 24 Feb 2011 19:24:47 +0000 (11:24 -0800)]
Merge "Fix for a crash when GC weak references."

13 years agoAdd new comparator function.
Dan Bornstein [Wed, 23 Feb 2011 23:30:24 +0000 (15:30 -0800)]
Add new comparator function.

This one compares a DexProto with a list of method parameter types,
and it is immediately useful in the new getMethod() reflection code,
to avoid doing a bunch of extra string manipulation.

While I was in the territory, I removed some comment redundancy.

Change-Id: I5049e2ac4606e44a65c3c426ac2f880a891c51f9

13 years agoMerge "Optimize Class.getMethod() by loading only one method."
Jesse Wilson [Wed, 23 Feb 2011 21:32:57 +0000 (13:32 -0800)]
Merge "Optimize Class.getMethod() by loading only one method."

13 years agoOptimize Class.getMethod() by loading only one method.
Jesse Wilson [Wed, 23 Feb 2011 04:20:36 +0000 (20:20 -0800)]
Optimize Class.getMethod() by loading only one method.

Change-Id: Ia2cd776c0a14914264e8d94e978d55854ed75623
http://b/3431686

13 years agoMerge "Open dexdump files in binary mode."
Raphael Moll [Tue, 22 Feb 2011 22:55:59 +0000 (14:55 -0800)]
Merge "Open dexdump files in binary mode."

13 years agoBump Dalvik version.
Andy McFadden [Tue, 22 Feb 2011 22:09:19 +0000 (14:09 -0800)]
Bump Dalvik version.

Minor increase to differentiate HC MR1 from HC.

Change-Id: I2ccd57d4952c19c2df2fe948ce60c476819450d4

13 years agoUpdate to allow x86-atom build for FI on Gingerbread
Johnnie Birch [Fri, 18 Feb 2011 18:06:23 +0000 (10:06 -0800)]
Update to allow x86-atom build for FI on Gingerbread

Also handles most TODO.txt items and contains some rewriting of the dispatch code.
Also adds a newline to the end of files that did not previously end with a newline.

Change-Id: I0cf3e77dc7bbf5ed7ec8538ef4d7d8740e296640

13 years agoFix prelink for libdvm.
Ying Wang [Sat, 19 Feb 2011 00:56:41 +0000 (16:56 -0800)]
Fix prelink for libdvm.

Change-Id: If91f46f80c1b1947683720e8187cecb0f7077b94
Bug: 3470019

13 years agoOpen dexdump files in binary mode.
Raphael Moll [Wed, 16 Feb 2011 21:39:27 +0000 (13:39 -0800)]
Open dexdump files in binary mode.

Requires change Ia5c0a59e from system/core
(which defines O_BINARY globally.)

Change-Id: If814608ee9662190a7cf80aae2ad2451d88364ae

13 years agoClean up use of HAVE_ANDROID_OS
Kenny Root [Wed, 16 Feb 2011 18:15:52 +0000 (10:15 -0800)]
Clean up use of HAVE_ANDROID_OS

HAVE_ANDROID_OS was defined as "1" for targets, but never defined as "0"
for non-targets. Changing them to #ifdef should be safe and matches all
the other uses of HAVE_ANDROID_OS throughout the system.

Change-Id: I077aee39b08ce82327a571d9aca0cae422a0ebb5

13 years agoFix "all stubs" interpreter
Andy McFadden [Mon, 14 Feb 2011 22:04:42 +0000 (14:04 -0800)]
Fix "all stubs" interpreter

The "all stubs" interpreter is the recommended starting point for
anyone creating a "fast" interpreter on a new CPU.  This cleans
up some minor bit rot in the code and documentation.

Bug 3452689

Change-Id: I6bc3b0b5da11955d842d5fc5f16cb1a2209d4a89

13 years agoMerge "Make Release(JNI_COMMIT) faster"
Andy McFadden [Wed, 9 Feb 2011 16:10:49 +0000 (08:10 -0800)]
Merge "Make Release(JNI_COMMIT) faster"

13 years agoMake Release(JNI_COMMIT) faster
Andy McFadden [Wed, 9 Feb 2011 00:24:34 +0000 (16:24 -0800)]
Make Release(JNI_COMMIT) faster

The Release<primitive>ArrayElements and ReleasePrimitiveArrayCritical
calls take a "mode" argument.  If you pass in JNI_COMMIT, the storage
isn't actually released; instead, the buffer contents are flushed to
the backing storage.  If the VM has handed you a pointer to the raw
data rather than a copy, the call is a no-op.

In its present incarnation, it's a no-op that changes the thread state,
adding overhead and the possibility of suspension.  This change moves
the test for JNI_COMMIT outside the enter/exit macros.

Bug 3430203

Change-Id: I8426647ee02b2336c5c90146028fc207cfbacc3a

13 years agoRemove JNI_FORCE_C
Andy McFadden [Wed, 9 Feb 2011 00:12:33 +0000 (16:12 -0800)]
Remove JNI_FORCE_C

This hasn't been useful in a really long time.

Change-Id: Ieea01f5d051bc8fc671f7414af3bed626ece75f1

13 years agoMerge "Added JNI hack to support JNI hack"
Andy McFadden [Wed, 9 Feb 2011 00:03:05 +0000 (16:03 -0800)]
Merge "Added JNI hack to support JNI hack"

13 years agoAdded JNI hack to support JNI hack
Andy McFadden [Tue, 8 Feb 2011 20:07:32 +0000 (12:07 -0800)]
Added JNI hack to support JNI hack

Some of our graphics code wants to get a pointer, release it, and then
continue to use it.  The "forcecopy" mode of CheckJNI was designed
to find any code that does this.  It succeeded.

To support the behavior, we provide a JNI helper function that does
the dirty work.  It passes a magic value into the Get and Release calls
that causes "forcecopy" to skip the copy.  When forcecopy is not
enabled, the values are simply ignored.

To avoid any possibility of the function getting published in the NDK,
the function is not described in JNIHelp.h.

Bug 3409356

Change-Id: Ibd20d12ba6d3d3236ebf5760f7ccaa8c557e3774

13 years agoFree some strings in error paths
Kenny Root [Wed, 2 Feb 2011 23:07:00 +0000 (15:07 -0800)]
Free some strings in error paths

Change-Id: I54629ca65c30960f930ce6886e0915e360e20237

13 years agoAvoid double-free on error.
Andy McFadden [Mon, 7 Feb 2011 23:49:13 +0000 (15:49 -0800)]
Avoid double-free on error.

In certain circumstances on a -user build we could end up trying to
free a buffer twice.

Bug 3431477

Change-Id: I1cce1da0e32aabc85d5c5c69346224c6db49b8ee

13 years agoEnsure word atomicity in System.arraycopy
Andy McFadden [Thu, 3 Feb 2011 00:55:41 +0000 (16:55 -0800)]
Ensure word atomicity in System.arraycopy

The VM needs to ensure that updates to 16-bit and 32-bit fields
and array elements happen atomically.  System.arraycopy was calling
memmmove(), which in bionic happens to copy a byte at a time.

The new plan is to have bionic provide a platform-optimized memmove
variant that makes guarantees about word sizes.  If it is not present
(either because it hasn't been written for the current platform,
or we're not linking against bionic), we will use a trivial copy loop.

We assume that the memmove-by-word implementation does whatever
it needs to for best performance.  For example, if the function
determines that memcpy() is word-safe and will be faster, it can
call that.  The VM no longer makes assumptions about the internal
workings of libc functions.

I also rearranged the code to avoid making indirect calls, reading
function addresses from memory, and using integer multiplication
instructions when a simple shift will do.  (gcc now generates the
whole thing as one function.)

Also, added some primitive array copy tests to 011-array-copy.

Bug 3398352

Change-Id: I4677ee1c87998697a93e61f39a48b3f391e8e11b

13 years agoam 168ae921: am e7bf56c5: Use the global maximum to compute the size of a new mspace.
Carl Shapiro [Wed, 2 Feb 2011 21:22:53 +0000 (13:22 -0800)]
am 168ae921: am e7bf56c5: Use the global maximum to compute the size of a new mspace.

* commit '168ae921fb68f2af7fbb62619232ec27bb741bea':
  Use the global maximum to compute the size of a new mspace.

13 years agoam e7bf56c5: Use the global maximum to compute the size of a new mspace.
Carl Shapiro [Wed, 2 Feb 2011 21:18:48 +0000 (13:18 -0800)]
am e7bf56c5: Use the global maximum to compute the size of a new mspace.

* commit 'e7bf56c584b8b2c3d60f79a27a4a2e9a6b1e2f22':
  Use the global maximum to compute the size of a new mspace.

13 years agoUse the global maximum to compute the size of a new mspace.
Carl Shapiro [Wed, 2 Feb 2011 04:19:04 +0000 (20:19 -0800)]
Use the global maximum to compute the size of a new mspace.

The global maximum was used for the initial specificaion but a local
maximum was used for post-Zygote mspace creations.  This prevented a
clearing of the growth limit from having the intended effect.

Bug: 3414804
Change-Id: I47e0c1510f2212849e3b738c5578bbd7b1aff27d

13 years agoUpdate doc with actual version number.
Andy McFadden [Tue, 1 Feb 2011 22:02:59 +0000 (14:02 -0800)]
Update doc with actual version number.

Honeycomb is 3.0.

Change-Id: Ic7f15a9e2345344acdc787db153f8b8c559fe15f

13 years agoam d820da20: Reconcile gingerbread-plus-aosp and honeycomb
The Android Open Source Project [Sun, 30 Jan 2011 20:53:55 +0000 (12:53 -0800)]
am d820da20: Reconcile gingerbread-plus-aosp and honeycomb

* commit 'd820da20e28c0468324125a8a2bf75c3c4c01c27':

13 years agoReconcile gingerbread-plus-aosp and honeycomb
The Android Open Source Project [Sun, 30 Jan 2011 20:39:54 +0000 (12:39 -0800)]
Reconcile gingerbread-plus-aosp and honeycomb

Change-Id: Ic8c04a257aaf0ecf5348d176def5bedc6c640ee0

13 years agoMass merge from gingerbread - do not merge
The Android Open Source Project [Sun, 30 Jan 2011 20:39:54 +0000 (12:39 -0800)]
Mass merge from gingerbread - do not merge

Change-Id: I03cce63a718a19c27445efd2c48a7886f22f7ed1

13 years agoam 81058aaf: (-s ours) Use bcopy() to move object refs around within an array. DO...
Dan Bornstein [Sat, 29 Jan 2011 18:51:59 +0000 (10:51 -0800)]
am 81058aaf: (-s ours) Use bcopy() to move object refs around within an array. DO NOT MERGE.

* commit '81058aaf92c188cc20273edd0275329fc304aca2':
  Use bcopy() to move object refs around within an array. DO NOT MERGE.

13 years agoam b46125f2: (-s ours) am 08e54499: (-s ours) am 81058aaf: Use bcopy() to move object...
Dan Bornstein [Sat, 29 Jan 2011 16:47:06 +0000 (08:47 -0800)]
am b46125f2: (-s ours) am 08e54499: (-s ours) am 81058aaf: Use bcopy() to move object refs around within an array. DO NOT MERGE.

* commit 'b46125f27e83da6b9844a502b11ffff48c59f729':
  Use bcopy() to move object refs around within an array. DO NOT MERGE.

13 years agoam 08e54499: (-s ours) am 81058aaf: Use bcopy() to move object refs around within...
Dan Bornstein [Sat, 29 Jan 2011 16:44:07 +0000 (08:44 -0800)]
am 08e54499: (-s ours) am 81058aaf: Use bcopy() to move object refs around within an array. DO NOT MERGE.

* commit '08e5449920e616cab1895eda309c20e109e5752e':
  Use bcopy() to move object refs around within an array. DO NOT MERGE.

13 years agoam 81058aaf: Use bcopy() to move object refs around within an array. DO NOT MERGE.
Dan Bornstein [Thu, 27 Jan 2011 23:28:25 +0000 (15:28 -0800)]
am 81058aaf: Use bcopy() to move object refs around within an array. DO NOT MERGE.

* commit '81058aaf92c188cc20273edd0275329fc304aca2':
  Use bcopy() to move object refs around within an array. DO NOT MERGE.

13 years agoam 99d4ea09: am 3207edfa: Use bcopy() to move object refs around within an array.
Dan Bornstein [Thu, 27 Jan 2011 23:10:56 +0000 (15:10 -0800)]
am 99d4ea09: am 3207edfa: Use bcopy() to move object refs around within an array.

* commit '99d4ea09cb64768d0e1f2149f7e3af7d37172be7':
  Use bcopy() to move object refs around within an array.

13 years agoam 3207edfa: Use bcopy() to move object refs around within an array.
Dan Bornstein [Thu, 27 Jan 2011 22:59:38 +0000 (14:59 -0800)]
am 3207edfa: Use bcopy() to move object refs around within an array.

* commit '3207edfa2de55be1207ff3e10409e7b291e33ab1':
  Use bcopy() to move object refs around within an array.

13 years agoUse bcopy() to move object refs around within an array. DO NOT MERGE.
Dan Bornstein [Thu, 27 Jan 2011 19:38:37 +0000 (11:38 -0800)]
Use bcopy() to move object refs around within an array. DO NOT MERGE.

bcopy() guarantees that pointer-size words are stored atomically, and
so this prevents the gc from seeing a pointer in mid-change.

Bug: 3399673
Change-Id: Ic7d795e5d397548e9d6d8c11a585d86838cf8a44

13 years agoUse bcopy() to move object refs around within an array.
Dan Bornstein [Thu, 27 Jan 2011 19:38:37 +0000 (11:38 -0800)]
Use bcopy() to move object refs around within an array.

bcopy() guarantees that pointer-size words are stored atomically, and
so this prevents the gc from seeing a pointer in mid-change.

Change-Id: I7ba426c5b54a3459504211d88cca1b07383168bb

13 years agoam 6ad1992b: (-s ours) am 70b130f5: (-s ours) Clean up/out some comments. DO NOT...
Dan Bornstein [Thu, 27 Jan 2011 05:55:38 +0000 (21:55 -0800)]
am 6ad1992b: (-s ours) am 70b130f5: (-s ours) Clean up/out some comments. DO NOT MERGE.

* commit '6ad1992b311937963d44be68f3ec0255a87d82b8':
  Clean up/out some comments. DO NOT MERGE.

13 years agoam f741b8e1: am 80a30431: (-s ours) Remove some pointless tests.
Dan Bornstein [Thu, 27 Jan 2011 05:48:09 +0000 (21:48 -0800)]
am f741b8e1: am 80a30431: (-s ours) Remove some pointless tests.

* commit 'f741b8e112834cb3c140ca81890dc41126649dee':
  Remove some pointless tests.

13 years agoam 76675cb5: am 9b6881c2: Fix accidental transposition of partial and concurrent...
Carl Shapiro [Thu, 27 Jan 2011 05:35:57 +0000 (21:35 -0800)]
am 76675cb5: am 9b6881c2: Fix accidental transposition of partial and concurrent values.

* commit '76675cb52e5d5ddeaefd81ec83841e0c503d3411':
  Fix accidental transposition of partial and concurrent values.

13 years agoam 9b6881c2: Fix accidental transposition of partial and concurrent values.
Carl Shapiro [Thu, 27 Jan 2011 05:16:31 +0000 (21:16 -0800)]
am 9b6881c2: Fix accidental transposition of partial and concurrent values.

* commit '9b6881c26d58a46e6478294d83554fb9e3a85625':
  Fix accidental transposition of partial and concurrent values.

13 years agoFix accidental transposition of partial and concurrent values.
Carl Shapiro [Thu, 27 Jan 2011 02:41:03 +0000 (18:41 -0800)]
Fix accidental transposition of partial and concurrent values.

In the event of an allocation failure a full, concurrent collection was
initiated instead of a partial, non-concurrent collection.  This change
assigns the correct boolean values to that settings.

These values should be made enums to ensure this does not happen again.

Bug: 3379352

Change-Id: I9336e8f832cf02e4a74745cd475914a0c312ea4e

13 years agoam a4c8f3fa: am d6b23e5c: Merge "Package garbage collection policy parameters into...
Carl Shapiro [Thu, 27 Jan 2011 03:13:02 +0000 (19:13 -0800)]
am a4c8f3fa: am d6b23e5c: Merge "Package garbage collection policy parameters into a single structure." into honeycomb

* commit 'a4c8f3fae538b56a003e0546b8c001d68873a650':
  Package garbage collection policy parameters into a single structure.

13 years agoam d6b23e5c: Merge "Package garbage collection policy parameters into a single struct...
Carl Shapiro [Thu, 27 Jan 2011 02:06:35 +0000 (18:06 -0800)]
am d6b23e5c: Merge "Package garbage collection policy parameters into a single structure." into honeycomb

* commit 'd6b23e5ca90e011b6ede0d3592922616df3e33ec':
  Package garbage collection policy parameters into a single structure.

13 years agoMerge "Package garbage collection policy parameters into a single structure." into...
Carl Shapiro [Thu, 27 Jan 2011 02:02:17 +0000 (18:02 -0800)]
Merge "Package garbage collection policy parameters into a single structure." into honeycomb

13 years agoPackage garbage collection policy parameters into a single structure.
Carl Shapiro [Thu, 27 Jan 2011 01:25:27 +0000 (17:25 -0800)]
Package garbage collection policy parameters into a single structure.

The garbage collection policy had been determined informally.  This change
defines the garbage collection behavior in a centralized location making it
clear how the system will behave when requesting a garbage collection in one
of the four common situations.  This change is required to allow us to change
the policy for an explicit garbage collection.

In addition, this change hoists out the thread priority toggle from the
main garbage collector routine into two simple subroutines making this
it much easier to read and spot behavior differences.

Bug: 3379352
Change-Id: If0d7d9ef337819598fb6e268f7a127f2bae23580

13 years agoam 4d7dd569: Handle the case of referent clearing during tracing.
Carl Shapiro [Wed, 26 Jan 2011 21:03:44 +0000 (13:03 -0800)]
am 4d7dd569: Handle the case of referent clearing during tracing.

* commit '4d7dd56902150ab8db4c20a191bad112928839e9':
  Handle the case of referent clearing during tracing.

13 years agoam 6159ef45: (-s ours) Parameterize instance counting to include subclasses.
Carl Shapiro [Wed, 26 Jan 2011 21:03:40 +0000 (13:03 -0800)]
am 6159ef45: (-s ours) Parameterize instance counting to include subclasses.

* commit '6159ef4520073ae8e7ce7b7d1f7648b161a33302':
  Parameterize instance counting to include subclasses.

13 years agoam ee875bb3: am 80e8d7f9: Increase default stack size
Andy McFadden [Tue, 25 Jan 2011 20:41:36 +0000 (12:41 -0800)]
am ee875bb3: am 80e8d7f9: Increase default stack size

* commit 'ee875bb3c019e278500c000cdd99b34e629e42eb':
  Increase default stack size

13 years agoam 80e8d7f9: Increase default stack size
Andy McFadden [Tue, 25 Jan 2011 20:38:42 +0000 (12:38 -0800)]
am 80e8d7f9: Increase default stack size

* commit '80e8d7f9ca9b49437bec6224162d7bb7f42392da':
  Increase default stack size

13 years agoIncrease default stack size
Andy McFadden [Tue, 25 Jan 2011 20:26:41 +0000 (12:26 -0800)]
Increase default stack size

This increases the default stack size from 12KB to 16KB.

Bug 3388513

Change-Id: I7f7c3f75b749ca2145a96434e89e6500f79973e4

13 years agoam 704c48da: am a4313feb: Remove unprotected reads in the instance counting routines.
Carl Shapiro [Mon, 24 Jan 2011 21:32:44 +0000 (13:32 -0800)]
am 704c48da: am a4313feb: Remove unprotected reads in the instance counting routines.

* commit '704c48daff6bd4f1e824eccb7171c08d32b86ea1':
  Remove unprotected reads in the instance counting routines.

13 years agoam a4313feb: Remove unprotected reads in the instance counting routines.
Carl Shapiro [Mon, 24 Jan 2011 20:38:56 +0000 (12:38 -0800)]
am a4313feb: Remove unprotected reads in the instance counting routines.

* commit 'a4313feb23dd454905a3297bdc9ba745e6066a16':
  Remove unprotected reads in the instance counting routines.

13 years agoRemove unprotected reads in the instance counting routines.
Carl Shapiro [Mon, 24 Jan 2011 20:31:09 +0000 (12:31 -0800)]
Remove unprotected reads in the instance counting routines.

In the past, the instance counters would read the live bitmap, acquire
the heap lock, and then scan the live bitmap.  Reading the live bitmap
ahead of acquiring the heap lock gives the holder of the heap lock an
opportunity to invalidate the copy of the live bitmap read by the
instance counter routine.  For example, the garbage collector could
swap the mark and live bitmaps before releasing the heap lock.  This
change makes the read of the live bitmap safe by moving it into the
critical section.

Bug: 3271510
Change-Id: Ic02171e9ec3b4d24e83773199f00a18a75707427

13 years agoam e1a5956b: am 0eac12e0: Merge "Replace collect with clear for the SoftReference...
Carl Shapiro [Mon, 24 Jan 2011 01:00:45 +0000 (17:00 -0800)]
am e1a5956b: am 0eac12e0: Merge "Replace collect with clear for the SoftReference policy." into honeycomb

* commit 'e1a5956bd9d3d7b89a09b554804c967a30c13932':
  Replace collect with clear for the SoftReference policy.

13 years agoam e1034238: am b387ce8a: Remove references to android_atomic_swap.
Carl Shapiro [Mon, 24 Jan 2011 01:00:43 +0000 (17:00 -0800)]
am e1034238: am b387ce8a: Remove references to android_atomic_swap.

* commit 'e10342385c9845cd82ac73c3b0d9b26c4a3dcd15':
  Remove references to android_atomic_swap.

13 years agoam 0eac12e0: Merge "Replace collect with clear for the SoftReference policy." into...
Carl Shapiro [Mon, 24 Jan 2011 00:07:52 +0000 (16:07 -0800)]
am 0eac12e0: Merge "Replace collect with clear for the SoftReference policy." into honeycomb

* commit '0eac12e0b26c3cdfa3d16e73cc8d7ebd889c846b':
  Replace collect with clear for the SoftReference policy.

13 years agoMerge "Replace collect with clear for the SoftReference policy." into honeycomb
Carl Shapiro [Mon, 24 Jan 2011 00:05:57 +0000 (16:05 -0800)]
Merge "Replace collect with clear for the SoftReference policy." into honeycomb

13 years agoReplace collect with clear for the SoftReference policy.
Carl Shapiro [Sun, 23 Jan 2011 23:58:31 +0000 (15:58 -0800)]
Replace collect with clear for the SoftReference policy.

The garbage collector is invoked with a parameter that changes the
SoftReference clearing policy.  This parameter is normally false,
meaning the garbage collector will attempt to preserve some
softly-reachable referents of SoftReference instances.  When true, the
garbage collector will treat SoftReference instances as WeakReference
instances and always clearly referent fields with softly-reachable
referents.

The code refers to this action as collecting soft references which is
misleading.  The change to the garbage collector policy has an effect
on the referent field of SoftReference instances and any SoftReference
instance which is unreachable is subject collection like any other
object.  With this change we now use the description clearing soft
refernces to describe the policy.

Bug: 3381480

Change-Id: Ie179514e68d4621237b08658c1c55811a49f1210

13 years agoam b387ce8a: Remove references to android_atomic_swap.
Carl Shapiro [Sun, 23 Jan 2011 23:58:49 +0000 (15:58 -0800)]
am b387ce8a: Remove references to android_atomic_swap.

* commit 'b387ce8ae1ffa0861be1ec94ba6c313203931a1b':
  Remove references to android_atomic_swap.

13 years agoRemove references to android_atomic_swap.
Carl Shapiro [Sun, 23 Jan 2011 23:24:34 +0000 (15:24 -0800)]
Remove references to android_atomic_swap.

Bug: 3381237

Change-Id: Iabca4be285082d804b0b206025bd4ca8e008ee42

13 years agoam d50993ff: am 6ff6ec6b: Fix dalvik test 084.
Andy McFadden [Thu, 20 Jan 2011 19:00:23 +0000 (11:00 -0800)]
am d50993ff: am 6ff6ec6b: Fix dalvik test 084.

* commit 'd50993ff6ec834801d1442b0872de33f6d930c4d':
  Fix dalvik test 084.

13 years agoam 6ff6ec6b: Fix dalvik test 084.
Andy McFadden [Thu, 20 Jan 2011 18:58:21 +0000 (10:58 -0800)]
am 6ff6ec6b: Fix dalvik test 084.

* commit '6ff6ec6b6361db707e4b0318075fc38dd319a49a':
  Fix dalvik test 084.

13 years agoFix dalvik test 084.
Andy McFadden [Thu, 20 Jan 2011 18:41:57 +0000 (10:41 -0800)]
Fix dalvik test 084.

Two threads were waiting for initialization of a class to complete.
There was nothing encouraging one thread to resume execution first,
but on single-core devices it always worked out the same way.

Bug 3366697

Change-Id: I29430d398dfbd9509d7db2b7db2800d340b29d19

13 years agoam 94918db6: am 84547e16: Merge "Remove logging of memory management statistics to...
Carl Shapiro [Thu, 20 Jan 2011 01:26:44 +0000 (17:26 -0800)]
am 94918db6: am 84547e16: Merge "Remove logging of memory management statistics to the event log." into honeycomb

* commit '94918db6ac491d361f7d2fea63e88c67c16e8103':
  Remove logging of memory management statistics to the event log.

13 years agoam 84547e16: Merge "Remove logging of memory management statistics to the event log...
Carl Shapiro [Thu, 20 Jan 2011 01:24:14 +0000 (17:24 -0800)]
am 84547e16: Merge "Remove logging of memory management statistics to the event log." into honeycomb

* commit '84547e16cfef6e2f1ebe377a466e858a61b59e45':
  Remove logging of memory management statistics to the event log.

13 years agoMerge "Remove logging of memory management statistics to the event log." into honeycomb
Carl Shapiro [Thu, 20 Jan 2011 01:22:50 +0000 (17:22 -0800)]
Merge "Remove logging of memory management statistics to the event log." into honeycomb

13 years agoRemove logging of memory management statistics to the event log.
Carl Shapiro [Wed, 19 Jan 2011 23:37:31 +0000 (15:37 -0800)]
Remove logging of memory management statistics to the event log.

While the event log used to report better information than the logcat
log messages, this is no longer the case.

Change-Id: Iaf7bef5252c284c1a159bc8c0447247c5b5f47e4

13 years agoam 98ce90f3: am e39e28a8: Merge "Include -XX:DisableExplicitGC in the usage output...
Carl Shapiro [Wed, 19 Jan 2011 23:45:06 +0000 (15:45 -0800)]
am 98ce90f3: am e39e28a8: Merge "Include -XX:DisableExplicitGC in the usage output." into honeycomb

* commit '98ce90f3d007d77b8f7b65c987cc14dddb8cbfd6':
  Include -XX:DisableExplicitGC in the usage output.

13 years agoam e39e28a8: Merge "Include -XX:DisableExplicitGC in the usage output." into honeycomb
Carl Shapiro [Wed, 19 Jan 2011 23:42:58 +0000 (15:42 -0800)]
am e39e28a8: Merge "Include -XX:DisableExplicitGC in the usage output." into honeycomb

* commit 'e39e28a8451222714120406d998a6d776e62bc68':
  Include -XX:DisableExplicitGC in the usage output.

13 years agoMerge "Include -XX:DisableExplicitGC in the usage output." into honeycomb
Carl Shapiro [Wed, 19 Jan 2011 23:41:34 +0000 (15:41 -0800)]
Merge "Include -XX:DisableExplicitGC in the usage output." into honeycomb

13 years agoInclude -XX:DisableExplicitGC in the usage output.
Carl Shapiro [Wed, 19 Jan 2011 23:39:41 +0000 (15:39 -0800)]
Include -XX:DisableExplicitGC in the usage output.

Change-Id: I290d7b5762b616b02f59a653ac5a83388c299a93

13 years agoam 9cef8218: am 836741f0: Merge "Change suspend order in GC" into honeycomb
Andy McFadden [Wed, 19 Jan 2011 23:34:09 +0000 (15:34 -0800)]
am 9cef8218: am 836741f0: Merge "Change suspend order in GC" into honeycomb

* commit '9cef82185def11b5d712961dabc66adf56913963':
  Change suspend order in GC

13 years agoam 836741f0: Merge "Change suspend order in GC" into honeycomb
Andy McFadden [Wed, 19 Jan 2011 23:32:01 +0000 (15:32 -0800)]
am 836741f0: Merge "Change suspend order in GC" into honeycomb

* commit '836741f0984579c415f63b39efae6ce5aa695bcd':
  Change suspend order in GC

13 years agoMerge "Change suspend order in GC" into honeycomb
Andy McFadden [Wed, 19 Jan 2011 23:30:18 +0000 (15:30 -0800)]
Merge "Change suspend order in GC" into honeycomb

13 years agoChange suspend order in GC
Andy McFadden [Wed, 19 Jan 2011 22:48:52 +0000 (14:48 -0800)]
Change suspend order in GC

The GC currently does this:

 1. acquire heapLock
 2. suspend all threads
 3. acquire heapWorkerLock

When the HeapWorker thread is suspended in #2, it might be holding
the lock we want in step #3, leading to VM deadlock.  This change
reverses the order of #2 and #3, which should allow the HeapWorker
thread to progress to a point where it releases the lock before
the GC requests the suspension.

If futexes are being unfair, the GC might have to wait a bit
longer while the HeapWorker does stuff (it might unlock, do work,
and re-lock without the scheduler giving time to the GC thread;
with the old scheme the HeapWorker would see the pending thread
suspension immediately and stop).  A better fix is planned.

Bug 3340837

Change-Id: Ib9b37c130903a2800f8f28ae61540a428dbfc5be

13 years agoam 0bd1ebdb: am 461d57dc: Merge "Add an option to disable explicit GC requests."...
Carl Shapiro [Wed, 19 Jan 2011 22:33:32 +0000 (14:33 -0800)]
am 0bd1ebdb: am 461d57dc: Merge "Add an option to disable explicit GC requests." into honeycomb

* commit '0bd1ebdbeb876acfca801e337fe58ffe184edc1a':
  Add an option to disable explicit GC requests.

13 years agoam 461d57dc: Merge "Add an option to disable explicit GC requests." into honeycomb
Carl Shapiro [Wed, 19 Jan 2011 22:32:00 +0000 (14:32 -0800)]
am 461d57dc: Merge "Add an option to disable explicit GC requests." into honeycomb

* commit '461d57dc62af82c9095a0ce3feb8fc0a4f88ddc9':
  Add an option to disable explicit GC requests.

13 years agoMerge "Add an option to disable explicit GC requests." into honeycomb
Carl Shapiro [Wed, 19 Jan 2011 22:29:43 +0000 (14:29 -0800)]
Merge "Add an option to disable explicit GC requests." into honeycomb

13 years agoAdd an option to disable explicit GC requests.
Carl Shapiro [Wed, 19 Jan 2011 20:56:14 +0000 (12:56 -0800)]
Add an option to disable explicit GC requests.

Change-Id: Ibb2ca9d99fccfba61492a8059201777f59c81274

13 years agoam 4b2dc337: am 6009938d: Increase LinearAlloc limit
Andy McFadden [Wed, 19 Jan 2011 19:29:20 +0000 (11:29 -0800)]
am 4b2dc337: am 6009938d: Increase LinearAlloc limit

* commit '4b2dc33744c00da2a89b075e8e631f3917f83d7f':
  Increase LinearAlloc limit

13 years agoam 6009938d: Increase LinearAlloc limit
Andy McFadden [Wed, 19 Jan 2011 19:27:48 +0000 (11:27 -0800)]
am 6009938d: Increase LinearAlloc limit

* commit '6009938d52c3ba5ae1fdf0074ab618d1166750bf':
  Increase LinearAlloc limit

13 years agoIncrease LinearAlloc limit
Andy McFadden [Wed, 19 Jan 2011 19:00:53 +0000 (11:00 -0800)]
Increase LinearAlloc limit

When run on framework.jar, dexopt needs about 4MB of LinearAlloc
space.  We were capped at 5MB.  Bump up the limit to 8MB to give
us some additional head room.

Bug 3362346

Change-Id: I61e06e4cd7d24d45e426026a5adddd7badc3b839