OSDN Git Service

android-x86/art.git
9 years agoUse a flag from the verifier to know if we should compile.
Nicolas Geoffray [Wed, 24 Jun 2015 14:53:03 +0000 (15:53 +0100)]
Use a flag from the verifier to know if we should compile.

Only used for the lack of bottom type in the aget-object case
for now. Could be used for more.

bug:21865466

(cherry picked from commit 4824c27988c8eeb302791624bb3ce1d557b0db6c)

Change-Id: I2bb7fe1d4737bd92c1076b5193607d74d8761ee7

9 years agoBCE: don't assume a bounds check always gets a HArrayLength.
Nicolas Geoffray [Wed, 24 Jun 2015 13:57:44 +0000 (14:57 +0100)]
BCE: don't assume a bounds check always gets a HArrayLength.

Deoptimizations may change it to a HPhi.

bug:22056703

(cherry picked from commit 8df886b9214802ad689316a1dedb00a6d102555c)

Change-Id: I8afcf88e3a12dbe4d87101e6a7cefb8b81e2bb96

9 years agoFix codegen_test after DCE fix.
Nicolas Geoffray [Wed, 24 Jun 2015 13:25:09 +0000 (14:25 +0100)]
Fix codegen_test after DCE fix.

(cherry picked from commit ea80942c39cb5e9bc3e38a388583d1646c1e2a3f)

bug:22031382

Change-Id: If410045779adb9e7e611af22c988232b5bf9a902

9 years agoRecompute dominator tree after DCE.
Nicolas Geoffray [Wed, 24 Jun 2015 11:20:24 +0000 (12:20 +0100)]
Recompute dominator tree after DCE.

bug:22031382

(cherry picked from commit 1f82ecc6a0c9f88d03d6d1a6d95eeb8707bd06c1)

Change-Id: I9a74edb185cb806045903dfe9695d9cc1a02e86b

9 years agoBCE: Narrow instead of unconditionnaly overwrite the range.
Nicolas Geoffray [Wed, 24 Jun 2015 09:38:27 +0000 (10:38 +0100)]
BCE: Narrow instead of unconditionnaly overwrite the range.

bug:21862741

(cherry picked from commit a09ff9c11f07863ac57e6120a824f0d20dfaa284)

Change-Id: Ia8e903e09a7f9c2b8ef7cf3522f73f154534b81f

9 years agoFix another case of un-verified dead code.
Nicolas Geoffray [Wed, 24 Jun 2015 11:41:20 +0000 (12:41 +0100)]
Fix another case of un-verified dead code.

bug:22042796
https://code.google.com/p/android/issues/detail?id=178008

(cherry picked from commit 1efcc22cd1895c48adccbe49270d8e8583c2b12d)

Change-Id: I5c0d783e842da39cd3dcbb2f18ccf784e797a64f

9 years agoMerge "ART: Follow-up to 507cc6f83bf6379728f2dd20391f2ed5fbfe6371" into mnc-dev
Andreas Gampe [Tue, 23 Jun 2015 23:15:18 +0000 (23:15 +0000)]
Merge "ART: Follow-up to 507cc6f83bf6379728f2dd20391f2ed5fbfe6371" into mnc-dev

9 years agoART: Follow-up to 507cc6f83bf6379728f2dd20391f2ed5fbfe6371
Andreas Gampe [Tue, 23 Jun 2015 21:18:17 +0000 (14:18 -0700)]
ART: Follow-up to 507cc6f83bf6379728f2dd20391f2ed5fbfe6371

Do not trigger DCHECK aborts for final and abstract classes when
they are used from other classes. Instead issue a soft error that
leads to a runtime failure.

Bug: 21873151

(cherry picked from commit f23f33de8b3e9abd16720e0f48d43d63d41dee16)

Change-Id: Ie5251a176722811b3c74585222874313a53f7e02

9 years agoMerge "Fix field ordering for String in hprof" into mnc-dev
Mathieu Chartier [Tue, 23 Jun 2015 22:54:48 +0000 (22:54 +0000)]
Merge "Fix field ordering for String in hprof" into mnc-dev

9 years agoFix field ordering for String in hprof
Mathieu Chartier [Tue, 23 Jun 2015 22:45:15 +0000 (15:45 -0700)]
Fix field ordering for String in hprof

We were inserting value field after the Object field instead of
the String fields.

Bug: 22043800
Change-Id: Ibaddbd7299562949e32eceb625feac325539e3ce

9 years agoMake dex file verifier check that indexes are increasing.
Jeff Hao [Tue, 23 Jun 2015 03:20:30 +0000 (20:20 -0700)]
Make dex file verifier check that indexes are increasing.

Note that this still allows duplicates.

Bug: 21868011
Change-Id: Ib0e91c816eccfaf3b0dac340c05ffd5dc4df17cc

9 years agoDo not overwrite an input register in shift operations.
Nicolas Geoffray [Mon, 22 Jun 2015 22:12:45 +0000 (23:12 +0100)]
Do not overwrite an input register in shift operations.

'second_reg' is an input register that can survive the instruction.
Instead use the output register as a temporary result.

bug:21667432

(cherry picked from commit a4f3581da73b83484a30ab499c4f8ad43b378dab)

Change-Id: Ic1f399964911b8a9fc57352130c92b2a0a1b8e0d

9 years agoMerge "Fix another miranda method moving GC bug" into mnc-dev
Mathieu Chartier [Tue, 23 Jun 2015 00:14:43 +0000 (00:14 +0000)]
Merge "Fix another miranda method moving GC bug" into mnc-dev

9 years agoNew experimental GC stress mode
Mathieu Chartier [Sun, 14 Jun 2015 21:14:37 +0000 (14:14 -0700)]
New experimental GC stress mode

Tries to do a GC for every unique call stack (up to 16 frames).
The goal is to catch moving GC bugs and lock violations without being
rediculously slow. Some tests fail on 64 bits, 32 bit host doesn't
work. N5 is booting.

Added runtime -Xgc options: gcstress and nogcstress.

Bug: 21664466

(cherry picked from commit 310008008c90fea246efd00cb99ee7ded97c5209)

Change-Id: Icb8e420f2048e8ee83bcca7937563166a2638f5c

9 years agoMerge "Change GC to allow strings to use large object space." into mnc-dev
Jeff Hao [Mon, 22 Jun 2015 22:26:54 +0000 (22:26 +0000)]
Merge "Change GC to allow strings to use large object space." into mnc-dev

9 years agoChange GC to allow strings to use large object space.
Jeff Hao [Mon, 22 Jun 2015 22:14:49 +0000 (15:14 -0700)]
Change GC to allow strings to use large object space.

Bug: 21209641
Change-Id: Ib007a30e575e391e2b5bddb816a9d2e82502c7d5

9 years agoMerge "ART: Allow checking RETURN_VOID_NO_BARRIER on unresolved classes" into mnc-dev
Andreas Gampe [Mon, 22 Jun 2015 21:36:40 +0000 (21:36 +0000)]
Merge "ART: Allow checking RETURN_VOID_NO_BARRIER on unresolved classes" into mnc-dev

9 years agoMake large string use large object space.
Jeff Hao [Mon, 22 Jun 2015 21:29:54 +0000 (14:29 -0700)]
Make large string use large object space.

Bug: 21209641
Change-Id: I731a920c02f29f0321f2077093516aaa0f8d782f

9 years agoART: Allow checking RETURN_VOID_NO_BARRIER on unresolved classes
Andreas Gampe [Mon, 22 Jun 2015 18:35:46 +0000 (11:35 -0700)]
ART: Allow checking RETURN_VOID_NO_BARRIER on unresolved classes

We must check that all fields are non-final, even for unresolved
classes. Fall back to the dex file for this information.

Bug: 22005084
Bug: https://code.google.com/p/android/issues/detail?id=177694

(cherry picked from commit 68df32091cc79468c81956633e279523b48ea8bf)

Change-Id: If2126d1be5dccadbbedcdccabde7398688d6e5ca

9 years agoFix another miranda method moving GC bug
Mathieu Chartier [Sat, 20 Jun 2015 03:24:45 +0000 (20:24 -0700)]
Fix another miranda method moving GC bug

Need to copy miranda methods over before we allocate the new vtable
or else we may have stale miranda gc roots.

Bug: 21664466
Change-Id: Ib3e415bb9e7df7abfa18c98fe01f790fa39622dc

9 years agoART: Don't do pre-linked calls to the interpreter bridge.
Vladimir Marko [Mon, 22 Jun 2015 13:35:42 +0000 (14:35 +0100)]
ART: Don't do pre-linked calls to the interpreter bridge.

Bug: 21897404

(cherry picked from commit c08ab29796eeaa3b5863fbd987cd96fe7538d40c)

Change-Id: I66531379fb4468a8ddee063e664bf6593abbe7d5

9 years agoART: Disallow classes that are abstract and final
Andreas Gampe [Sat, 20 Jun 2015 05:58:47 +0000 (22:58 -0700)]
ART: Disallow classes that are abstract and final

Make the verifier fail such classes.

Bug: 21873151

(cherry picked from commit 507cc6f83bf6379728f2dd20391f2ed5fbfe6371)

Change-Id: I217f3d71f44bccdcee7ca830e092c807928bed39

9 years agoRevert "Revert "Add support for inlining already sharpened interface calls.""
Nicolas Geoffray [Mon, 22 Jun 2015 14:15:07 +0000 (14:15 +0000)]
Revert "Revert "Add support for inlining already sharpened interface calls.""

bug:21867144

This reverts commit ee39360775066e6b9920348c86ea98bf01d0facf.

Change-Id: I69bf85ce7c352b1a22f36f0f2a136f95b4e73bd6

9 years agoRevert "Add support for inlining already sharpened interface calls. DO NOT MERGE...
Nicolas Geoffray [Mon, 22 Jun 2015 14:11:58 +0000 (15:11 +0100)]
Revert "Add support for inlining already sharpened interface calls. DO NOT MERGE ANYWHERE"

This reverts commit c362782609ca6fbc355ccc9ea9110fe671db9671.

Reverting in order to make a commit that will merge.

bug:21867144

9 years agoRevert "Revert "Use IsAssignableFrom instead of IsSubclass for robustness.""
Nicolas Geoffray [Mon, 22 Jun 2015 10:06:43 +0000 (11:06 +0100)]
Revert "Revert "Use IsAssignableFrom instead of IsSubclass for robustness.""

Don't use IsAssignableFrom, but check beforehand if the referrer is an
interface. Otherwise, we are being too aggressive on removing clinit
checks on interfaces (being a subclass doesn't imply the interface
has been initialized).

bug:21870666

This reverts commit 463580ca5a1e75e27ad0207537ffc6252091326a.

(cherry picked from commit b783b408112d1797da646f576a40f94bcb5162f3)

Change-Id: Ida03f453c9b0d4dda87a5696098f9ffbd69a3aa3

9 years agoUse compiling class instead of outer class for access checks.
Nicolas Geoffray [Sat, 20 Jun 2015 21:44:47 +0000 (22:44 +0100)]
Use compiling class instead of outer class for access checks.

bug:21869678

(cherry picked from commit afd06414598e011693137ba044e38756609b2179)

Change-Id: I982ccdf46e3f4d0cc1901439e0bc2dcfa0fc661f

9 years agoUse compiling class instead of referrer for access checks.
Nicolas Geoffray [Fri, 19 Jun 2015 12:32:41 +0000 (13:32 +0100)]
Use compiling class instead of referrer for access checks.

bug:21869670

(cherry picked from commit 30451743493bc2f589e96d68ab98f557461f97f9)

Change-Id: Ia18986797d166470801e7a9a690c054d2dc57952

9 years agoBe careful with predecessor/successor index.
Nicolas Geoffray [Fri, 19 Jun 2015 15:17:05 +0000 (16:17 +0100)]
Be careful with predecessor/successor index.

When we simplify the CFG, we must preserve things that were already
simplified. For example, the index in the predecessor list or
successor list of a block must be preserved for ensuring the
first block is a loop pre header.

bug:21867463

(cherry picked from commit 8b20f88b0a8d1b374dd5eaae289d19734c77b8f8)

Change-Id: I2581b5a50942290da96cd9ec876f6f2573e0a6c4

9 years agoMerge "Don't check the return type in the builder." into mnc-dev
Nicolas Geoffray [Mon, 22 Jun 2015 11:25:02 +0000 (11:25 +0000)]
Merge "Don't check the return type in the builder." into mnc-dev

9 years agoDon't check the return type in the builder.
Nicolas Geoffray [Thu, 18 Jun 2015 17:04:12 +0000 (18:04 +0100)]
Don't check the return type in the builder.

The verifier will not complain about dead code. For the compiler,
it is benign.

bug:21863767

(cherry picked from commit 69505f86a1a653bf86c1f2b423b3e0605137d5d1)

Change-Id: I2bc7888b39c91862c6dade130eccdf92f19b3f6f

9 years agoMerge "Do not expect 0 or 1 only when comparing a boolean." into mnc-dev
Nicolas Geoffray [Mon, 22 Jun 2015 11:07:17 +0000 (11:07 +0000)]
Merge "Do not expect 0 or 1 only when comparing a boolean." into mnc-dev

9 years agoDo not expect 0 or 1 only when comparing a boolean.
Nicolas Geoffray [Fri, 19 Jun 2015 10:42:07 +0000 (11:42 +0100)]
Do not expect 0 or 1 only when comparing a boolean.

bug:21866529

(cherry picked from commit 3c4ab80c102ff1bfc0e74d4abddbf5454bf4008d)

Change-Id: Ibdc0d4a9730bfc6e7307282276f084dae5ac55c1

9 years agoVerifier: check an aput, even if we know it will fail.
Nicolas Geoffray [Fri, 19 Jun 2015 09:35:42 +0000 (10:35 +0100)]
Verifier: check an aput, even if we know it will fail.

bug:21867457

(cherry picked from commit 66389fbeb41c981648bb2e1e7e2f43089f095591)

Change-Id: Id01edeb871f6bc59518eb341e5b76f021cfdfe06

9 years agoRun a simplification pass before code generation.
Nicolas Geoffray [Thu, 18 Jun 2015 14:46:47 +0000 (15:46 +0100)]
Run a simplification pass before code generation.

The code generators assume things that only the instruction
simplier ensures. So it has to be run last in case previous
optimiziations broke those assumptions.

bug:21865464

(cherry picked from commit b2bdfce7f805b00668a2521b1c939a0aafb2be49)

Change-Id: Ibf4384a911e400eb7586bbf6b4edd6351034cbd8

9 years agoMerge "Bailout from compilation if an invoke is malformed." into mnc-dev
Nicolas Geoffray [Mon, 22 Jun 2015 09:25:56 +0000 (09:25 +0000)]
Merge "Bailout from compilation if an invoke is malformed." into mnc-dev

9 years agoBailout from compilation if an invoke is malformed.
Nicolas Geoffray [Thu, 18 Jun 2015 10:11:27 +0000 (11:11 +0100)]
Bailout from compilation if an invoke is malformed.

Because the verifier does not check trivially dead instructions,
the compilers must prepare for bogus instructions. This change
fixes the case the arguments for an invoke do not match the
formal parameters.

bug:21865459

(cherry picked from commit 2e33525bd4eb892246b4c244c6d4ebf6c6d07501)

Change-Id: I392f86eafefde28263fe35a31f17b398ff8dfc24

9 years agoMerge "Fix wrong DCHECK in bounds check elimination." into mnc-dev
Nicolas Geoffray [Mon, 22 Jun 2015 09:16:04 +0000 (09:16 +0000)]
Merge "Fix wrong DCHECK in bounds check elimination." into mnc-dev

9 years agoFix wrong DCHECK in bounds check elimination.
Nicolas Geoffray [Sat, 20 Jun 2015 22:49:01 +0000 (23:49 +0100)]
Fix wrong DCHECK in bounds check elimination.

The lower range of an array length instruction can
be changed by other instructions than HBoundsCheck,
like HNewArray.

bug:21862741

(cherry picked from commit 8d82a0c2b2b12f259ccb357d3b1e699c68ad0400)

Change-Id: I1bb1a4f4c6673509dd3fb5184c32992bed876250

9 years agoFix a bug in optimizing when the null constant has been DCE.
Nicolas Geoffray [Wed, 17 Jun 2015 22:09:05 +0000 (23:09 +0100)]
Fix a bug in optimizing when the null constant has been DCE.

If it has been DCE, we should create a new one, instead of
using the old one.

Also move the first DCE to a place where it could actually
be useful.

bug:21870788

(cherry picked from commit 18e6873c469b48aaed22148451523479eece98e3)

Change-Id: I3b3ab2dafe8ce5fb60868fd1a6ef0eeefe666e0c

9 years agoFix String Change baseline compiler errors.
Nicolas Geoffray [Sun, 21 Jun 2015 17:57:02 +0000 (18:57 +0100)]
Fix String Change baseline compiler errors.

The String Change adds multiple move results if the uninitialized string
is in multiple registers. This adds StoreLocals on the same instruction,
which isn't allowed. Now, a LoadLocal is added for each extra move
needed.

bug:21902634

(cherry picked from commit aa919207d2fb63af11d72d3b7cdbc435769565af)

Change-Id: I057d14cdac437d06eec20caaddd430c304e58196

9 years agoUse signed encoding when using relative CFI addresses.
David Srbecky [Sat, 20 Jun 2015 04:01:22 +0000 (05:01 +0100)]
Use signed encoding when using relative CFI addresses.

This is required for gdb to work.
libunwind works with either encoding.

(cherry picked from commit 17065880693d1b15ffeb60b9955a2d092839977f)

Bug: 21924613
Change-Id: I4e4f1cf9c65d48fa885a5993eeeed0253a3f2579

9 years agoART: Check for expected args for instance methods
Andreas Gampe [Sat, 20 Jun 2015 03:37:46 +0000 (20:37 -0700)]
ART: Check for expected args for instance methods

Don't assume that the receiver is expected. This was writing out
of bounds (or triggering a DCHECK).

Bug: 21817284
Bug: 21872240
Bug: https://code.google.com/p/android/issues/detail?id=176571
Bug: https://code.google.com/p/android/issues/detail?id=176572

(cherry picked from commit ef0b1a1dbc99fe7c92f9598cbfc164763c1b66d7)

Change-Id: I7cad2c1dfc39feb0b1b4660deeb43afdcb844ba3

9 years agoART: Check var-arg count earlier in method verifier
Taiju Tsuiki [Mon, 13 Apr 2015 05:21:00 +0000 (14:21 +0900)]
ART: Check var-arg count earlier in method verifier

Check the count in vararg instructions before filling the temp
array. Avoids a DCHECK.

Bug: 21869663
Bug: 20170976

(cherry picked from commit 29498a23bcfe47a7134552aacad5524ecb484a49)

Change-Id: I1ff93502ab84c5967ad54d1b50dba517da791637

9 years agoMerge "ART: Fix BCE lint issue" into mnc-dev
Mingyao Yang [Fri, 19 Jun 2015 23:45:43 +0000 (23:45 +0000)]
Merge "ART: Fix BCE lint issue" into mnc-dev

9 years agoART: Fix BCE lint issue
Andreas Gampe [Thu, 11 Jun 2015 01:33:26 +0000 (18:33 -0700)]
ART: Fix BCE lint issue

Bug: 21034044

(cherry picked from commit 45d68f138a31a3ff9b45cda313f0ba27f1431f26)

Change-Id: I7f382a3124955eff5c0b96ca39ec67fb658fa3d0

9 years agoMerge "Fix GC map generation edge case" into mnc-dev
Mathieu Chartier [Fri, 19 Jun 2015 22:19:22 +0000 (22:19 +0000)]
Merge "Fix GC map generation edge case" into mnc-dev

9 years agoFix GC map generation edge case
Mathieu Chartier [Fri, 19 Jun 2015 20:55:27 +0000 (13:55 -0700)]
Fix GC map generation edge case

Previously we checked the number of bits, but then rounded up to a
byte boundary. If ref_bitmap_bits was 65535, it would pass the check
but not actually fit in the 13 bits for ref_bitmap_bytes since we
rounded up to 8192 bytes.

Regression test infeasible due to smali limitations.

Bug: 21888453
Change-Id: If4b769431f27ecca14fe7852d017bcde01b3e146

9 years agoRemove bogus DCHECK in BCE.
Nicolas Geoffray [Wed, 17 Jun 2015 09:17:49 +0000 (10:17 +0100)]
Remove bogus DCHECK in BCE.

When creating a phi for the array length when we add HDeoptimization
nodes, we might update accesses in inner loops to use that phi instead
of the array length. The BCE phase was not expecting this case.

Bug: 21034044

(cherry picked from commit 3cde6227678cf62e06bca264671d1e957456ac3d)

Change-Id: I639f4ea6f5889726142041a42736183f162c7437

9 years agoFix premature deoptimization if the loop body isn't entered.
Mingyao Yang [Tue, 19 May 2015 23:01:59 +0000 (16:01 -0700)]
Fix premature deoptimization if the loop body isn't entered.

Add a test between initial_ and end_ to see if the loop body is entered.
If the loop body isn't entered at all, we jump to the loop header. Loop header is
still executed and is going to test the condition again and loop body won't be
entered. This makes sure no deoptimization is triggered if the loop body isn't
even entered.

Bug: 21034044

(cherry picked from commit 3584bce5b1f45e5741d3a6ca24884a36320ecb6b)

Change-Id: I2b6de1f22fbc4568ca419f76382ebd87806d9694

9 years agoMerge "ART stack unwinding fixes for libunwind/gdb/lldb." into mnc-dev
David Srbecky [Fri, 19 Jun 2015 18:25:56 +0000 (18:25 +0000)]
Merge "ART stack unwinding fixes for libunwind/gdb/lldb." into mnc-dev

9 years agoFix case where block has no predecessor for StringChange.
Jeff Hao [Wed, 17 Jun 2015 23:04:26 +0000 (16:04 -0700)]
Fix case where block has no predecessor for StringChange.

Removes part that checks for throwing half of instruction. It's no
longer necessary. Also adds regression test.

Bug: 21902684
Change-Id: Ic600165e6b3719de3d83a73b8a1fa64473668fc8

9 years agoQuick: Handle total high/low register overlap on arm/mips.
Vladimir Marko [Fri, 19 Jun 2015 13:56:38 +0000 (14:56 +0100)]
Quick: Handle total high/low register overlap on arm/mips.

OpRegCopyWide() in arm and mips backends didn't handle the
total register overlap when the registers holding the source
and destination pairs are the same but in reverse order.

Bug: 21897012

(cherry picked from commit 8958f7f8702327e713264d0538ab5dec586f3738)

Change-Id: I20afce6cc3213e7f7b3edaef91f3ec29c469f877

9 years agoQuick: Fix optimizations for empty if blocks.
Vladimir Marko [Fri, 19 Jun 2015 11:58:22 +0000 (12:58 +0100)]
Quick: Fix optimizations for empty if blocks.

If a block ending with if-eqz or if-nez has the same "taken"
and "fallthrough", we cannot assume that the value has been
checked against zero in one of the succesors. This affects
the null check elimination pass as well as GVN. Refactor all
those checks to a single function in BasicBlock and check
that the "taken" and "falthrough" are different when needed.

Bug: 21614284

(cherry picked from commit f11c420c448baffac6a70ac0884d481ab347e257)

Change-Id: I062e0042de3470ce8680b586487b9c7acbd206bc

9 years agoART: Remove old DCHECK that trips Baseline
David Brazdil [Thu, 18 Jun 2015 11:40:01 +0000 (12:40 +0100)]
ART: Remove old DCHECK that trips Baseline

Codegen verified that the entry block always falls through to the next
block. While this is the case with Optimizing, it doesn't hold for
Baseline but it doesn't need to since codegen handles it fine.

Bug:21913514
Change-Id: I751ef227e6cf103af3e7fc35fca4b01c663385a1
(cherry picked from commit 015c7e63604c038e866d7af3850c557403cddc8b)

9 years agoMerge "Fix StringChange for optimizing compiler." into mnc-dev
Jeff Hao [Fri, 19 Jun 2015 04:19:08 +0000 (04:19 +0000)]
Merge "Fix StringChange for optimizing compiler." into mnc-dev

9 years agoFix StringChange for optimizing compiler.
Jeff Hao [Fri, 19 Jun 2015 04:16:08 +0000 (21:16 -0700)]
Fix StringChange for optimizing compiler.

Uses optimizing compiler more and fixes x86_64 invoke codegen.

Bug: 21902634
Change-Id: Ia2a87d013c4746b107014a04a22a0a37269cfdb2

9 years agoART stack unwinding fixes for libunwind/gdb/lldb.
David Srbecky [Thu, 23 Apr 2015 01:57:06 +0000 (18:57 -0700)]
ART stack unwinding fixes for libunwind/gdb/lldb.

dex2oat can already generate unwinding and symbol information which
allows tools to create backtrace of mixed native and Java code.

This is a cherry pick from aosp/master which fixes several issues.
Most notably:
 * It enables generation of ELF-64 on 64-bit systems (in dex2oat, C
   compilers already produce ELF-64).  Libunwind requires ELF-64 on
   64-bit systems for backtraces to work.
 * It enables loading of ELF files with dlopen.  This is required for
   libunwind to be able to generate backtrace of current process (i.e.
   the process requesting backtrace of itself).
 * It adds unit test to test the above (32 vs 64 bit, in-proces vs
   out-of-process, application code vs framework code).
 * Some other fixes or clean-ups which should not be of much
   significance but which are easier to include to make the
   important CLs cherry-pick cleanly.

This is squash of the following commits from aosp/master:
  7381010 ART: CFI Test
  e1bbed2 ART: Blacklist CFI test for non-compiled run-tests
  aab9f73 ART: Blacklist CFI test for JIT
  4437219 ART: Blacklist CFI test for Heap Poisoning
  a3a49fe Switch to using ELF-64 for 64-bit architectures.
  297ed22 Write 64-bit address in DWARF if we are on 64-bit architecture.
  24981a1 Set correct size of PT_PHDR ELF segment.
  1a146bf Link .dynamic to .dynstr
  67a0653 Make some parts of ELF more (pointer) aligned.
  f50fa82 Enable 64-bit CFI tests.
  49e1fab Use dlopen to load oat files.
  5dedb80 Add more logging output for dlopen.
  aa03870 Find the dlopened file using address rather than file path.
  82e73dc Release dummy MemMaps corresponding to dlopen.
  5c40961 Test that we can unwind framework code.
  020c543 Add more log output to the CFI test.
  88da3b0 ART: Fix CFI test wrt/ PIC
  a70e5b9 CFI test: kill the other process in native code.
  ad5fa8c Support generation of CFI in .debug_frame format.
  90688ae Fix build - large frame size of ElfWriterQuick<ElfTypes>::Write.
  97dabb7 Fix build breakage in dwarf_test.
  388d286 Generate just single ARM mapping symbol.
  f898087 Split .oat_patches to multiple sections.
  491a7fe Fix build - large frame size of ElfWriterQuick<ElfTypes>::Write (again).
  8363c77 Add --generate-debug-info flag and remove the other two flags.
  461d72a Generate debug info for core.oat files.

Bug: 21924613
Change-Id: I3f944a08dd2ed1df4d8a807da4fee423fdd35eb7

9 years agoFix moving GC bug in DoFilledNewArray
Mathieu Chartier [Thu, 18 Jun 2015 23:48:52 +0000 (16:48 -0700)]
Fix moving GC bug in DoFilledNewArray

Previously we read from componentClass after allocating the array.

Bug: 21783443

(cherry picked from commit 52ea33b10370d60d4ce877aec529626537b7813b)

Change-Id: I5283982edab479434e27416509e1436b4176fe01

9 years agoFix moving GC bugs in proxy stub for X86/X86_64
Mathieu Chartier [Thu, 18 Jun 2015 17:17:26 +0000 (10:17 -0700)]
Fix moving GC bugs in proxy stub for X86/X86_64

Needed to restore the refs.

(cherry picked from commit 9346ff0cfad6344d0bf4eaa69362dbe1987ac054)

Bug: 21907554
Change-Id: I562906dff07dcaa78dfb39646ba9ab35a5f56c6c

9 years agoFollow up on CL 151605
Sebastien Hertz [Tue, 9 Jun 2015 12:09:14 +0000 (14:09 +0200)]
Follow up on CL 151605

- Fixes return type of StackedShadowFrameRecord::GetType
- Makes StackedShadowFrameType an enum class (scoped enum)
- Moves DeoptimizationReturnValueRecord and StackedShadowFrameRecord
  to thread.cc file and use forward declaration in thread.h header
- Fixes tools/generate-operator-out.py for scoped enum classes.

Bug: 20845490

(cherry picked from commit f795869da0a1fa006fdcdacd8afb6149a63fc1a7)

Change-Id: I6b67e288b1db563699161e58ec2e2330d42dd8f5

9 years agoFix nested deoptimization.
Mingyao Yang [Mon, 18 May 2015 19:12:50 +0000 (12:12 -0700)]
Fix nested deoptimization.

Handle nested deoptimization cases. Create a stacked shadow frame
records to keep track of deoptimization shadow frames. Shadow frames
under construction can be tracked in the same stack.

Bug: 20845490

(cherry picked from commit 1f2d3ba6af52cf6f566deb38b7e07735c9a08fb6)

Change-Id: I768285792c29e7c3cfcd21e7a2600802506024d8

9 years agoQuick: Don't expect move-exception in every catch block.
Vladimir Marko [Thu, 18 Jun 2015 16:40:00 +0000 (17:40 +0100)]
Quick: Don't expect move-exception in every catch block.

The dalvik bytecode doesn't require a move-exception in
a catch handler that ignores the exception.

Bug: 21873167

(cherry picked from commit 2d1a0a408fd148f7b2a2d670e6942ec3d920f875)

Change-Id: Ia00e5791fabdd1b88e9a63b741600ed63d918703

9 years agoFix some java_lang_Class related moving GC bugs
Mathieu Chartier [Wed, 17 Jun 2015 23:11:12 +0000 (16:11 -0700)]
Fix some java_lang_Class related moving GC bugs

There was some missing handles around mirror::Class*.

(cherry picked from commit 05b7226787f1470ad93f6f632fed60f70bc8631e

Bug: 21898408
Change-Id: Icb754074dfb469473101d20d6873a5bc3274abc5

9 years agoMerge "ART: Allow PackedSwitch instructions with zero targets" into mnc-dev
David Brazdil [Thu, 18 Jun 2015 16:13:16 +0000 (16:13 +0000)]
Merge "ART: Allow PackedSwitch instructions with zero targets" into mnc-dev

9 years agoART: Allow PackedSwitch instructions with zero targets
David Brazdil [Wed, 17 Jun 2015 17:20:52 +0000 (18:20 +0100)]
ART: Allow PackedSwitch instructions with zero targets

Optimizing and the interpreter wrongly assumed that a PackedSwitch
always has at least one target. This patch removes the corresponding
DCHECKs and adds a regression test case.

This is a resubmission of CL I32b7033ed38de6f1d1a6ee5d5bf12f3a47c9b37e

Bug: 21863783
Change-Id: I04e6e124bdd16591ba27c79490e6ce183c36b691
(cherry picked from commit 2ef645ba50544b879a82ea30e606f18c9af98917)

9 years agoQuick: Fix marking unused registers in DCE.
Vladimir Marko [Wed, 17 Jun 2015 21:00:09 +0000 (22:00 +0100)]
Quick: Fix marking unused registers in DCE.

Bug: 21702651

(cherry picked from commit 511d408909b7fe9be3c95e032cc7f426f4a01e6e)

Change-Id: I059e0b841543334cd08a27431e0ea853b42e4f35

9 years agoART: Fix reporting initialized classes by CompilerDriver.
Vladimir Marko [Mon, 15 Jun 2015 17:52:54 +0000 (18:52 +0100)]
ART: Fix reporting initialized classes by CompilerDriver.

Fix a bug where the CompilerDriver was erroneously reporting
classes as initialized during AOT compilation when they were
not guaranteed to be initialized at runtime.

This fix prevents the Quick compiler from inlining calls to
static methods in classes that are not guaranteed to be
initialized, so that the runtime performs the initialization
required for correctness.

Bug: 21847756

(cherry picked from commit 07785bb98dc8bbe192970e0f4c2cafd338a8dc68)

Change-Id: I60c7361cb6e8f51be20a3cbfcae19f3240bdfbed

9 years agoMerge "Add support for inlining already sharpened interface calls. DO NOT MERGE ANYWH...
Nicolas Geoffray [Thu, 18 Jun 2015 09:05:21 +0000 (09:05 +0000)]
Merge "Add support for inlining already sharpened interface calls. DO NOT MERGE ANYWHERE" into mnc-dev

9 years agoAdd support for inlining already sharpened interface calls. DO NOT MERGE ANYWHERE
Nicolas Geoffray [Tue, 9 Jun 2015 14:43:38 +0000 (15:43 +0100)]
Add support for inlining already sharpened interface calls. DO NOT MERGE ANYWHERE

bug:21867144

Test had to change a bit because it was using some features from
aosp not present in mnc-dev.

(cherry picked from commit 3507105caea0d209c66a95d5ec5d739949105c5d)

Change-Id: If12ea9a5c64e86b5bd3a5fd4a943bff60fe49762

9 years agoFix reference comparison after redundant phi elimination.
Nicolas Geoffray [Mon, 15 Jun 2015 08:01:08 +0000 (09:01 +0100)]
Fix reference comparison after redundant phi elimination.

Otherwise, the graph could remain mistyped.

bug:21776173

(cherry picked from commit 51d400d4ebd41b9fb4d67ac3179f8fb66a090fdd)

Change-Id: Iff36dfa4e79b14a9dd85c37e0fbb9e1080dd0364

9 years agoAdd missing EndAssertNoThreadSuspension
Mathieu Chartier [Wed, 17 Jun 2015 21:14:36 +0000 (14:14 -0700)]
Add missing EndAssertNoThreadSuspension

Bug: 21872507
Change-Id: I20f9920e4a12511ce498c252bca955d82a4f4102

9 years agoSet default visibility on art_sigsegv_fault.
Oleksiy Vyalov [Sun, 14 Jun 2015 22:17:26 +0000 (15:17 -0700)]
Set default visibility on art_sigsegv_fault.

libart.so is built with flag -fvisibility=protected
which complicates setting breakpoints on art_sigsegv_fault.
According to the GCC manual "Protected visibility indicates
that the symbol will be placed in the dynamic symbol table,
but that references within the defining module will bind
to the local symbol.". This implies that a breakpoint on
a protected symbol will not be hit.

Without this change gdbclient with ART debugging enabled
doesn't break at art_sigsegv_fault as expected.

Bonus build fix included (commit c37769b6) :

Fix lint error.

Blank line at the start of a code block.

(cherry picked from commit f775bab533cd385c00ee30b56bdcb6f962fc5239)
(cherry picked from commit c37769b63faf7b120a6ed80f5cfb92667f5090c4)

bug: 21893559

Change-Id: Ie388f027f717a7bd2351a0163a38e50d3acbba8f

9 years agoMerge "Change mips64 lwu to ld for loading caller ArtMethod*" into mnc-dev
Mathieu Chartier [Sat, 13 Jun 2015 00:18:37 +0000 (00:18 +0000)]
Merge "Change mips64 lwu to ld for loading caller ArtMethod*" into mnc-dev

9 years agoChange mips64 lwu to ld for loading caller ArtMethod*
Mathieu Chartier [Fri, 12 Jun 2015 23:05:54 +0000 (16:05 -0700)]
Change mips64 lwu to ld for loading caller ArtMethod*

Bug: 21815962
Change-Id: Id589f4a49349d817d3dc9128109048292fe0ed33

9 years agoJDWP: update handling of 8-bit and 16-bit fields
Sebastien Hertz [Thu, 11 Jun 2015 16:42:58 +0000 (18:42 +0200)]
JDWP: update handling of 8-bit and 16-bit fields

We must use special getter/setter for types smaller than int:
boolean, byte, char and short. However, JDWP still requires to treat:
- int and float as 32-bit values
- long and double as 64-bit values

Bug: 21746739

(cherry picked from commit 05c26b30843dd8283c703356e75d51726e8b8e3a)

Change-Id: I2d667291974e191f2c9b10311ce02435b902dd0c

9 years agoJDWP: asynchronous invoke command handling
Sebastien Hertz [Mon, 1 Jun 2015 15:33:12 +0000 (17:33 +0200)]
JDWP: asynchronous invoke command handling

The JDWP thread used to wait for the result of a method invocation
running in an event thread. But doing that prevents the JDWP thread
from processing incoming commands from the debugger if the event
thread gets suspended by a debug event occurring in another thread.
In Android Studio (or another IDE), this leads to the debugger being
blocked (with the famous message "Waiting until last debugger command
completes" of Android Studio / IntelliJ) because it is actually
waiting for the reply of its latest command while the JDWP thread
cannot process it.

This CL changes the way invoke commands (ClassType.InvokeCommand,
ClassType.NewInstance and ObjectReference.InvokeCommand) are handled
in the ART runtime.
The JDWP thread no longer waits for the event thread to complete the
method invocation. It now simply waits for the next JDWP command to
process. This means it does not send any reply for invoke commands,
except if the information given by the debugger is wrong. In this
case, it still sends a reply with the appropriate error code.
The event thread is now responsible for sending the reply (containing
the result and the exception object of the invoked method) before
going back to the suspended state.

In other words, we add special handling for invoke commands so they
are handled asynchronously while other commands remained handled
synchronously. In the future, we may want to handle all commands
asynchronously (using a queue of reply/event for instance) to remove
the special handling code this CL is adding.

Now the JDWP thread can process commands while a thread is invoking
a method, it is possible for the debugger to detach (by sending a
VirtualMachine.Dispose command) before the invocation completes. In
that situation, we must not suspend threads again (including the
event thread that executed the method) because they would all remain
suspended forever.

Also minor cleanup of the use of JDWP constants and update comments.

Bug: 21515842
Bug: 18899981

(cherry picked from commit cbc5064ff05179b97b416f00ca579c55e38cd7d9)

Change-Id: I8d31006043468913ee8453212e6d16e11fcfe4ea

9 years agoMerge "Add cortex-a53 as a valid instruction set variant for arm64." into mnc-dev
Tim Murray [Fri, 12 Jun 2015 00:21:24 +0000 (00:21 +0000)]
Merge "Add cortex-a53 as a valid instruction set variant for arm64." into mnc-dev

9 years agoAdd cortex-a53 as a valid instruction set variant for arm64.
Tim Murray [Fri, 12 Jun 2015 00:09:18 +0000 (17:09 -0700)]
Add cortex-a53 as a valid instruction set variant for arm64.

Change-Id: I720e2cc4acd94e367dae4a21c13aa90a3e30b7cc

9 years agoFix compaction bug in Class_getDeclaredMethodsUnchecked
Mathieu Chartier [Thu, 11 Jun 2015 23:21:42 +0000 (16:21 -0700)]
Fix compaction bug in Class_getDeclaredMethodsUnchecked

Added handle to fix the bug.

Bug: 21638351
Change-Id: I1c3abea33aa825d3a28c1fc5cb415508686ad93e

9 years agoMerge "Let classloader provide correct LD_LIBRARY_PATH" into mnc-dev
Dmitriy Ivanov [Thu, 11 Jun 2015 21:54:53 +0000 (21:54 +0000)]
Merge "Let classloader provide correct LD_LIBRARY_PATH" into mnc-dev

9 years agoMerge "Move image intern table into image" into mnc-dev
Mathieu Chartier [Thu, 11 Jun 2015 21:45:53 +0000 (21:45 +0000)]
Merge "Move image intern table into image" into mnc-dev

9 years agoMove image intern table into image
Mathieu Chartier [Wed, 10 Jun 2015 00:50:29 +0000 (17:50 -0700)]
Move image intern table into image

Previously we recreated this intern table during runtime startup.
This added 50-100ms of boot time.

Fixed bug where we didn't copy over hashcodes into the image.

Deleted some stale code.

Bug: 20727525
Bug: 19569780
Change-Id: I08959e9aa2a73cedb52f393033e2ffea3a26e76b

9 years agoMerge "Reset GC performance stats at zygote fork." into mnc-dev
Hiroshi Yamauchi [Thu, 11 Jun 2015 00:46:10 +0000 (00:46 +0000)]
Merge "Reset GC performance stats at zygote fork." into mnc-dev

9 years ago[MIPS] Fix method tracing for mips64
Lazar Trsic [Wed, 10 Jun 2015 14:05:46 +0000 (16:05 +0200)]
[MIPS] Fix method tracing for mips64

Reg $v0 is being clobbered on using
SETUP_REFS_ONLY_CALLEE_SAVE_FRAME inside instrumentation_exit()
trampoline, when falling through from instrumentation_entry().

To fix, use $t1 for ArtMethod* fetching inside SETUP_ macros.

Also fix some unrelated comment errors.

Bug: 21555893

(cherry picked from commit 84bc06e30ba12c3ff07e577c52b63b9df162af7e)

Change-Id: I4ab169f75988c4f0d924416a30196f21c1a043a3

9 years agoReset GC performance stats at zygote fork.
Hiroshi Yamauchi [Thu, 11 Jun 2015 00:20:54 +0000 (17:20 -0700)]
Reset GC performance stats at zygote fork.

So GCs before a zygote fork won't be attributed to an app.

Bug: 21491908
Change-Id: Ib37bc587e0f039ef8faeabe63dec19de49501863

9 years agoLet classloader provide correct LD_LIBRARY_PATH
Dmitriy Ivanov [Fri, 5 Jun 2015 20:01:52 +0000 (13:01 -0700)]
Let classloader provide correct LD_LIBRARY_PATH

Rely on BaseDexClassLoader to provide correct LD_LIBRARY_PATH

Bug: http://b/21647354
Bug: http://b/21667767
Bug: http://b/8076853
Change-Id: I8c690a2578d5de43be9da964fa5a4c0246aa6eec

9 years agoQuick: Fix LoopRepeatingTopologicalSortIterator.
Vladimir Marko [Mon, 8 Jun 2015 15:39:02 +0000 (16:39 +0100)]
Quick: Fix LoopRepeatingTopologicalSortIterator.

Always push the loop head on the loop head stack. This fixes
a bug where we failed to return to an unnatural loop head to
recalculate its GVN data.

Bug: 17410955

(cherry picked from commit 67c8c942e9dfcabd548351db75e6d3b8b5165afa)

Change-Id: I44b9a17cbcd7307d1cc70ac564b99e29803723c5

9 years agoMerge "More LOW_4G optimizations" into mnc-dev
Mathieu Chartier [Mon, 8 Jun 2015 18:33:25 +0000 (18:33 +0000)]
Merge "More LOW_4G optimizations" into mnc-dev

9 years agoMerge "Revert "Revert "Turn off duplicate-classes checking""" into mnc-dev
Andreas Gampe [Sun, 7 Jun 2015 21:35:46 +0000 (21:35 +0000)]
Merge "Revert "Revert "Turn off duplicate-classes checking""" into mnc-dev

9 years agoMerge "ART: Add SetSpecialSignalHandlerFn to version-script.txt" into mnc-dev
Andreas Gampe [Sat, 6 Jun 2015 03:53:37 +0000 (03:53 +0000)]
Merge "ART: Add SetSpecialSignalHandlerFn to version-script.txt" into mnc-dev

9 years agoART: Add SetSpecialSignalHandlerFn to version-script.txt
Andreas Gampe [Sat, 6 Jun 2015 03:45:31 +0000 (20:45 -0700)]
ART: Add SetSpecialSignalHandlerFn to version-script.txt

Expose the new function from the sigchainlib implementation.

Bug: 20217701

(cherry picked from commit e089920eb0abc10eca708dbf5993134aa7e8d9b0)

Change-Id: I7d21025595775e057ea703236ca88ceb07173136

9 years agoam b8154d5c: resolved conflicts for merge of e8a4b652 to lmp-mr1-ub-dev
Vladimir Marko [Sat, 6 Jun 2015 00:06:18 +0000 (00:06 +0000)]
am b8154d5c: resolved conflicts for merge of e8a4b652 to lmp-mr1-ub-dev

* commit 'b8154d5cc707921fadf92fedc65a66a3e8901126':
  Revert "Quick: Create GC map based on compiler data. DO NOT MERGE"

9 years agoam 5d3acebd: resolved conflicts for merge of c8d000a1 to lmp-mr1-ub-dev
Vladimir Marko [Sat, 6 Jun 2015 00:06:16 +0000 (00:06 +0000)]
am 5d3acebd: resolved conflicts for merge of c8d000a1 to lmp-mr1-ub-dev

* commit '5d3acebd1fe859cbf6fb3831815eb7f3c1f3e442':
  Revert "Quick: Fix "select" pattern to update data used for GC maps. DO NOT MERGE"

9 years agoam e279c0c4: resolved conflicts for merge of fad2cbf9 to lmp-mr1-ub-dev
Vladimir Marko [Sat, 6 Jun 2015 00:06:13 +0000 (00:06 +0000)]
am e279c0c4: resolved conflicts for merge of fad2cbf9 to lmp-mr1-ub-dev

* commit 'e279c0c4e9ecc464ab10c9d9cd3404c3b0ed6845':
  Quick: Fix "select" pattern to update data used for GC maps. DO NOT MERGE

9 years agoam fb695b34: resolved conflicts for merge of 7cc8f9aa to lmp-mr1-ub-dev
Vladimir Marko [Sat, 6 Jun 2015 00:06:12 +0000 (00:06 +0000)]
am fb695b34: resolved conflicts for merge of 7cc8f9aa to lmp-mr1-ub-dev

* commit 'fb695b34268bb7f9270f07ecaac554e49b5b6a92':
  Quick: Create GC map based on compiler data. DO NOT MERGE

9 years agoUse runFinalizationWithTimeout for native allocations
Mathieu Chartier [Fri, 5 Jun 2015 20:21:05 +0000 (13:21 -0700)]
Use runFinalizationWithTimeout for native allocations

Prevents deadlocks by not waiting longer than 250ms for finalizers
to complete.

Bug: 21544853
Change-Id: I57b2f7ae8b74185922eb3c15ba0ab71a4d2348aa

9 years agoMore LOW_4G optimizations
Mathieu Chartier [Thu, 4 Jun 2015 23:22:41 +0000 (16:22 -0700)]
More LOW_4G optimizations

Eagerly try to map at an address when it doesn't overlap with
the ART known maps.

Reduces time spent creating the heap on N9 from ~100ms to ~10ms.

Bug: 20727525
Change-Id: Ie8982ca9d1f3158104b2b53b992c3a28841fc443

9 years agoAdd atrace calls to runtime start and heap create
Richard Uhler [Tue, 7 Apr 2015 17:56:50 +0000 (10:56 -0700)]
Add atrace calls to runtime start and heap create

Bug: 20727525

Change-Id: I91a74b793fb9eda8ed580244a6a5fd313ef2eb27

9 years agoAdd optimization for LOW_4G allocator
Mathieu Chartier [Thu, 4 Jun 2015 20:42:14 +0000 (13:42 -0700)]
Add optimization for LOW_4G allocator

The optimization uses the maps_ field to skip over regions which we
know wont be large enough for the request.

Reduces time to create heap from 500-700ms to 100ms on N9.

Bug: 20727525

Change-Id: I4fa92d58c2e135ba31a03ababff46669089bb542

9 years agoresolved conflicts for merge of e8a4b652 to lmp-mr1-ub-dev
Vladimir Marko [Thu, 4 Jun 2015 10:14:23 +0000 (11:14 +0100)]
resolved conflicts for merge of e8a4b652 to lmp-mr1-ub-dev