OSDN Git Service

android-x86/dalvik.git
13 years agoWe also need to tell it the file mode when creating the output.
Dan Bornstein [Mon, 13 Sep 2010 01:27:00 +0000 (18:27 -0700)]
We also need to tell it the file mode when creating the output.

Thanks to Elliott for catching this.

Change-Id: Ibb89ece3dd2e1d39a8a2d51cb8b7278842e057a1

13 years agoActually, dexopt needs to read the optimized dex file too.
Dan Bornstein [Mon, 13 Sep 2010 01:12:27 +0000 (18:12 -0700)]
Actually, dexopt needs to read the optimized dex file too.

Change-Id: Ib36cc0fd134a6916100060c8e2eee5158ac87201

13 years agoMove declarations to the top to avoid potential uninitialized use.
Dan Bornstein [Mon, 13 Sep 2010 00:34:35 +0000 (17:34 -0700)]
Move declarations to the top to avoid potential uninitialized use.

I didn't catch the warnings among the build spew before. Also, made
"--preopt" use stderr for its complaints about arguments.

Change-Id: I8d470ccc40c4cdc9131beb0991060358039e2727

13 years agoAdd a new "--preopt" mode to dexopt, for running on the host.
Dan Bornstein [Sun, 12 Sep 2010 23:42:28 +0000 (16:42 -0700)]
Add a new "--preopt" mode to dexopt, for running on the host.

This change takes much of what used to be in the function fromZip()
(the "--zip" mode implementation) and pulls it into a helper function,
which is then also used by the new preopt() function.

Change-Id: Id54618047896366448adaec0bf973627a9f1f397

13 years agoPre-alpha cut of the new dex preoptimization script.
Dan Bornstein [Sun, 12 Sep 2010 20:03:27 +0000 (13:03 -0700)]
Pre-alpha cut of the new dex preoptimization script.

This will successfully find all the right directories etc., but it doesn't
do any actual dex processing yet. Stay tuned!

Change-Id: I4926308231366d6bae7b6a4594b4edb99192bf42

13 years agoFix inliner bug for empty callees.
Ben Cheng [Sat, 11 Sep 2010 00:11:11 +0000 (17:11 -0700)]
Fix inliner bug for empty callees.

Add an explicit branch to continue from the next instruction.

Bug: 2992514

(cherry-picked from dalvik-dev)

Change-Id: I6e036e330255e7cd9d1504c50c4260910c38dfff

13 years agoMerge "JIT: Fix inconsistent handling of sub-word instance git/put" into gingerbread
buzbee [Thu, 9 Sep 2010 23:46:09 +0000 (16:46 -0700)]
Merge "JIT: Fix inconsistent handling of sub-word instance git/put" into gingerbread

13 years agoJIT: Fix inconsistent handling of sub-word instance git/put
buzbee [Thu, 9 Sep 2010 21:07:01 +0000 (14:07 -0700)]
JIT: Fix inconsistent handling of sub-word instance git/put

The portable interpreter and fast interpreter use 32-bit accesses
for all sub-word scalars.  The JIT generated code to tailor the access
to the data size.  It doesn't matter which approach is taken, but all
interpreters & JIT must be consistent.  Changing the JIT to use 32-bit
accesses for all sub-word instance scalars.

Fix for Issue 2973137

Change-Id: I8b1e9e6be075012c7c174728b77c7a76884975b7

13 years agoAdded "dexopt for SMP" flag.
Andy McFadden [Thu, 9 Sep 2010 19:54:43 +0000 (12:54 -0700)]
Added "dexopt for SMP" flag.

Currently, dexopt always runs on the target device, which means that
decisions about whether or not to convert certain opcodes to SMP-safe
variants could be made based on #ifdefs.

Since we are planning to run dexopt on the host, we need to be able
to configure SMP-mode independently.  This change adds a global variable
that the dexopt code can check.

There is currently no command-line argument to set this, since it will
be set by "dexopt" rather than "dalvikvm", and the exact method of
launching dexopt from the host build is still mildly TBD.

Bug 2981136.

(cherry-pick from dalvik-dev)

Change-Id: I7474f79a25368223ecf1e491458f4a82e85db01f

13 years agoRemove the functionality in ReduceConstants.[ch].
Dan Bornstein [Wed, 8 Sep 2010 22:50:00 +0000 (15:50 -0700)]
Remove the functionality in ReduceConstants.[ch].

It was a good experiment to try, but it was never made production-ready,
and it doesn't look like it would be a net win at this point. We
metaphorically pour out a beer in its honor.

Change-Id: I7f6ac95f5b7c963df0a3015ed33595fa1a928636

13 years agoCherry pick new concurrent gc trigger change from dalvik-dev.
Carl Shapiro [Tue, 7 Sep 2010 23:19:01 +0000 (16:19 -0700)]
Cherry pick new concurrent gc trigger change from dalvik-dev.

git cherry-pick d370c7d8c5bd4f49274b5d306751c43c7bb44a0b --no-commit
git cherry-pick 562cafca106d36ae910fafa87f3d5f245fe818ae --no-commit
git cherry-pick ab46f94967a76a1c141c1e719d5f2cffe2780a8c --no-commit

Change-Id: Iba35cd3afee5d575b8121f7ab3ef5b45b37f5278

13 years agoMerge "Operate on bitmaps directly for live and mark checks." into gingerbread
Carl Shapiro [Fri, 3 Sep 2010 19:14:46 +0000 (12:14 -0700)]
Merge "Operate on bitmaps directly for live and mark checks." into gingerbread

13 years agoCorrect Volatile SGET/SPUT format tag, add missing cases for JIT
buzbee [Fri, 3 Sep 2010 00:16:24 +0000 (17:16 -0700)]
Correct Volatile SGET/SPUT format tag, add missing cases for JIT

Fix for http://b/issue?id=2971877, which was identified via
debug tracing on http://b/issue?id=2971569.  There were a couple
of problems: first, the volatile sget/sput byte codes had the
wrong format tag (22c instead of 21c).  Second, the JIT was missing
a couple of case statments to handle these.  As far as the JIT goes,
this would not have caused correctness problems, but would have
been slower than necessary.

Change-Id: I57a41c4e063642b0c19acba5bb0855dd8ce2d4ba

13 years agoOperate on bitmaps directly for live and mark checks.
Carl Shapiro [Fri, 3 Sep 2010 06:32:25 +0000 (23:32 -0700)]
Operate on bitmaps directly for live and mark checks.

Previously, the card table scan use the valid object check to see if a
given address pointed to a live object header.  This check is overkill
an requires out of line function calls.  With this change, we query the
bitmaps directly during the scan avoiding significant overhead.

Change-Id: Ifccb93edb97154d44a652735c1d34845adf88740

13 years agoNormalize the declaration style.
Carl Shapiro [Fri, 3 Sep 2010 01:24:29 +0000 (18:24 -0700)]
Normalize the declaration style.

Change-Id: I204dec4a80672ea10286cefcff7884b15ebaae51

13 years agoUse an acquiring CAS for lock acquisition.
Carl Shapiro [Thu, 2 Sep 2010 23:43:16 +0000 (16:43 -0700)]
Use an acquiring CAS for lock acquisition.

Change-Id: Idca782aedc8f2071cdfde2fe3dcba0503fa6c9f0

13 years agoMerge "Add additional context to the contention event logging." into gingerbread
Carl Shapiro [Thu, 2 Sep 2010 18:28:32 +0000 (11:28 -0700)]
Merge "Add additional context to the contention event logging." into gingerbread

13 years agoMove the finger computation out of the bitmap scanning callback.
Carl Shapiro [Tue, 31 Aug 2010 23:48:31 +0000 (16:48 -0700)]
Move the finger computation out of the bitmap scanning callback.

The finger computation depends on bitmap internals.  This knowledge
should not be part of the bitmap interface, just its implementation.
This change adds a new walker that computes and passes a finger
argument to a callback.  As part of this change, code to recompute the
end address during a walk has been removed from the ordinary bitmap
walker code.  That check is needed by the scanning walk as its
callback may advance the max address when setting mark bits for
objects beyond the finger.

13 years agoReduce the frequency of bitmap walk loop-bound computations.
Carl Shapiro [Mon, 30 Aug 2010 18:10:45 +0000 (11:10 -0700)]
Reduce the frequency of bitmap walk loop-bound computations.

13 years agoImprove the heap verifier's failure report.
Carl Shapiro [Fri, 27 Aug 2010 22:21:13 +0000 (15:21 -0700)]
Improve the heap verifier's failure report.

Previously, when a reference verify failed we would print the location
of the bad reference and abort.  With this change, when a reference
fails to verify we try to print out more context.  First, we dump the
object which contains the bad references and print each reference that
failed verification.  Following that, we scan the roots and the heap
and print all of the objects which reference the bad object.

13 years agoSimplify the bitmap walker subroutines.
Carl Shapiro [Fri, 27 Aug 2010 20:06:48 +0000 (13:06 -0700)]
Simplify the bitmap walker subroutines.

This change...

* Separates walking from sweeping.  Walking had been implemented by a
  sweeping with an empty mark bitmap argument.

* Localizes the finger machinations to scanBitmapCallback.  There is
  one use of the finger but all callbacks received the argument.

* Inlines a simplified bitmap walking routine operating a pointer at a
  time.  Only sweeping benefits from batching decoded addresses.

13 years agoConsistently refer to the mark context as ctx.
Carl Shapiro [Fri, 20 Aug 2010 18:34:18 +0000 (11:34 -0700)]
Consistently refer to the mark context as ctx.

13 years agoCollapse a variable declaration and initialization.
Carl Shapiro [Fri, 20 Aug 2010 18:04:25 +0000 (11:04 -0700)]
Collapse a variable declaration and initialization.

13 years agoCombine a typedef with a struct declaration.
Carl Shapiro [Thu, 19 Aug 2010 23:54:01 +0000 (16:54 -0700)]
Combine a typedef with a struct declaration.

13 years agoUse symbolic constants when computing bits-per-word.
Carl Shapiro [Thu, 19 Aug 2010 21:29:41 +0000 (14:29 -0700)]
Use symbolic constants when computing bits-per-word.

13 years agoMerge "Bitmap naming clean-up." into gingerbread
Carl Shapiro [Thu, 2 Sep 2010 01:22:58 +0000 (18:22 -0700)]
Merge "Bitmap naming clean-up." into gingerbread

13 years agoBitmap naming clean-up.
Carl Shapiro [Thu, 19 Aug 2010 04:04:31 +0000 (21:04 -0700)]
Bitmap naming clean-up.

Disambiguate bitmaps based on their use by adding a "curr" or "prev"
prefix.  Also, fix names in a prototype to match the definition.

13 years agoIntrinsics for float/int and double/long conversions.
Elliott Hughes [Sat, 21 Aug 2010 01:47:36 +0000 (18:47 -0700)]
Intrinsics for float/int and double/long conversions.

[cherry-picked e22bd84c8c8a57ddd86c21a1f65137d549b07935 from dalvik-dev to gingerbread]

Bug: 2935622
Change-Id: Ib4de19033dc4a08f41bf0eb0f7a21dcde216aae3

13 years agoLet <stdbool.h> (or its substitute) get picked up via the preexisting
Dan Bornstein [Wed, 1 Sep 2010 23:44:23 +0000 (16:44 -0700)]
Let <stdbool.h> (or its substitute) get picked up via the preexisting
mechanism in vm/Common.h.

Change-Id: I6b79ee3d67b23d8077567a1bce0a58ae46ceb7f3

13 years agoMerge "Removal of more sampling profiler bits" into gingerbread
Brian Carlstrom [Wed, 1 Sep 2010 21:24:13 +0000 (14:24 -0700)]
Merge "Removal of more sampling profiler bits" into gingerbread

13 years agoRemoval of more sampling profiler bits
Brian Carlstrom [Wed, 1 Sep 2010 17:49:48 +0000 (10:49 -0700)]
Removal of more sampling profiler bits

dalvik/vm/native/SystemThread.[ch] was added for the old sampling
profiler, and can be removed as it's not needed for the new one.

Bug: 2967741
Change-Id: Ibd306b4ba579f9796facbf7a69719b3cb6640762

13 years agoMerge "Split out the optimized dex file handling into its own file." into gingerbread
Dan Bornstein [Wed, 1 Sep 2010 18:54:08 +0000 (11:54 -0700)]
Merge "Split out the optimized dex file handling into its own file." into gingerbread

13 years agoNew Java-based SamplingProfiler
Brian Carlstrom [Wed, 18 Aug 2010 21:27:25 +0000 (14:27 -0700)]
New Java-based SamplingProfiler

Summary:
- libcore: new Java based SamplingProfiler
- dalvik: remove old SamplingProfiler native bits
- frameworks/base: New placeholder SamplingProfilerIntegration
- vendor/google: remove old profiler snapshot parsing code

Details:

libcore

   A new 100% Java SamplingProfiler. While it has more overhead that
   the old native one, the new one can actually collect more than the
   current PC and frame pointer, so you can get useful context of
   where your app is spending time. It currently provides ASCII hprof
   format output for use with tools like PerfAnal
dalvik/src/main/java/dalvik/system/SamplingProfiler.java

    Unit test for the new SamplingProfiler
dalvik/src/test/java/dalvik/system/SamplingProfilerTest.java

    Add core-tests-dalvik
JavaLibrary.mk

dalvik

    Removing native code that supported the old SamplingProfiler
vm/Dvm.mk
vm/native/InternalNative.c
vm/native/dalvik_system_SamplingProfiler.c

frameworks/base

  Placeholder SamplingProfilerIntegration. Later plans include
  generating EventStackTrace protobufs.

    New SamplingProfiler does not have a global instance, so
    SamplingProfilerIntegration provides one in INSTANCE. Old binary
    snapshot format is temporily replaced with ASCII hprof data.
core/java/com/android/internal/os/SamplingProfilerIntegration.java

    Simplified interface for zygote profile snapshotting
core/java/com/android/internal/os/ZygoteInit.java

    Current SamplingProfilerIntegration does not track event loop
    explicitly, but hprof information does include thread information.
core/java/android/app/ActivityThread.java

vendor/google

    Removing code for parsing old SamplingProfiler snapshot format
tools/samplingprofiler/Android.mk
tools/samplingprofiler/NOTICE
tools/samplingprofiler/profiler.iml
tools/samplingprofiler/profiler.ipr
tools/samplingprofiler/pull-snapshots.sh
tools/samplingprofiler/sorttable.js
tools/samplingprofiler/src/com/android/profiler/PrintHtml.java

13 years agoAdd additional context to the contention event logging.
Carl Shapiro [Tue, 31 Aug 2010 22:11:46 +0000 (15:11 -0700)]
Add additional context to the contention event logging.

Previously it only included the victim of lock contention.  With this
change, it also includes the location of the person holding the lock
at the time the victim failed to acquire it.

Bug: 2964633
Change-Id: I888d9c3e7d7611ef5869870c7f8abfb19d236231

13 years agoSplit out the optimized dex file handling into its own file.
Dan Bornstein [Tue, 31 Aug 2010 23:50:00 +0000 (16:50 -0700)]
Split out the optimized dex file handling into its own file.

Also, make the optimized dex data area be consistently referred to as
the "opt" section instead of sometimes the "aux" section.

Change-Id: Id5589c13ce4b53d713f8186314ea886cd884c865

13 years agoIf there's an error dropping privileges, abort.
Nick Kralevich [Mon, 30 Aug 2010 19:49:33 +0000 (12:49 -0700)]
If there's an error dropping privileges, abort.

Change-Id: I85ce12e93cb8c297add756dc3b872b8346eda00b

13 years agoJIT: Add memory barriers on monitor enter/exit [issue 2951403]
buzbee [Thu, 26 Aug 2010 17:46:51 +0000 (10:46 -0700)]
JIT: Add memory barriers on monitor enter/exit [issue 2951403]

Possibly the cause of [2950977 error in onDraw() method for stingray]

Change-Id: I3237c95a34daa75cd680b73d426dde11f3611a0e

13 years agoMake JIT inliner work under single-stepping mode.
Ben Cheng [Thu, 26 Aug 2010 21:56:31 +0000 (14:56 -0700)]
Make JIT inliner work under single-stepping mode.

Bug: 2936661

(cherry-picked from dalvik-dev)

Change-Id: I35a012bd4dba2a2f9541b96a2e787687bbc7cd19

13 years agoFix self-verification to handle loop traces with single-step instructions.
Ben Cheng [Thu, 26 Aug 2010 19:28:56 +0000 (12:28 -0700)]
Fix self-verification to handle loop traces with single-step instructions.

(cherry-picked from dalvik-dev)

Change-Id: If1414d0e6767d36e33db8837e52dc91d11b4969b

13 years agoAdd option for specifying wall-clock in method profiling.
Andy McFadden [Wed, 25 Aug 2010 19:05:44 +0000 (12:05 -0700)]
Add option for specifying wall-clock in method profiling.

Normally you want to use the per-thread CPU clock rather than the wall
clock, because (a) it's more useful and (b) traceview goes a little nuts
if you don't.  However, it's useful for some performance testing.

The command-line option allows you to switch modes like this:

  % adb shell stop
  % adb shell setprop dalvik.vm.extra-opts -Xprofile:wallclock
  % adb shell start

This also changes the somewhat nebulous "clock=global" trace header line
to "clock=wall".  Nothing looks at this anyway so I'm not worried
about breaking compatibility.

While I was in here, I fixed a couple of problems caused by failure to
initialize data structures that made dmtracedump crash (yay valgrind).

Bug 2943229.

(cherry-pick from dalvik-dev)

Change-Id: I2f6657f7abe02f2a17784588d922b88397639a47

13 years agoRevert "JIT: Disable inlining to work around sholes boot crash"
Ben Cheng [Wed, 25 Aug 2010 20:01:54 +0000 (13:01 -0700)]
Revert "JIT: Disable inlining to work around sholes boot crash"

This reverts commit 07ecdc0b5d92099364eebdaee9aec297c4bbad72.

Random crash is confirmed to be caused by a Cortex-A8 bug. Toolchain fix is
pending and the current ToT is not triggering the crash.

(cherry-picked from dalvik-dev)

Change-Id: I12732a1fc2aa894a678bbb71e871e97f655c6814

13 years agoMerge "Change the way thread suspension works." into gingerbread
Andy McFadden [Wed, 25 Aug 2010 19:20:21 +0000 (12:20 -0700)]
Merge "Change the way thread suspension works." into gingerbread

13 years agoChange the way thread suspension works.
Andy McFadden [Mon, 23 Aug 2010 23:45:24 +0000 (16:45 -0700)]
Change the way thread suspension works.

There are at least three ways to handle detection of thread suspension
correctly: (1) hold a mutex, (2) pile all state into a single 32-bit
location and use atomic ops, and (3) order the operations carefully.
Of these, #3 has the least overhead on uniprocessors, so we're going
with that.

It does introduce one quirk, because we're now changing to "running"
mode before checking to see if we're allowed to run.  This creates
a tiny window of opportunity for assertions and thread dumps to see
what appears to be a thread that's running when it shouldn't be.
This is correctable with additional work (e.g. transitioning through
a pre-running state) but probably not worth worrying about.

This eliminates the separate self->isSuspended flag in favor of the
new THREAD_SUSPENDED thread state.

Bug 2667016.

(cherry-pick from dalvik-dev)

Change-Id: Ibc77ebbb03a7993bc4057c1c375498172ca8ff1c

13 years agoFix a DDMS thread monitoring crash.
Andy McFadden [Tue, 24 Aug 2010 21:23:11 +0000 (14:23 -0700)]
Fix a DDMS thread monitoring crash.

We changed the order of events during thread attaches, which means
it's now possible to have Thread structs with null threadObj fields.
This bit of code didn't change with the times, which made it possible
for a process being watched by DDMS to crash if we grabbed the thread
state at just the wrong time.

(cherry-pick from dalvik-dev)

Change-Id: Icd7f523ee8327f00693e601c1c82d3a8defb247f

13 years agoProperly handle volatile field accesses from JNI.
Andy McFadden [Wed, 18 Aug 2010 22:51:37 +0000 (15:51 -0700)]
Properly handle volatile field accesses from JNI.

For uniprocessors, we need to use the 64-bit quasiatomic functions.  For
SMP, we need to do that and also issue barriers on all operations.

This was mostly a matter of adding a bunch of inline getter/setter
functions and then calling the right one based on whether or not the
field is declared volatile.

Also, corrected the output for a failing CHECK_CLASS test in CheckJNI.

Bug 2890631.

(cherry-pick from dalvik-dev)

Change-Id: I3da3b70c906eddd5934347caea83ab041d22cd68

13 years agoMerge remote branch 'goog/dalvik-dev' into dalvik-dev-to-gingerbread
Brian Carlstrom [Thu, 19 Aug 2010 18:21:12 +0000 (11:21 -0700)]
Merge remote branch 'goog/dalvik-dev' into dalvik-dev-to-gingerbread

Also includes cherry-pick of 07ecdc0b5d92099364eebdaee9aec297c4bbad72

Change-Id: Ie1744d78683f2f66dd1586f453f8bdd56ad2e9a5

13 years agoRemove an assertion that cannot be guaranteed.
Carl Shapiro [Thu, 19 Aug 2010 01:10:05 +0000 (18:10 -0700)]
Remove an assertion that cannot be guaranteed.

The intention of this assert was to check that the address range
spanned by the mark bitmap was a proper superset of the live bitmap.
Because allocations can occur before these bitmaps are prepared, the
live bitmap may legitimately expand beyond the range of the mark
bitmap.  As such, this check is not reliable.

Change-Id: I2f23e9e7f3716a61ecf155ba81fd8baa5a82100d

13 years agoSupport dalvikvm on a Linux x86 host
Jesse Wilson [Wed, 18 Aug 2010 18:35:23 +0000 (11:35 -0700)]
Support dalvikvm on a Linux x86 host

Change-Id: Id166ab03a01833e06ec1a9aa0059e4eb28ec04ce

13 years agoAlways support debugging and profiling.
Andy McFadden [Wed, 18 Aug 2010 19:19:51 +0000 (12:19 -0700)]
Always support debugging and profiling.

This eliminates the use of the WITH_DEBUGGER and WITH_PROFILER
conditional compilation flags.  We've never shipped a device without
these features, and it's unlikely we ever will.  They're not worth
the code clutter they cause.

As usual, since I can't test the x86-atom code I left that alone and
added an item to the TODO list.

Bug 2923442.

Change-Id: I335ebd5193bc86f7641513b1b41c0378839be1fe

13 years agoMerge "Nudge a couple of log messages." into dalvik-dev
Andy McFadden [Wed, 18 Aug 2010 14:45:17 +0000 (07:45 -0700)]
Merge "Nudge a couple of log messages." into dalvik-dev

13 years agoMerge "Fix a critical space leak introduced by concurrent sweeping." into dalvik-dev
Carl Shapiro [Wed, 18 Aug 2010 05:47:23 +0000 (22:47 -0700)]
Merge "Fix a critical space leak introduced by concurrent sweeping." into dalvik-dev

13 years agoFix a critical space leak introduced by concurrent sweeping.
Carl Shapiro [Wed, 18 Aug 2010 01:33:56 +0000 (18:33 -0700)]
Fix a critical space leak introduced by concurrent sweeping.

When computing the bitmaps for each heap, the live bitmap was assumed
to have greater extent than the mark bitmap.  With the concurrent
sweep the mark and live bitmaps are swapped before the sweep bitmaps
are computed.  As such, the live bitmap extent is always less than or
equal to the mark bitmap.  A benchmark which loops creating objects
just to drop them on the floor will exclude most objects in the heap
as candidates for sweeping and will exhaust the heap.

The change fixes the extent computation and reintroduces an assert to
check that the bitmap we assume to be the largest is the largest.

Change-Id: I78694d2a0550de70c85e2087d482050a147a207a

13 years agoMerge "Add a little bit of paranoia to the odex data reader." into dalvik-dev
Dan Bornstein [Tue, 17 Aug 2010 22:06:15 +0000 (15:06 -0700)]
Merge "Add a little bit of paranoia to the odex data reader." into dalvik-dev

13 years agoAdd a little bit of paranoia to the odex data reader.
Dan Bornstein [Tue, 17 Aug 2010 00:11:06 +0000 (17:11 -0700)]
Add a little bit of paranoia to the odex data reader.

This prevents some potential segfaults when working with (e.g., trying
to run) corrupted dex files, turning them into more informative error
messages.

Change-Id: Ie6845087bb17a5f65fafbd6f9ff335b6af489996

13 years agoNudge a couple of log messages.
Andy McFadden [Tue, 17 Aug 2010 00:04:01 +0000 (17:04 -0700)]
Nudge a couple of log messages.

Also, don't show errno on a short read.

Related to bug 2916809.

Change-Id: I163906d47b698ac5e77202c323db5823196169bb

13 years agoFix build breakage caused by the countInstancesOfClass change.
Carl Shapiro [Tue, 17 Aug 2010 20:30:48 +0000 (13:30 -0700)]
Fix build breakage caused by the countInstancesOfClass change.

There is an apparent visibility skew between passion-eng and sim-eng
builds.  On sim-eng, the contents of Heap.h are globally visible but
on passion-eng this is not the case.  To resolve this issue, I have
moved the offending declarations to alloc/Alloc.h which is directly
exported from Dalvik.h.

Change-Id: Iaf6f167964f81f24fa0817aa4a84b9fb4ff9a9a0

13 years agoMerge "Add a method for counting the extant instances of a class." into dalvik-dev
Carl Shapiro [Tue, 17 Aug 2010 19:24:44 +0000 (12:24 -0700)]
Merge "Add a method for counting the extant instances of a class." into dalvik-dev

13 years agoAdd a method for counting the extant instances of a class.
Carl Shapiro [Tue, 17 Aug 2010 19:22:49 +0000 (12:22 -0700)]
Add a method for counting the extant instances of a class.

This facility should supersede the use of finalizers in computing
instance counts for the "adb shell dumpsys meminfo" reports.

Change-Id: I026e7083e39aa296bbbcf665231ec20d6b37cdf6

13 years agoMerge "Added fsync call to dexopt." into dalvik-dev
Andy McFadden [Tue, 17 Aug 2010 17:06:58 +0000 (10:06 -0700)]
Merge "Added fsync call to dexopt." into dalvik-dev

13 years agoAdded fsync call to dexopt.
Andy McFadden [Mon, 16 Aug 2010 23:14:06 +0000 (16:14 -0700)]
Added fsync call to dexopt.

If various system-level things go wrong you might end up with a
correctly-written .odex header but an incomplete file, which ideally
would never happen.  This adds an fsync() call before we write the
header to make this less likely.

Change-Id: Ie5ac67dc7185ca9a4995710688e1219e46477c12

13 years agoam bce36059: am 52d4cd28: Rename registers on inlined instructions that use wide...
Ben Cheng [Mon, 16 Aug 2010 22:31:48 +0000 (15:31 -0700)]
am bce36059: am 52d4cd28: Rename registers on inlined instructions that use wide operands.

Merge commit 'bce36059dd1021b0cd06c02c3a9849ae6da4741b' into dalvik-dev

* commit 'bce36059dd1021b0cd06c02c3a9849ae6da4741b':
  Rename registers on inlined instructions that use wide operands.

13 years agoam 52d4cd28: Rename registers on inlined instructions that use wide operands.
Ben Cheng [Mon, 16 Aug 2010 22:19:46 +0000 (15:19 -0700)]
am 52d4cd28: Rename registers on inlined instructions that use wide operands.

Merge commit '52d4cd28a5d6d946934704e11e1d41450c10aa05'

* commit '52d4cd28a5d6d946934704e11e1d41450c10aa05':
  Rename registers on inlined instructions that use wide operands.

13 years agoRename registers on inlined instructions that use wide operands.
Ben Cheng [Mon, 16 Aug 2010 21:08:49 +0000 (14:08 -0700)]
Rename registers on inlined instructions that use wide operands.

For example, v1 in the callee should be v7 in the caller.

Before:
div-double v7, v8, v10
iput-wide-quick (C) v1, v6, (#136) <- v1 should be renamed
invoke-virtual-quick (PI) v6, v7, v8

After:
div-double v7, v8, v10
iput-wide-quick (C) v7, v6, (#136)
invoke-virtual-quick (PI) v6, v7, v8

Bug: 2907602

Change-Id: I21b9a45f8e422148d45de98c1ec9acbfd9783cc6

13 years agoJIT: Fix for armv5te-VFP bug [Issue 2916682]
buzbee [Sat, 14 Aug 2010 00:52:46 +0000 (17:52 -0700)]
JIT: Fix for armv5te-VFP bug [Issue 2916682]

Temp register was clobbered after explicit use rather than before.
Affects only armv5te-vfp builds.

Change-Id: I0a1c3f69a299f31bd50f3ec95ae83681b89ae6f1

13 years agoCast to a byte pointer before performing arithmetic.
Carl Shapiro [Thu, 12 Aug 2010 20:55:06 +0000 (13:55 -0700)]
Cast to a byte pointer before performing arithmetic.

Change-Id: I1efd3b327b8c0a052c975ed07ee0db648ba84581

13 years agoLimit scanning to cards within the committed region of the heap.
Carl Shapiro [Thu, 12 Aug 2010 18:24:44 +0000 (11:24 -0700)]
Limit scanning to cards within the committed region of the heap.

The initial implementation of the card scanning routine scanned all
cards in the card table.  For heaps that are less than the maximum
allowed size time was wasted scanning cards that are never dirtied.

Change-Id: I599c53a1777bf38b4d7b19438eb7584f9ba578ec

13 years agoMerge "Remove a malfunctioning predicate used only in assertions." into dalvik-dev
Carl Shapiro [Wed, 11 Aug 2010 02:23:22 +0000 (19:23 -0700)]
Merge "Remove a malfunctioning predicate used only in assertions." into dalvik-dev

13 years agoRemove a malfunctioning predicate used only in assertions.
Carl Shapiro [Wed, 11 Aug 2010 01:07:44 +0000 (18:07 -0700)]
Remove a malfunctioning predicate used only in assertions.

This check thought it filtered pointers aligned on 4-byte boundaries
and inclusion in the heap but actually checked for pointers on 8-byte
boundaries.  Both checks surround storing method call return values
which are gauranteed to be stack allocated.

Change-Id: I9cfd9eb06c5bd1d5cf55b372771da20425c56406

13 years agoRemove debugging code and stale comments from the sweep callback.
Carl Shapiro [Wed, 11 Aug 2010 00:28:12 +0000 (17:28 -0700)]
Remove debugging code and stale comments from the sweep callback.

Change-Id: Idf5e26354179a0d8c519c85880ad218603878722

13 years agoFix build breakage caused by a bad merge from master.
Carl Shapiro [Wed, 11 Aug 2010 00:20:15 +0000 (17:20 -0700)]
Fix build breakage caused by a bad merge from 

Change-Id: I2da195733b3c78fea2865b0bdc0b5a5bf9ec60fe

13 years agoMerge "JIT: Correct conversion of cb[n]z to cmp/cond_br pair" into dalvik-dev
buzbee [Tue, 10 Aug 2010 23:26:24 +0000 (16:26 -0700)]
Merge "JIT: Correct conversion of cb[n]z to cmp/cond_br pair" into dalvik-dev

13 years agoam 8881a809: Sweep concurrently.
Carl Shapiro [Tue, 10 Aug 2010 23:16:57 +0000 (16:16 -0700)]
am 8881a809: Sweep concurrently.

Merge commit '8881a8098e259a1faf392d20c1fefc1ee4a63b20' into dalvik-dev

* commit '8881a8098e259a1faf392d20c1fefc1ee4a63b20':
  Sweep concurrently.

13 years agoJIT: Correct conversion of cb[n]z to cmp/cond_br pair
buzbee [Tue, 10 Aug 2010 22:50:34 +0000 (15:50 -0700)]
JIT: Correct conversion of cb[n]z to cmp/cond_br pair

This fixes the regression introduced in the fast assembly retry
that was causing excessive bailouts.  The good news is that with
this fix, we're seeing a ~5% boost in Linpack because of the
cb[n]z usage.

Change-Id: Ib4a48dcba809af4343456eae49a90b4a1e3aee9d

13 years agoSweep concurrently.
Carl Shapiro [Tue, 10 Aug 2010 22:55:45 +0000 (15:55 -0700)]
Sweep concurrently.

After marking, exchange the mark and live bitmaps and resume all
threads.  The sweep proceeds concurrently viewing the new live bitmap
as the old mark bitmap thereby permitting allocations performed while
sweeping to update the live bitmap.

Change-Id: I9c307190a14ce417413175db016be41c38aeeaf3

13 years agoam cb7c47d0: am d012d06b: Fix the ordering of lock acquisition in the heap worker.
Carl Shapiro [Tue, 10 Aug 2010 03:10:35 +0000 (20:10 -0700)]
am cb7c47d0: am d012d06b: Fix the ordering of lock acquisition in the heap worker.

Merge commit 'cb7c47d047f80952a69f1d2a7200c589754b4870' into dalvik-dev

* commit 'cb7c47d047f80952a69f1d2a7200c589754b4870':
  Fix the ordering of lock acquisition in the heap worker.

13 years agoam 577a8269: am 34bfe020: Fix a couple copyright headers that aren\'t in the prescrib...
Dan Bornstein [Tue, 10 Aug 2010 03:10:30 +0000 (20:10 -0700)]
am 577a8269: am 34bfe020: Fix a couple copyright headers that aren\'t in the prescribed format.

Merge commit '577a826937acddadafd9b901dbafdec27d4613fc' into dalvik-dev

* commit '577a826937acddadafd9b901dbafdec27d4613fc':
  Fix a couple copyright headers that aren't in the prescribed format.

13 years agoam d012d06b: Fix the ordering of lock acquisition in the heap worker.
Carl Shapiro [Tue, 10 Aug 2010 02:57:04 +0000 (19:57 -0700)]
am d012d06b: Fix the ordering of lock acquisition in the heap worker.

Merge commit 'd012d06b0673c3da9d23b1816ff5a325576eb9b3'

* commit 'd012d06b0673c3da9d23b1816ff5a325576eb9b3':
  Fix the ordering of lock acquisition in the heap worker.

13 years agoam 34bfe020: Fix a couple copyright headers that aren\'t in the prescribed format.
Dan Bornstein [Tue, 10 Aug 2010 02:57:01 +0000 (19:57 -0700)]
am 34bfe020: Fix a couple copyright headers that aren\'t in the prescribed format.

Merge commit '34bfe020eccbe4034322c5952012612b0540acb3'

* commit '34bfe020eccbe4034322c5952012612b0540acb3':
  Fix a couple copyright headers that aren't in the prescribed format.

13 years agoFix the ordering of lock acquisition in the heap worker.
Carl Shapiro [Fri, 6 Aug 2010 22:17:46 +0000 (15:17 -0700)]
Fix the ordering of lock acquisition in the heap worker.

A feature of the concurrent GC is that gcHeapLock is released while
roots are traced through.  This complicates the heap worker thread as
it assumes that when the gcHeapLock can be acquired no threads are
contending for the heapWorkerLock.  However, the concurrent GC holds
heapWorkerLock for the duration of a GC.  If the heap worker thread
becomes active while the GC temporarily release gcHeapLock it may
deadlock the GC by acquring the gcHeapLock, needed by the GC during
its final pause, and wait for the heapWorkerLock held by the GC.

This change attempts to resolve this issue by checking to see if after
a transition into running whether the GC has become active.  If so, it
releases gcHeapLock and reacquires it after the GC has signaled
completion.  This must be done in a loop as there is no guarantee that
the GC has not become active when heap worker is rescheduled.

13 years agoFix a couple copyright headers that aren't in the prescribed format.
Dan Bornstein [Wed, 4 Aug 2010 01:09:42 +0000 (18:09 -0700)]
Fix a couple copyright headers that aren't in the prescribed format.

Change-Id: I4de4dc69d8989f1add431e58533c7e633f67e550

13 years agoam ff3cc1d1: Merge "Fix the ordering of lock acquisition in the heap worker."
Carl Shapiro [Mon, 9 Aug 2010 21:18:01 +0000 (14:18 -0700)]
am ff3cc1d1: Merge "Fix the ordering of lock acquisition in the heap worker."

Merge commit 'ff3cc1d1dfb03da6065879d26089d6f2ca129dcc' into dalvik-dev

* commit 'ff3cc1d1dfb03da6065879d26089d6f2ca129dcc':
  Fix the ordering of lock acquisition in the heap worker.

13 years agoMerge "Fix the ordering of lock acquisition in the heap worker."
Carl Shapiro [Mon, 9 Aug 2010 21:15:11 +0000 (14:15 -0700)]
Merge "Fix the ordering of lock acquisition in the heap worker."

13 years agoam 5ba39376: Implement card table verification.
Carl Shapiro [Mon, 9 Aug 2010 20:40:12 +0000 (13:40 -0700)]
am 5ba39376: Implement card table verification.

Merge commit '5ba39376c5b7a5878f234a689a51c74783583b4b' into dalvik-dev

* commit '5ba39376c5b7a5878f234a689a51c74783583b4b':
  Implement card table verification.

13 years agoImplement card table verification.
Carl Shapiro [Sat, 7 Aug 2010 00:07:53 +0000 (17:07 -0700)]
Implement card table verification.

Card table verification occurs just before scanning the card table
during a concurrent GC.  Each object in the bitmap is visited and the
number of white (unmarked) references are counted.  If an object has
unmarked objects it is by definition gray and must reside on a dirty
card.  If the object is not on a dirty card, the verification routine
aborts the VM.

Because the processing of weak roots and references has yet to occur,
reachable reference objects with unmarked referents and weak interned
strings may still be gray.  These objects are checked during the card
table scan and ignored if their card is not dirty.

Change-Id: I64d145aa4719fb52eb9e3bb91efaf4dcfacd6e0c

13 years agoMerge "Print callee information in the JIT profile outout" into dalvik-dev
Ben Cheng [Mon, 9 Aug 2010 18:30:50 +0000 (11:30 -0700)]
Merge "Print callee information in the JIT profile outout" into dalvik-dev

13 years agoam 6a7a5c24: Merge "Remove stale comments."
Carl Shapiro [Sat, 7 Aug 2010 01:54:29 +0000 (18:54 -0700)]
am 6a7a5c24: Merge "Remove stale comments."

Merge commit '6a7a5c2475f7d6c179cb671778d08461e585dbd3' into dalvik-dev

* commit '6a7a5c2475f7d6c179cb671778d08461e585dbd3':
  Remove stale comments.

13 years agoam 1ff61c3d: Merge "Rename verifyHeap and eliminate its bogus function-level comment."
Carl Shapiro [Sat, 7 Aug 2010 01:54:25 +0000 (18:54 -0700)]
am 1ff61c3d: Merge "Rename verifyHeap and eliminate its bogus function-level comment."

Merge commit '1ff61c3df16591b6b2022e287862c7a38009b4c7' into dalvik-dev

* commit '1ff61c3df16591b6b2022e287862c7a38009b4c7':
  Rename verifyHeap and eliminate its bogus function-level comment.

13 years agoFix the ordering of lock acquisition in the heap worker.
Carl Shapiro [Fri, 6 Aug 2010 22:17:46 +0000 (15:17 -0700)]
Fix the ordering of lock acquisition in the heap worker.

A feature of the concurrent GC is that gcHeapLock is released while
roots are traced through.  This complicates the heap worker thread as
it assumes that when the gcHeapLock can be acquired no threads are
contending for the heapWorkerLock.  However, the concurrent GC holds
heapWorkerLock for the duration of a GC.  If the heap worker thread
becomes active while the GC temporarily release gcHeapLock it may
deadlock the GC by acquring the gcHeapLock, needed by the GC during
its final pause, and wait for the heapWorkerLock held by the GC.

This change attempts to resolve this issue by checking to see if after
a transition into running whether the GC has become active.  If so, it
releases gcHeapLock and reacquires it after the GC has signaled
completion.  This must be done in a loop as there is no guarantee that
the GC has not become active when heap worker is rescheduled.

Change-Id: Ia30481cc597cea837529eab4f85ba86b02691efe

13 years agoPrint callee information in the JIT profile outout
Ben Cheng [Fri, 6 Aug 2010 23:42:50 +0000 (16:42 -0700)]
Print callee information in the JIT profile outout

For example:
TRACEPROFILE 0x48bbb2d4      11057  0.55% [0x45d(+1), 14011] ...
    -> Ljava/util/HashMap$HashIterator;hasNext;()Z

It means the trace ends with a call to hasNext(), and inlining
probably won't help the overall performance more than 0.55%.

Change-Id: I9bf2a79c48d6cb569a9fe2e329022edf968664bb

13 years agoMerge "JIT: Fix for lightweight assembler retry mechanism." into dalvik-dev
buzbee [Fri, 6 Aug 2010 21:27:18 +0000 (14:27 -0700)]
Merge "JIT: Fix for lightweight assembler retry mechanism." into dalvik-dev

13 years agoJIT: Fix for lightweight assembler retry mechanism.
buzbee [Fri, 6 Aug 2010 21:20:14 +0000 (14:20 -0700)]
JIT: Fix for lightweight assembler retry mechanism.

Removed a special path in the assembler that took in sideband
info on some instructions and used it to modify pc-relative load
addresses.  This mechanism (used in some older chaining cells) is
no longer needed, and was causing a problem for the new lightweight
assembler retry mechanism.

Change-Id: I1cca5b719bcdea0810831d889ebe2f935c61966f

13 years agoMerge "Fix some potential SMP issues." into dalvik-dev
Andy McFadden [Fri, 6 Aug 2010 18:26:45 +0000 (11:26 -0700)]
Merge "Fix some potential SMP issues." into dalvik-dev

13 years agoMerge "Remove stale comments."
Carl Shapiro [Fri, 6 Aug 2010 18:16:30 +0000 (11:16 -0700)]
Merge "Remove stale comments."

13 years agoMerge "Rename verifyHeap and eliminate its bogus function-level comment."
Carl Shapiro [Fri, 6 Aug 2010 18:16:21 +0000 (11:16 -0700)]
Merge "Rename verifyHeap and eliminate its bogus function-level comment."

13 years agoJIT: Fix for 2898397 assert in JIT (chain cell offset)
buzbee [Thu, 5 Aug 2010 23:34:36 +0000 (16:34 -0700)]
JIT: Fix for 2898397 assert in JIT (chain cell offset)

My previous change to allow for lightweight assembler retries neglected
to restore a sanity check cookie when re-assembling without fully rebuilding
the trace.

Change-Id: Ief7eb76263e272b9cd79345f8344bd35926f5b10

13 years agoMore SMP fixes.
Andy McFadden [Thu, 5 Aug 2010 21:34:26 +0000 (14:34 -0700)]
More SMP fixes.

Convert some ANDROID_MEMBAR_FULL uses into equivalent atomic ops.  A
couple of "bool" had to convert to "int" since we don't have atomic
ops for bools.

Replaced a local implementation of atomic inc with a call to the
atomic inc function.

Change-Id: I948b8080d743552bde014d3a6e716ed2c30ebef8

13 years agoam b0691476: Remove stale overwritefree flag.
Carl Shapiro [Fri, 6 Aug 2010 05:11:37 +0000 (22:11 -0700)]
am b0691476: Remove stale overwritefree flag.

Merge commit 'b0691476e24deae014dadbdbbceabc72d5a96ae6' into dalvik-dev

* commit 'b0691476e24deae014dadbdbbceabc72d5a96ae6':
  Remove stale overwritefree flag.

13 years agoRename verifyHeap and eliminate its bogus function-level comment.
Carl Shapiro [Fri, 6 Aug 2010 04:49:07 +0000 (21:49 -0700)]
Rename verifyHeap and eliminate its bogus function-level comment.

Change-Id: I09870de2710d03059faf6abce016e282865d2227

13 years agoFix some potential SMP issues.
Andy McFadden [Wed, 4 Aug 2010 23:09:10 +0000 (16:09 -0700)]
Fix some potential SMP issues.

Wandered through Thread.c looking for SMP trouble spots.  Changed a
couple of stores to android_atomic_release_store, and added some
comments.

Also, wrapped the self-suspend stuff that's in the thread status change
code so it only happens if we're actually going to suspend the thread.

Change-Id: I2d3feae7ce8937eada9111bd31928b61875a86d3

13 years agoRemove stale overwritefree flag.
Carl Shapiro [Fri, 6 Aug 2010 03:21:42 +0000 (20:21 -0700)]
Remove stale overwritefree flag.

Change-Id: If14998128245245c908b2390acfe28b82339f8bf