OSDN Git Service

android-x86/dalvik.git
13 years agoam 70b130f5: (-s ours) Clean up/out some comments. DO NOT MERGE.
Dan Bornstein [Fri, 14 Jan 2011 20:37:13 +0000 (12:37 -0800)]
am 70b130f5: (-s ours) Clean up/out some comments. DO NOT MERGE.

* commit '70b130f5398c43418b6eacba2cc09f71d9febdc4':
  Clean up/out some comments. DO NOT MERGE.

13 years agoClean up/out some comments. DO NOT MERGE.
Dan Bornstein [Fri, 14 Jan 2011 20:26:12 +0000 (12:26 -0800)]
Clean up/out some comments. DO NOT MERGE.

Change-Id: I16063cf9132e0f2d6556ce06e1ebfb90ecff05aa

13 years agoam 80a30431: (-s ours) Remove some pointless tests.
Dan Bornstein [Thu, 13 Jan 2011 22:33:39 +0000 (14:33 -0800)]
am 80a30431: (-s ours) Remove some pointless tests.

* commit '80a30431fa6c92433d2602c159bc71dd81c62c8f':
  Remove some pointless tests.

13 years agoRemove some pointless tests.
Dan Bornstein [Thu, 13 Jan 2011 20:46:28 +0000 (12:46 -0800)]
Remove some pointless tests.

Change-Id: Ibaaf74fbdffd6c08af48cac50ef62a05e8473899

13 years agoHandle the case of referent clearing during tracing.
Carl Shapiro [Wed, 12 Jan 2011 01:16:48 +0000 (17:16 -0800)]
Handle the case of referent clearing during tracing.

Reference objects with non-null referent fields are collected during
tracing for processing after the trace has completed.  Before the
trace was made concurrent there was no way for a reference with a
non-null referent field to have its referent become null by any action
of the garbage collector after it was discovered.  Assertions were
placed in the reference processing code to check this invariant.

After the trace was made concurrent it became possible for a user to
clear the referent field of an already discovered reference.  This
violates the assertions in the reference processing code.

This change replaces the assertions in the reference processing code
with logic to deal with null referent fields.  The assert in the
SoftReference preservation code has been converted to a continue that
short circuits the preservation logic.  The assert in the white
reference clearing code short circuits the clearing and enqueueing.

Bug: 3342757
Change-Id: I967b011485e2691b2752500a3488fbcb54f129d3

13 years agoParameterize instance counting to include subclasses.
Carl Shapiro [Thu, 4 Nov 2010 22:12:09 +0000 (15:12 -0700)]
Parameterize instance counting to include subclasses.

13 years agoFix for Issue 3161543 - Remove stray line of code in JIT
buzbee [Wed, 3 Nov 2010 17:44:15 +0000 (10:44 -0700)]
Fix for Issue 3161543 - Remove stray line of code in JIT

During Change 22370 "Thumb/Thumb2 instruction selection rework"
line 1689 of Codegen.c was inadvertently duplicated and deposited
in the unrelated function genPuntToInterp() at line 1732.

genPuntToInterp() is rarely used and half of the time (if the
roll-back Dalvik PC was word-aligned) the error would have been
benign.  However, if the Dalvik PC is not word-aligned, the result
would be a seg fault.

The fix is to remove the line of code.

Change-Id: Ib2ffb80059a639923c342a36797eb6c4995c5218

13 years agoam 886130bc: (-s ours) Two patches.
Andy McFadden [Tue, 9 Nov 2010 02:13:32 +0000 (18:13 -0800)]
am 886130bc: (-s ours) Two patches.

* commit '886130bc7ff992940e152636f57072e58c91aa2e':
  Two patches.

13 years agoTwo patches.
Andy McFadden [Tue, 9 Nov 2010 01:05:39 +0000 (17:05 -0800)]
Two patches.

Patch 1a+1b: Set capabilities sooner.

(cherry-pick from gingerbread I22fde728bd5d65774f8fdf1fa45956fe18358c4c)
(hand-pick from gingerbread Ief58bdfff2cb82d7824ef796c2c1031f525f6ee9,
 plus minor tweak to avoid altering the API)

Patch 3: If there's an error dropping privileges, abort.

(cherry-pick from gingerbread I85ce12e93cb8c297add756dc3b872b8346eda00b)

Bug 3176774

Change-Id: If8285d7bfd5a466bd77c0f7ffadf1bf96d31db06

13 years agoam fbe51551: (-s ours) Remove a pointless test, which just tested a test support...
Dan Bornstein [Sat, 30 Oct 2010 01:29:27 +0000 (18:29 -0700)]
am fbe51551: (-s ours) Remove a pointless test, which just tested a test support class.

* commit 'fbe515510323ee65ce594b8eda5547c1cbfb8ad9':
  Remove a pointless test, which just tested a test support class.

13 years agoRemove a pointless test, which just tested a test support class.
Dan Bornstein [Sat, 30 Oct 2010 01:23:19 +0000 (18:23 -0700)]
Remove a pointless test, which just tested a test support class.

Change-Id: Ia6d47860ad71f013fef5631bcd434c2f6f1d346f

13 years agoam 3144eec0: (-s ours) Replace the implementation of this class.
Dan Bornstein [Sat, 30 Oct 2010 00:00:32 +0000 (17:00 -0700)]
am 3144eec0: (-s ours) Replace the implementation of this class.

* commit '3144eec027b6a0de24f024c286e4544b1aca683b':
  Replace the implementation of this class.

13 years agoReplace the implementation of this class.
Dan Bornstein [Fri, 29 Oct 2010 22:27:54 +0000 (15:27 -0700)]
Replace the implementation of this class.

Use the Apache Harmony version.

Change-Id: Ica3b4c69ccd1cd4c91325c52fad5a71695d58ba4

13 years agoSet capabilities sooner.
Andy McFadden [Wed, 27 Oct 2010 18:25:13 +0000 (11:25 -0700)]
Set capabilities sooner.

Bug 3135433.

Change-Id: I22fde728bd5d65774f8fdf1fa45956fe18358c4c

13 years agoFix for array lower-bound check for count-down loops.
Ben Cheng [Tue, 26 Oct 2010 03:54:31 +0000 (20:54 -0700)]
Fix for array lower-bound check for count-down loops.

If the counted loop is composed as

for (int i = hi; i >= lo; i--) {
    .. = array[i];
}

The hoisted lower-bound check should be asserting "lo >= 0".
On the other hand if the counted loop is composed as

for (int i = hi; i > lo; i--) {
    .. = array[i];
}

The hoisted lower-bound check should be asserting "lo + 1 >= 0".
Previously these two checks are reversed.

Bug: 3130818
Change-Id: Ibc5a6daa837880e9986e45bbc29d1a5e548be3ae

13 years agoFix class loader interning following a String.intern.
Carl Shapiro [Wed, 20 Oct 2010 00:27:13 +0000 (17:27 -0700)]
Fix class loader interning following a String.intern.

Strings can be intered by the class loader, in the case of string
literals, or by the user, through String.intern.  Literal strings
exist for the life of their referencing classes.  User strings are
weak and may be garbage collected when unreferenced.  These two
classes of strings are kept in seprate tables for the conveniance of
the garbage collector during root traversal.

When a class loader interns a string that was already interned by the
user the runtime must move the string from the intern table to the
literal table to increase the reference strength.  Previously, this
was implemented by inserting the incoming string into the literal
table and removing any matching strings in the intern table.  This
transition lost pointer equality.  With this change we first insert
the exact string from the intern table into the literal table and
secondly remove its reference from the intern table.  By moving the
string between tables pointer equality is preserved.

At this point lookupInternedString should be split into two functions,
possibly by pulled up the relevant bits into the public interface
functions.  Since this change will be merged to gingerbread I will
leave the clean up to a separate change.

Bug: 3098960

13 years agoMerge "Update heap dump notes. DO NOT MERGE." into gingerbread
Andy McFadden [Tue, 19 Oct 2010 18:19:28 +0000 (11:19 -0700)]
Merge "Update heap dump notes.  DO NOT MERGE." into gingerbread

13 years agoUpdate heap dump notes. DO NOT MERGE.
Andy McFadden [Tue, 19 Oct 2010 17:15:14 +0000 (10:15 -0700)]
Update heap dump notes.  DO NOT MERGE.

We brought over the VM change that removed SIGUSR1 as a way to cause
an hprof dump, but didn't bring the replacement command-line stuff
("am dumpheap" and the updated version of runhat).  This updates the
documentation to reflect the state of the world in gingerbread.

Bug 3110872.

Change-Id: Ia64190584a344995670e663636e8e2c0983fb29f

13 years agoMerge "Exit early if the we encounter a null reference." into gingerbread
Carl Shapiro [Tue, 19 Oct 2010 04:22:43 +0000 (21:22 -0700)]
Merge "Exit early if the we encounter a null reference." into gingerbread

13 years agoExit early if the we encounter a null reference.
Carl Shapiro [Mon, 18 Oct 2010 23:27:29 +0000 (16:27 -0700)]
Exit early if the we encounter a null reference.

Bug: 3108418
Change-Id: I057e7a674e2ab96671f4651811071b6810250528

13 years agoPop call frame before boxing result
Andy McFadden [Mon, 18 Oct 2010 20:28:31 +0000 (13:28 -0700)]
Pop call frame before boxing result

After reflective method calls, primitive results need to be boxed
up in an appropriate object.  This generally requires allocating an
object of the appropriate type.  We were doing this before popping
the call frame, which meant that if the allocation caused a GC we
would be scanning results out of a "dead" stack frame.

We hit a case where a register went from holding a reference to
holding a primitive right before the method returned.  The exported
PC was pointing at the last GC point, where the register was expected
to hold a reference, so precise GC was getting very confused.

Bug 3102352.

(cherry-pick from dalvik-dev)

Change-Id: I21f59f1d70689d9e4901deb3100c756fd85223e7

13 years agox86 mterp: fix cherry-pick/merge, issue 3095771
buzbee [Thu, 14 Oct 2010 00:47:52 +0000 (17:47 -0700)]
x86 mterp: fix cherry-pick/merge, issue 3095771

Bug http://b/issue?id=3095771

Change
https://android-git.corp.google.com/g/#change,70700
was a cherry-pick/merge of
https://android-git.corp.google.com/g/#change,70388

It was not properly merged, and resulting in the register holding
the object head to be trashed (and subsequently broke GC).

Change-Id: Ic480104e3a643a5b744d36eb0aefaedd3e4f925c

13 years agoSDK: fix dx shell script to look for dx.jar in platform-tools
Raphael [Wed, 13 Oct 2010 20:11:07 +0000 (13:11 -0700)]
SDK: fix dx shell script to look for dx.jar in platform-tools

Change-Id: I4b644dc686f1da75ef7fb34ea874b54ce44f8391

13 years agoMerge "Added some threading notes" into gingerbread
Andy McFadden [Mon, 11 Oct 2010 22:35:54 +0000 (15:35 -0700)]
Merge "Added some threading notes" into gingerbread

13 years agoAdd include guards to avoid multiple definitions.
Carl Shapiro [Mon, 11 Oct 2010 21:55:08 +0000 (14:55 -0700)]
Add include guards to avoid multiple definitions.

Change-Id: I2a52823325a0a582a746890af7f040324d671806

13 years agoAdded some threading notes
Andy McFadden [Mon, 11 Oct 2010 21:46:25 +0000 (14:46 -0700)]
Added some threading notes

Explain thread attach/detach, behavior of threads running native code.
Added pthread_key_create destructor note to backward compatibility
section.

Change-Id: I954708c9ec7c83ba951c0f512c88d5c610a49411

13 years agoMerge "Use the break position of the current mspace for sizing the zygote heap."...
Carl Shapiro [Mon, 11 Oct 2010 06:03:22 +0000 (23:03 -0700)]
Merge "Use the break position of the current mspace for sizing the zygote heap." into gingerbread

13 years agoUse the break position of the current mspace for sizing the zygote heap.
Carl Shapiro [Mon, 11 Oct 2010 01:50:22 +0000 (18:50 -0700)]
Use the break position of the current mspace for sizing the zygote heap.

Previously, the mspace footprint used the "overhead" of a heap which
underestimates the size of the zygote heap by 16 bytes, the specific
size of a descriptor deposited at the start of an mspace containing
the control information about that mspace.  If a heap is a multiple of
a page or within 15 bytes of it, the size of the new heap would be
underestimated.

Bad things happened when this underestimate was used to create an
application heap.  The starting address of the application heap was
based on a correctly computed value instead of the underestimate.
This caused the application heap to be one page to large and end one
page beyond where it should.  This additional page happened to overlap
the first page one of the heap bitmaps.  Furthermore, the mspace
routine would proceed access protect that page thinking it was unused
free space.  During the next GC reads to the first page of the bitmap
would generate a SIGSEGV.

By using the break position, correctly rounded, for all sizing
computations this problem no longer exists.

Change-Id: Icb3c82731e589747e8e4cf16d0797052e64b3ad5

13 years agoVerify method invocation type.
Andy McFadden [Sun, 10 Oct 2010 19:59:11 +0000 (12:59 -0700)]
Verify method invocation type.

Dalvik provides five different ways to invoke a method (virtual, super,
direct, static, interface).  Using a virtual invoke instruction to call
a direct method will not produce the desired results.

This adds a test to the verifier that ensures the method targeted by
an invocation instruction is of an appropriate kind.

Bug 3082885.

(cherry-pick from dalvik-dev)

Change-Id: I3237cbefc7314f0b9d7557fc0bfd2b548ea30938

13 years agoClarify the invoke-* opcodes.
Dan Bornstein [Sun, 10 Oct 2010 19:29:07 +0000 (12:29 -0700)]
Clarify the invoke-* opcodes.

In particular, make it a little more explicit what kinds of methods
are acceptable for each variant.

Change-Id: Icd9dad876c2d10c23462b4d85ccaa9441d7f2c04

13 years agoMerge "Include static fields when dumping class objects." into gingerbread
Carl Shapiro [Fri, 1 Oct 2010 19:54:52 +0000 (12:54 -0700)]
Merge "Include static fields when dumping class objects." into gingerbread

13 years agoInclude static fields when dumping class objects.
Carl Shapiro [Fri, 1 Oct 2010 00:20:11 +0000 (17:20 -0700)]
Include static fields when dumping class objects.

Change-Id: I8e7b1d1ef7ca205b489744dcbf0f210c1f2443c4

13 years agoMerge "Change Runtime.nativeLoad to return the dlerror(3) string." into gingerbread
Elliott Hughes [Fri, 1 Oct 2010 17:35:13 +0000 (10:35 -0700)]
Merge "Change Runtime.nativeLoad to return the dlerror(3) string." into gingerbread

13 years agoGC Card marking fix for SPUT_OBJECT - use correct object head
buzbee [Fri, 1 Oct 2010 02:08:20 +0000 (19:08 -0700)]
GC Card marking fix for SPUT_OBJECT - use correct object head

Change-Id: I8b84a4f1e1690f5b62de7404ea6ede00317848bb

13 years agoChange Runtime.nativeLoad to return the dlerror(3) string.
Elliott Hughes [Thu, 30 Sep 2010 22:51:31 +0000 (15:51 -0700)]
Change Runtime.nativeLoad to return the dlerror(3) string.

This has a companion change in libcore:
  https://android-git.corp.google.com/g/71342

Bug: 3044042
Change-Id: I070a80a41ec2f306f5092a641807017f70179451

13 years agoCorrect dexopt for uniprocessors.
Andy McFadden [Thu, 30 Sep 2010 21:02:54 +0000 (14:02 -0700)]
Correct dexopt for uniprocessors.

The SMP flag was defaulting to "true" for dexopt, even on uniprocessors.
With this change the VM now has three choices: dexopt for SMP, dexopt
for uniprocessor, or dexopt for current system.  The last is used for
just-in-time dexopt (used by -eng and -userdebug builds on bootstrap DEX
files) and installd dexopt (used for apps on all builds).

The dexopt used by the build system during -user builds will either be
explicitly SMP or explicitly uniprocessor, since "current system" has
no meaning when you're cross-dexopting.

Also, unified the dexopt control flags into a single enum.

(cherry-pick from dalvik-dev)

Change-Id: Id1d9c548ca8567585a28ef9ee911cc2ac6b116dd

13 years agoBe explicit about both uniprocessor and SMP when calling dexopt.
Dan Bornstein [Thu, 30 Sep 2010 22:04:34 +0000 (15:04 -0700)]
Be explicit about both uniprocessor and SMP when calling dexopt.

Change-Id: Ic1b68dddf6822773041de6023c594a062e141325

13 years agoMerge "After trimming, set the footprint to the number of pages in use." into gingerbread
Carl Shapiro [Wed, 29 Sep 2010 21:27:50 +0000 (14:27 -0700)]
Merge "After trimming, set the footprint to the number of pages in use." into gingerbread

13 years agoMerge "Update the card table scanning for header-only card marks." into gingerbread
Carl Shapiro [Wed, 29 Sep 2010 19:38:19 +0000 (12:38 -0700)]
Merge "Update the card table scanning for header-only card marks." into gingerbread

13 years agoUpdate the card table scanning for header-only card marks.
Carl Shapiro [Wed, 29 Sep 2010 08:09:11 +0000 (01:09 -0700)]
Update the card table scanning for header-only card marks.

Previously, the card table accessors assumed that objects had either
their header marked or would be marked exactly.  As such, after
reckoning a marked card the scan would back up until it found an
object header and then move forward blackening each object within the
address range of the marked card.

Following a recent change we exclusively mark headers.  The scan only
has to move forward until the end of a card.  This saves scanning time
as dlmalloc's binning may leave large segments of the heap unused.  It
is not uncommon for hundreds of cards to be spanned when backing up to
the first live object below a marked card.

In addition, this change fixes the card table verifier to search the
mark stack for gray objects.  It is permissible for roots to point to
white objects on unmarked cards.  This was incorrectly treated as an
error.

Change-Id: Ia6b6ee2012e381d644b8b3f38b39d746749ea47a

13 years agoAfter trimming, set the footprint to the number of pages in use.
Carl Shapiro [Wed, 29 Sep 2010 03:30:42 +0000 (20:30 -0700)]
After trimming, set the footprint to the number of pages in use.

A trim can decrease the an mspace footprint but it will not decrease
its max footprint.  We need to decrease the max footprint to make any
pages recovered by a trim available to external allocations.

By setting the ideal footprint after a trim we lift any soft limit in
effect and make the mspace footprint and max footprints equal.

Change-Id: Ia6eb99634ce1d732b417a90291b110d1fc46c2e3

13 years agoAdd --uniprocessor option to dex-preopt.
Dan Bornstein [Wed, 29 Sep 2010 01:53:28 +0000 (18:53 -0700)]
Add --uniprocessor option to dex-preopt.

This tells the preoptimizer to target a uniprocessor (unsurprisingly).
By default, it targets SMP, which makes it do more changes than it has
to for a uniprocessor (e.g. editing how non-wide volatile fields are
accessed within bytecode). To be clear, when SMP-optimized code is run
on a uniprocessor, it should still work. We're just aiming to only
make truly necessary changes during optimization.

While I was in the territory, I went ahead and cleaned up some single
vs. double quote hygiene in the file.

Change-Id: Ia45992939a436d0be6db8363c43d430de4acb80b

13 years agoPlumb SMP optimization control through to dexopt.
Dan Bornstein [Tue, 28 Sep 2010 22:46:54 +0000 (15:46 -0700)]
Plumb SMP optimization control through to dexopt.

Change-Id: I3bfaf6723e7b14d001f9de60cc1c1fd4f8e1ed99

13 years agoFix verification of switch offsets in large methods.
Andy McFadden [Tue, 28 Sep 2010 21:43:28 +0000 (14:43 -0700)]
Fix verification of switch offsets in large methods.

The verifier was only using the low 16 bits when checking the offset
to a switch table.  This was failing on really large methods.

We also blew up the arbitrary size cap again, so I made it a warning
rather than a failure (it really wasn't doing anybody any good).

Changed to width-specific types for the various offsets and sizes.

Bug 3044850.

(cherry-pick+squash from dalvik-dev)

Change-Id: Ic7ebb86728cb39151f617a3e69e1c1994e61b5d9

13 years agoMerge "Change GC card making to use object head, bug fix for volatile sput obj" into...
buzbee [Tue, 28 Sep 2010 19:26:06 +0000 (12:26 -0700)]
Merge "Change GC card making to use object head, bug fix for volatile sput obj" into gingerbread

13 years agoChange GC card making to use object head, bug fix for volatile sput obj
buzbee [Mon, 27 Sep 2010 18:30:22 +0000 (11:30 -0700)]
Change GC card making to use object head, bug fix for volatile sput obj

This CL changes the way we mark GC card to consistently use the object
head (previously, we marked somewhere in the object - often the head, but
not always).  Also, previously a coding error caused us to skip the card
mark for OP_APUT_OBJECT_VOLATILES.  Fixed here.

Change-Id: I133ef6395c51a0466c9708209b08e79c3083aff2

13 years agoDo not grow if we are invoked for an external allocation.
Carl Shapiro [Tue, 28 Sep 2010 00:25:49 +0000 (17:25 -0700)]
Do not grow if we are invoked for an external allocation.

The garbage collection can elect to grow the size of an mspace if the
heap utilization is sufficiently large.  This can remove pages from use
by the external allocation mechanism.

Change-Id: Ie2e9e3da9251068707a60a5835b50e485031578b

13 years agoPerform only one garbage collection before attempting a trim.
Carl Shapiro [Mon, 27 Sep 2010 23:55:21 +0000 (16:55 -0700)]
Perform only one garbage collection before attempting a trim.

Change-Id: Id7ea77fd8e6055a76a5f52bb96dd0544f88ce06b

13 years agoProvide the required out parameter to the trim routine.
Carl Shapiro [Mon, 27 Sep 2010 21:10:10 +0000 (14:10 -0700)]
Provide the required out parameter to the trim routine.

Resolves http://b/issue?id=3040192.

Change-Id: I886a2dc99956b06e953f03ac390865b118b634a3

13 years agoTake another tilt at the "--core-library" messaging windmill.
Dan Bornstein [Sun, 26 Sep 2010 22:03:28 +0000 (15:03 -0700)]
Take another tilt at the "--core-library" messaging windmill.

This time, I added a note about what appears to be the most common
inadvertent triggering, and I point people at JarJar as a possible
solution when the core class inclusion was intentional.

Change-Id: I2d576df0b8944882838cbb6e2b050d59434a238b

13 years agoMerge "Wait for the GC to quiesce before attempting foreground GCs." into gingerbread
Carl Shapiro [Sat, 25 Sep 2010 00:47:37 +0000 (17:47 -0700)]
Merge "Wait for the GC to quiesce before attempting foreground GCs." into gingerbread

13 years agoWait for the GC to quiesce before attempting foreground GCs.
Carl Shapiro [Sat, 25 Sep 2010 00:36:53 +0000 (17:36 -0700)]
Wait for the GC to quiesce before attempting foreground GCs.

Previously, dvmTrackExternalAllocation waited for the GC to complete
before retrying its allocation.  However, there is no guarantee that
the GC will not be active at the time we are woken.  Furthermore, the
code did not revalidate that the external allocation is still
possible, an assumption made by all externalAlloc calls.

With this change, the code loops until the GC is no longer active,
validates that the allocation is still possible, and then proceeds
with its routine for allocating additional storage.  In addition, if
we try a few heroic measures to establish the externalAllocPossible
invariant rather than immediately failing the call.

Change-Id: I2e3b8a6c9fab617990edc085f52d0df35ad6d0f6

13 years agoShow errors from getSchedulerGroup().
Andy McFadden [Fri, 24 Sep 2010 21:18:03 +0000 (14:18 -0700)]
Show errors from getSchedulerGroup().

If we failed to get the cgroup info, we were showing "unknown" in the
stack trace, and sometimes showing an error message in the log file.
Now we put a very brief error description into the cgroup text field,
so it shows up in the stack trace itself.

Also, replaced three strsep() calls with two strchr() calls.

Also, check return value from pthread_kill() calls.

Bug 3032532.

Change-Id: I3730cfb8a5c59048d35d746d8bffb4fa61bd5a6c

13 years agoTurn off verbose chatter about libs in /vendor
Dima Zavin [Fri, 24 Sep 2010 05:38:45 +0000 (22:38 -0700)]
Turn off verbose chatter about libs in /vendor

Change-Id: I243d538d342b5e0424321b09b2b17555ef6343dd
Signed-off-by: Dima Zavin <dima@android.com>
13 years agoPrint the JIT codegen type in the VM configuration list.
Ben Cheng [Thu, 23 Sep 2010 08:23:14 +0000 (01:23 -0700)]
Print the JIT codegen type in the VM configuration list.

Example:
Configured with: debugger profiler hprof jit(armv7-a-neon) show_exception=1

So that the CPU capability on JIT-enabled devices can be exposed.

(cherry-picked from dalvik-dev)

Change-Id: I887201e7023ca94cd9c3d690f03b7b042175e6ed

13 years agoSeveral fixes for JIT and self-verification under corner cases.
Ben Cheng [Tue, 21 Sep 2010 05:20:31 +0000 (22:20 -0700)]
Several fixes for JIT and self-verification under corner cases.

1) Fix the self-verification mode to handle backward chaining cell
properly when a single-step instruction is in the middle of the cyclic
portion of the trace. Then found issue 2 when changing the JIT
threshold to 1.
2) When the code cache is full, the VM may stop making forward progress
and bounces back and forth between the debug and fast intepreters as the
translation request is constantly rejected. The fix is to stay in the
debug interpreter until the corner case condition is cleared. Then found
issue 3.
3) Under self-verification mode, the code cache reset request may get
delayed indefinitely due to spurious indication that a thread is
running JIT'ed code. Trivial fix - make sure the inJitCodeCache flag is
cleared.

(cherry-picked from dalvik-dev)

Change-Id: Ic0b9952c0ae545f68f7eb2ae06a82a634ab62e9e

13 years agoFix computation of primitive array widths.
Andy McFadden [Wed, 22 Sep 2010 19:13:29 +0000 (12:13 -0700)]
Fix computation of primitive array widths.

The code was comparing class pointers, but the class objects for arrays
of primitives are initialized on demand.  If the class wasn't yet
instantiated, the array width code was returning a default value of 4.
This meant the "write values to an array of longs through the unsafe
methods" code was actually scribbling on the wrong part of the array,
which went unnoticed until recently.  (The new-ish ldrexd/strexd code
requires 64-bit alignment.)

We now use the existing array element width computation function.  The
code needed a bit of rearranging since it expected an instance of the
class rather than the class.

Bug 3023981.

(cherry-pick from dalvik-dev)

Change-Id: Ife3258eb6798f8e7eaee7c7b6793a16137de389b

13 years agoMerge "Fix a minor formatting discrepancy in the GC log message." into gingerbread
Carl Shapiro [Tue, 21 Sep 2010 20:34:42 +0000 (13:34 -0700)]
Merge "Fix a minor formatting discrepancy in the GC log message." into gingerbread

13 years agoFix a minor formatting discrepancy in the GC log message.
Carl Shapiro [Tue, 21 Sep 2010 20:28:21 +0000 (13:28 -0700)]
Fix a minor formatting discrepancy in the GC log message.

Change-Id: Ia0233c78f11d5270eefd2b28c6ea239b7ff0de50

13 years agoInsert "/./" into the input file path when necessary.
Dan Bornstein [Mon, 20 Sep 2010 23:13:54 +0000 (16:13 -0700)]
Insert "/./" into the input file path when necessary.

This is necessary, in particular, when the input file is on the
boot classpath.

Change-Id: I18822d7b2eceba0eb15d5548a87bff5bb641788f

13 years agoEnsure that an explicit GC request initiates a GC.
Carl Shapiro [Sat, 18 Sep 2010 00:10:48 +0000 (17:10 -0700)]
Ensure that an explicit GC request initiates a GC.

Previously, if a concurrent GC was in-flight when an explicit GC was
requested a warning would be logged about a recursive GC attempt.  Now,
the requesting thread will block until the GC is inactive and afterward
initiate its foreground collection.

Change-Id: Ibc4cef83315ffe7ccf822a32beb4cce5b1c816bd

13 years agoMerge "Add more context to the garbage collection log messages." into gingerbread
Carl Shapiro [Fri, 17 Sep 2010 23:05:35 +0000 (16:05 -0700)]
Merge "Add more context to the garbage collection log messages." into gingerbread

13 years agoAdd more context to the garbage collection log messages.
Carl Shapiro [Fri, 17 Sep 2010 22:53:16 +0000 (15:53 -0700)]
Add more context to the garbage collection log messages.

With this change, the heap size, number of bytes allocated, the
percentage of free heap, the external allocation limit, and the number
of external bytes allocated are logged.  The number of objects freed
and suspend times are no longer logged but are still included in the
event log records.

Change-Id: I5d5a9d623ae8cb72ad7d4bc5014e218c61a33561

13 years agoAdd --dexopt option to explicitly specify the dexopt binary.
Dan Bornstein [Fri, 17 Sep 2010 21:11:19 +0000 (14:11 -0700)]
Add --dexopt option to explicitly specify the dexopt binary.

Also, cleaned up the docs and usage message a little.

Change-Id: I5bb0ce1b4f8153c19da69fca05cd9318c7e02536

13 years agoModify dex-preopt to take better arguments for the build process.
Dan Bornstein [Fri, 17 Sep 2010 19:54:07 +0000 (12:54 -0700)]
Modify dex-preopt to take better arguments for the build process.

In particular, it now takes a --product-dir that doesn't assume any
particular build tree structure, and it takes a --boot-dir for the
target path (which will be under the product-dir) for the boot
classpath files.

Change-Id: I8986f1d4d37330ab32ebe8b55d38bdd5e24d4aaf

13 years agoAdd optional tags to dalvik.
Jesse Wilson [Thu, 16 Sep 2010 22:56:25 +0000 (15:56 -0700)]
Add optional tags to dalvik.

Change-Id: I29a78ccb6312d12b3ef0ed02cfbc638a5b01db9c

13 years agoMake the app processing variant of dex-preopt more consistent.
Dan Bornstein [Wed, 15 Sep 2010 21:44:01 +0000 (14:44 -0700)]
Make the app processing variant of dex-preopt more consistent.

In particular, make it take paths relative to the product, just like
how the bootclasspath is found and processed.

Change-Id: I3f2a98a6bf6bbcf3145cf9be8edc1c3be4d763b9

13 years agoClarify the use of --boot-dirs in the header comment.
Dan Bornstein [Tue, 14 Sep 2010 23:15:49 +0000 (16:15 -0700)]
Clarify the use of --boot-dirs in the header comment.

Change-Id: I89cf275e6188d5615bfb4e45fe35580b0ebe5be2

13 years agoAdd use of sentinel in BOOTCLASSPATH entries during preopt.
Dan Bornstein [Tue, 14 Sep 2010 00:30:10 +0000 (17:30 -0700)]
Add use of sentinel in BOOTCLASSPATH entries during preopt.

This change introduces the use of the sentinel string "/./" inside
BOOTCLASSPATH entries to signal the start of the portion of the paths
that should be preserved in optimized dex file dependency lists. It's
a little grotty, but it does serve the purpose of allowing host side
dexopt to do its thing inside a build directory without letting the
host path leading up to that build directory to leak into the results.

This change also makes it an error (instead of just a warning) for
there to be BOOTCLASSPATH entries that are not absolute paths (either
truly absolute or ones with the sentinels as per above).

FWIW, dx uses this sentinel in a similar way.

Change-Id: Ic8d0533d3ee0bd7a1d4d06fcf9232c56f0a60abf

13 years agoFirst possibly-working cut of dex-preopt.
Dan Bornstein [Mon, 13 Sep 2010 22:37:28 +0000 (15:37 -0700)]
First possibly-working cut of dex-preopt.

Change-Id: I65c8ca76d75285ebd510babe5d0b3e0a157f82b7

13 years agoFlesh out dex-preopt a bit more.
Dan Bornstein [Mon, 13 Sep 2010 20:40:33 +0000 (13:40 -0700)]
Flesh out dex-preopt a bit more.

It's still not done.

Change-Id: I8b1cbe14841f12c8f299638c1ddaeec659ec441b

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