OSDN Git Service

android-x86/dalvik.git
12 years agoam 68e8f6c0: am 53015360: am 5a57e766: Merge "Change dx.bat to Windows EOL."
Raphael Moll [Wed, 13 Jul 2011 21:55:32 +0000 (14:55 -0700)]
am 68e8f6c0: am 53015360: am 5a57e766: Merge "Change dx.bat to Windows EOL."

* commit '68e8f6c07d1d875dab74f85dcfe0c0d7ac813e29':
  Change dx.bat to Windows EOL.

12 years agoam f54c7016: am c8d71801: resolved conflicts for merge of d0d351b2 to gingerbread...
David 'Digit' Turner [Wed, 13 Jul 2011 21:54:05 +0000 (14:54 -0700)]
am f54c7016: am c8d71801: resolved conflicts for merge of d0d351b2 to gingerbread-plus-aosp

* commit 'f54c7016261fefdf146137d50b63ca91ac21b80e':
  Only use O_BINARY if it is defined (windows compatibility)
  Update to allow x86-atom build for FI on Gingerbread
  Combined patch from master branch

12 years agoMerge "Tidying of the jweak fix."
Elliott Hughes [Tue, 12 Jul 2011 20:11:34 +0000 (13:11 -0700)]
Merge "Tidying of the jweak fix."

12 years agoMerge "Remove the simulator target from all makefiles. Bug: 5010576"
Jeff Brown [Tue, 12 Jul 2011 19:11:47 +0000 (12:11 -0700)]
Merge "Remove the simulator target from all makefiles. Bug: 5010576"

12 years agoTidying of the jweak fix.
Elliott Hughes [Tue, 12 Jul 2011 18:07:22 +0000 (11:07 -0700)]
Tidying of the jweak fix.

Bug: 4260055
Change-Id: I1fd56f6c0ea1e2a7245fb2551daf2099bec99709

12 years agoRemove the simulator target from all makefiles.
Jeff Brown [Tue, 12 Jul 2011 05:11:48 +0000 (22:11 -0700)]
Remove the simulator target from all makefiles.
Bug: 5010576

Change-Id: I544b54b673d9fd42197a5c97a291578a0bd0db5f

12 years agoFix the jweak implementation.
Elliott Hughes [Mon, 11 Jul 2011 23:44:34 +0000 (16:44 -0700)]
Fix the jweak implementation.

We need to distinguish between "cleared weak global" and "deleted weak global".
Previously we used NULL for both. Now we add a magic value for cleared weak
globals. I've also switched the GC over to using iterators, so IndirectRefTable
itself becomes responsible for not showing bad pointers to the GC.

I've also improved the reference table dumping to cope with the new scheme and
to be a bit easier to read (through extra indentation).

Bug: 4260055
Change-Id: I26af301fb2b46d014c6f6b0915a8f8a7fb6d7c5b

12 years agoam 53015360: am 5a57e766: Merge "Change dx.bat to Windows EOL."
Raphael Moll [Mon, 11 Jul 2011 23:59:46 +0000 (16:59 -0700)]
am 53015360: am 5a57e766: Merge "Change dx.bat to Windows EOL."

* commit '53015360753df7325e3cc84c44bee5b48b497436':
  Change dx.bat to Windows EOL.

12 years agoam 5a57e766: Merge "Change dx.bat to Windows EOL."
Raphael Moll [Mon, 11 Jul 2011 23:57:50 +0000 (16:57 -0700)]
am 5a57e766: Merge "Change dx.bat to Windows EOL."

* commit '5a57e766a662184902e215b52cb943e02d9fa827':
  Change dx.bat to Windows EOL.

12 years agoMerge "Change dx.bat to Windows EOL."
Raphael Moll [Mon, 11 Jul 2011 23:50:51 +0000 (16:50 -0700)]
Merge "Change dx.bat to Windows EOL."

12 years agoam c8d71801: resolved conflicts for merge of d0d351b2 to gingerbread-plus-aosp
David 'Digit' Turner [Mon, 11 Jul 2011 22:18:45 +0000 (15:18 -0700)]
am c8d71801: resolved conflicts for merge of d0d351b2 to gingerbread-plus-aosp

* commit 'c8d718012b0ac4abf668a9f494c33d2dd8a314e5':
  Only use O_BINARY if it is defined (windows compatibility)
  Update to allow x86-atom build for FI on Gingerbread
  Combined patch from master branch

12 years agoChange dx.bat to Windows EOL.
Raphael Moll [Mon, 11 Jul 2011 22:16:34 +0000 (18:16 -0400)]
Change dx.bat to Windows EOL.

Change-Id: I0adc6101297e8491814599d345b3cfd3278837cd

12 years agoresolved conflicts for merge of d0d351b2 to gingerbread-plus-aosp
David 'Digit' Turner [Mon, 11 Jul 2011 21:20:22 +0000 (23:20 +0200)]
resolved conflicts for merge of d0d351b2 to gingerbread-plus-aosp

Change-Id: I1594c21fb3dd761b1e2275be2019ec139cf64174

12 years agoAdd JNI app bug workarounds.
Elliott Hughes [Mon, 11 Jul 2011 02:15:13 +0000 (19:15 -0700)]
Add JNI app bug workarounds.

Specifically, this hands out direct pointers for all local references,
and lets you use a JNIEnv* on the wrong thread. This is off by default,
but enabled for apps that don't have ICS as their targetSdkVersion.

Bug: 4772166
Change-Id: I20c403a8e63481a35d579d2bd3b121c80ec08f89

12 years agoMerge "Allow an app's targetSdkVersion to be set by the zygote."
Elliott Hughes [Sat, 9 Jul 2011 01:11:38 +0000 (18:11 -0700)]
Merge "Allow an app's targetSdkVersion to be set by the zygote."

12 years agoAllow an app's targetSdkVersion to be set by the zygote.
Elliott Hughes [Fri, 8 Jul 2011 18:10:45 +0000 (11:10 -0700)]
Allow an app's targetSdkVersion to be set by the zygote.

Bug: 4772166
Change-Id: I7dbfdc2f2856efe608f0474d83326e6f0ba17658

12 years agomerge intel x86 patches into gingerbread branch
David 'Digit' Turner [Fri, 8 Jul 2011 16:19:01 +0000 (18:19 +0200)]
merge intel x86 patches into gingerbread branch

12 years agoRemove dead code/unused variables to avoid gcc-4.6 warnings.
Doug Kwan [Thu, 7 Jul 2011 20:49:27 +0000 (13:49 -0700)]
Remove dead code/unused variables to avoid gcc-4.6 warnings.

Change-Id: I291fd42e91085c51772f560d424334874bef8add

12 years agoImprove a comment.
Elliott Hughes [Thu, 7 Jul 2011 17:45:03 +0000 (10:45 -0700)]
Improve a comment.

Change-Id: If6636879dcdc15a33a083a19284de5fe8056e797

12 years agoTurn on third-party JNI logging if the relevant bit is set.
Elliott Hughes [Thu, 7 Jul 2011 00:26:38 +0000 (17:26 -0700)]
Turn on third-party JNI logging if the relevant bit is set.

Change-Id: I3260233516fa2d57c4876056168d31881d8666a9

12 years agoDon't abort when a weak global's referent is cleared.
Elliott Hughes [Wed, 6 Jul 2011 21:22:18 +0000 (14:22 -0700)]
Don't abort when a weak global's referent is cleared.

This also makes us less likely to output spurious warnings when
dealing with nulled-out weak globals, and lets us provide more
helpful warnings when warnings are called for.

Bug: 4991942
Change-Id: I99b88e66e07f79562da2cd9d594b93bff218d595

12 years agoAdded mutex for jdwp socket writes to prevent interleaving.
jeffhao [Thu, 30 Jun 2011 23:52:28 +0000 (16:52 -0700)]
Added mutex for jdwp socket writes to prevent interleaving.

This commit includes a following change: Clean up jdwp adb/socket
and fix initialization issues.

Change-Id: I79461b92d690e42d8d1d82d31fbcacb4d5650a74

12 years agoFix native method logging to show local references rather than direct pointers.
Elliott Hughes [Thu, 30 Jun 2011 20:40:52 +0000 (13:40 -0700)]
Fix native method logging to show local references rather than direct pointers.

This is necessary (but not sufficient) for debugging third-party JNI bugs.
It's the second half of the logging story, but still doesn't address the
question of "how does the developer turn on the logging?".

This removes the variant JNI bridges at the cost of adding a couple of
booleans to struct Method. Performance is about the same, except synchronized
native methods are quite a bit faster after the change.

Before:
                             benchmark  ns linear runtime
                      _emptyJniMethod0 333 ==========
                      _emptyJniMethod6 367 ===========
                     _emptyJniMethod6L 921 ==============================
                _emptyJniStaticMethod0 259 ========
                _emptyJniStaticMethod6 287 =========
               _emptyJniStaticMethod6L 873 ============================
    _emptyJniStaticSynchronizedMethod0 404 =============
          _emptyJniSynchronizedMethod0 452 ==============

After:
                             benchmark  ns linear runtime
                      _emptyJniMethod0 344 ==========
                      _emptyJniMethod6 348 ==========
                     _emptyJniMethod6L 969 ==============================
                _emptyJniStaticMethod0 265 ========
                _emptyJniStaticMethod6 293 =========
               _emptyJniStaticMethod6L 968 =============================
    _emptyJniStaticSynchronizedMethod0 265 ========
          _emptyJniSynchronizedMethod0 323 ==========

A better optimization for the case where there are reference arguments
would be to keep a list of argument indexes in the struct Method, so we
could iterate directly over those arguments that need converting to
local references. That would also let us do something about the overhead
of repeatedly looking up which local reference table and cookie to use.

But now is not the time.

Change-Id: Ie32daca1b31be057a44f1ed4b5d28d1634380e1d

12 years agoMerge "Add two new JNI debugging options."
Elliott Hughes [Thu, 30 Jun 2011 17:40:04 +0000 (10:40 -0700)]
Merge "Add two new JNI debugging options."

12 years agoAdd two new JNI debugging options.
Elliott Hughes [Thu, 30 Jun 2011 17:31:31 +0000 (10:31 -0700)]
Add two new JNI debugging options.

The alwaysCheckThread option provides some backwards compatibility for apps
that misuse JNIEnv*s across threads. The logThirdPartyJni is a step towards
making it easier for third-party developers to debug their JNI errors.

Change-Id: I134374da0fe94f3fbc6b6d5aef52e3eef658aff9

12 years agoMark a variable as volatile to suppress a gcc warning.
Doug Kwan [Wed, 29 Jun 2011 03:53:07 +0000 (20:53 -0700)]
Mark a variable as volatile to suppress a gcc warning.

Change-Id: Ic5263e2d7e52c72d35bf706d86bba2ad6548ce58

12 years agoMerge "Make it easier to recognize JNI reference bugs."
Elliott Hughes [Wed, 29 Jun 2011 18:17:45 +0000 (11:17 -0700)]
Merge "Make it easier to recognize JNI reference bugs."

12 years agoMake it easier to recognize JNI reference bugs.
Elliott Hughes [Wed, 29 Jun 2011 18:10:21 +0000 (11:10 -0700)]
Make it easier to recognize JNI reference bugs.

CheckJNI is still your best choice, but now, even without CheckJNI, you'll get
a strong clue:

E/dalvikvm( 4168): JNI ERROR (app bug): accessed stale local reference at index 10 (top=8)
E/dalvikvm( 4168): VM aborting

Change-Id: Ia65e1e430bc53509add19816ef06cc5dbd1b3e98

12 years agoMerge "Make dual clock mode the default."
Jeff Brown [Wed, 29 Jun 2011 03:14:46 +0000 (20:14 -0700)]
Merge "Make dual clock mode the default."

12 years agoImprove JNI tracing even further.
Elliott Hughes [Fri, 24 Jun 2011 22:52:55 +0000 (15:52 -0700)]
Improve JNI tracing even further.

This adds return values and general support for the primitive types.

For example:

  JNI: libcore.io.Posix.writeBytes -> GetIntField((JNIEnv*)0x9ebf9a8, 0x3e00005, java.io.FileDescriptor.descriptor)
  JNI:                             <- GetIntField returned 13

Although we still decode jclass, when a jclass is a return value we also
include the pointer. This makes it easier to follow call sequences like
this:

  JNI: dalvik.system.NativeStart.main -> FindClass((JNIEnv*)0x9e3e458, "java/text/Bidi$Run")
  JNI:                                <- FindClass returned java.lang.Class<java.text.Bidi$Run> (0x100001)
  JNI: dalvik.system.NativeStart.main -> NewGlobalRef((JNIEnv*)0x9e3e458, 0x100001)
  JNI:                                <- NewGlobalRef returned 0x100002

Here, the argument to NewGlobalRef is clearly the jclass local reference.

(Cherry-pick of 047cab15c4cb967568b25b616f02ed0f9a169430 from dalvik-dev.)

Change-Id: Ie8997b11a9cc9a0bc8f11ab3fc43f4892921316b

12 years agoImprove -verbose:jni.
Elliott Hughes [Wed, 22 Jun 2011 20:24:06 +0000 (13:24 -0700)]
Improve -verbose:jni.

The old output just told you what functions were being called and made no
attempt to show you their arguments. The new output was sufficient to debug
an actual problem with an app we don't have the source to.

Still to do:
0. an easier way for third-party developers to enable this.
1. the primitive type arguments to SetIntField and so forth.
2. return values.

A few examples of the new output...

A decoded jclass:
  JNI: libcore.io.Posix.readBytes called IsInstanceOf((JNIEnv*)0x9618470, 0x28100015, java.lang.Class<byte[]>)

A decoded jfieldID:
  JNI: libcore.io.Posix.ioctlInt called GetIntField((JNIEnv*)0x9618470, 0x5cb00011, java.io.FileDescriptor.descriptor)

A decoded jmethodID (the FileDescriptor constructor):
  JNI: libcore.io.Posix.open called NewObject((JNIEnv*)0x9780480, java.lang.Class<java.io.FileDescriptor>, java.io.FileDescriptor.<init>()V, ...)

A const char*:
  JNI: libcore.io.Posix.getsockoptLinger called NewStringUTF((JNIEnv*)0x9618470, "getsockopt")

A jint release mode:
  JNI: libcore.io.Posix.writeBytes called ReleaseByteArrayElements((JNIEnv*)0x9780480, 0x2700009, (void*) 0xf5f623c4, JNI_ABORT)

The -verbose:jni option now turns on a bit more output about JNI_OnLoad calls
but no longer causes any logging of calls to JNIEnv or JavaVM functions. The
old -Xjnitrace: option has been extended to enable this new tracing for the
native methods that it covers. They go very well together for debugging
purposes.

I've also made us a bit more verbose if we fail to initialize. In the longer
term I think we want to just abort if we hit any failure during startup, but
my extra logging will save us a bit of time next time we have one of these
failures (this one was caused for me by only having one half of the finalizer
watchdog change; I was missing the libcore side).

(Cherry pick of 6734b8224fb869c94e42e704ec03f2ce8483af2b from dalvik-dev.)

Change-Id: I69b7620b20620e9f06576da244520d9d83f89ab8

12 years agoMerge "Add a dual clock profiler tracing mode."
Jeff Brown [Tue, 28 Jun 2011 23:01:27 +0000 (16:01 -0700)]
Merge "Add a dual clock profiler tracing mode."

12 years agoFix debugger output of floats and doubles.
jeffhao [Mon, 27 Jun 2011 22:07:17 +0000 (15:07 -0700)]
Fix debugger output of floats and doubles.

Change-Id: Idd839eef0ecb023fc4cdec20648bebbe5756d399

12 years agoMake dual clock mode the default.
Jeff Brown [Sat, 25 Jun 2011 00:53:48 +0000 (17:53 -0700)]
Make dual clock mode the default.

Change-Id: Ic2f7cb8a8055319472d16be03c7ca242bf915af0

12 years agoAdd a dual clock profiler tracing mode.
Jeff Brown [Sat, 25 Jun 2011 00:05:33 +0000 (17:05 -0700)]
Add a dual clock profiler tracing mode.

Dalvik previously supported using either the thread-cpu clock
or the real time clock as the timebase for profiler traces.
This change adds a dual clock mode where both thread-cpu time
and real time timestamps are collected.

Using dual clock mode significantly improves TraceView ability
to accurately reconstruct the global timeline of events,
particularly on SMP systems.

For now, thread-cpu mode remains the default.

Dual clock mode can be enabled by running the following command
and restarting the system server.
   adb shell setprop dalvik.vm.extra-opts -Xprofile:dualclock

Change-Id: I8c0d91a99aa6829dadea328e54dc1225d9827391

12 years agoFix a use of uninitialized variable found by gcc-4.6. I don't think this is a
Doug Kwan [Sun, 26 Jun 2011 19:26:18 +0000 (12:26 -0700)]
Fix a use of uninitialized variable found by gcc-4.6.  I don't think this is a
real problem as we will only see an undefined value if the list has no instructions other than NOPs.

Change-Id: I055510831ca1c566e2daa2b4b2acbaa655fa735a

12 years agoMerge "Fix gcc-4.6 warnings."
Doug Kwan [Sat, 25 Jun 2011 00:39:27 +0000 (17:39 -0700)]
Merge "Fix gcc-4.6 warnings."

12 years agoFix gcc-4.6 warnings.
Doug Kwan [Fri, 24 Jun 2011 22:48:32 +0000 (15:48 -0700)]
Fix gcc-4.6 warnings.

Change-Id: I62cfb8b1a39499366ee18c1904e6991567f78571

12 years agoFix for adb shell hang after adb root.
Brett Chabot [Fri, 24 Jun 2011 21:34:26 +0000 (14:34 -0700)]
Fix for adb shell hang after adb root.

Abort JDWP thread if netstate is shutting down.

Bug 4731499

Change-Id: I4e1ec9cf64d00682b1dd10e448c3665a4fc77ba8

12 years agoThrow NullPointerExceptions with detail messages.
Elliott Hughes [Fri, 24 Jun 2011 00:29:38 +0000 (17:29 -0700)]
Throw NullPointerExceptions with detail messages.

Bug: 4905110
Change-Id: Iebcc45049c1ea14ceef6d44a19dd8cb618392101

12 years agoMerge "Remove an unused internal native."
Elliott Hughes [Thu, 23 Jun 2011 23:02:47 +0000 (16:02 -0700)]
Merge "Remove an unused internal native."

12 years agoRemove an unused internal native.
Elliott Hughes [Thu, 23 Jun 2011 22:50:13 +0000 (15:50 -0700)]
Remove an unused internal native.

Change-Id: I9a8976e7e505dfa6b641a76edc1e65be68b73339

12 years agoMerge "[JIT] Fix uninitialized read (issue #4929028)"
buzbee [Thu, 23 Jun 2011 22:48:55 +0000 (15:48 -0700)]
Merge "[JIT] Fix uninitialized read (issue #4929028)"

12 years ago[JIT] Fix uninitialized read (issue #4929028)
buzbee [Thu, 23 Jun 2011 22:20:56 +0000 (15:20 -0700)]
[JIT] Fix uninitialized read (issue #4929028)

Found via Valgrind.  This should not have caused any bad code to be
generated in this case, but good to fix.  Use arrays cleared on creation.

Change-Id: I5f87c6ec74e12b9c99835695b71b6ee49505503a

12 years agoresolved conflicts for merge of cc8c750a to master
Elliott Hughes [Thu, 23 Jun 2011 18:57:43 +0000 (11:57 -0700)]
resolved conflicts for merge of cc8c750a to master

(The transition to C++ requires an additional cast.)

Change-Id: I736f6533511d5ab2d1f05903b06d8f333adba492

12 years agoFix native methods that weren't registered via RegisterNatives.
Elliott Hughes [Thu, 23 Jun 2011 17:29:10 +0000 (10:29 -0700)]
Fix native methods that weren't registered via RegisterNatives.

Cherry pick of a64af4aabf261d34eac8b5a9d92992ee70051829.

Change-Id: I43df4e33e39ccaf9e26c842f22da3391cfa17e2b

12 years agoMerge remote branch 'goog/dalvik-dev' into dalvik-dev-to-master
Brian Carlstrom [Wed, 22 Jun 2011 17:58:40 +0000 (10:58 -0700)]
Merge remote branch 'goog/dalvik-dev' into dalvik-dev-to-master

12 years agoam 03c60a44: Merge "Undecoded jobject leaking in through attachThread"
Elliott Hughes [Wed, 22 Jun 2011 17:30:17 +0000 (10:30 -0700)]
am 03c60a44: Merge "Undecoded jobject leaking in through attachThread"

* commit '03c60a44861951126affa75ba8ee4233c136fe92':
  Undecoded jobject leaking in through attachThread

12 years agoMerge "Undecoded jobject leaking in through attachThread"
Elliott Hughes [Wed, 22 Jun 2011 16:25:01 +0000 (09:25 -0700)]
Merge "Undecoded jobject leaking in through attachThread"

12 years agoMerge "Clean up IndirectRefTable a bit." into dalvik-dev
Elliott Hughes [Tue, 21 Jun 2011 21:55:09 +0000 (14:55 -0700)]
Merge "Clean up IndirectRefTable a bit." into dalvik-dev

12 years agoClean up IndirectRefTable a bit.
Elliott Hughes [Tue, 21 Jun 2011 00:50:41 +0000 (17:50 -0700)]
Clean up IndirectRefTable a bit.

The main purpose here was to have slightly less unclear warnings for
JNI local reference abuse.

Change-Id: I2c6378dd0a94d8afb96a8e409f7460205e3cd315

12 years agoam bea345e1: Fix the watchdog test to handle the failure from managed code.
Jesse Wilson [Tue, 21 Jun 2011 18:32:39 +0000 (11:32 -0700)]
am bea345e1: Fix the watchdog test to handle the failure from managed code.

* commit 'bea345e1cd8acd993758366df42af7c6c9cf76d6':
  Fix the watchdog test to handle the failure from managed code.

12 years agoFix the watchdog test to handle the failure from managed code.
Jesse Wilson [Tue, 21 Jun 2011 17:22:19 +0000 (10:22 -0700)]
Fix the watchdog test to handle the failure from managed code.

Change-Id: I9691f414b953c7e11791069a574441b993611238
http://b/4144865

12 years agoam 0c632a84: Merge "Add isDebuggerActive API for the finalizer watchdog."
Jesse Wilson [Tue, 21 Jun 2011 03:26:56 +0000 (20:26 -0700)]
am 0c632a84: Merge "Add isDebuggerActive API for the finalizer watchdog."

* commit '0c632a8484839ceeffc6fdf04c310c02c7531530':
  Add isDebuggerActive API for the finalizer watchdog.

12 years agoMerge "Add isDebuggerActive API for the finalizer watchdog."
Jesse Wilson [Tue, 21 Jun 2011 02:55:27 +0000 (19:55 -0700)]
Merge "Add isDebuggerActive API for the finalizer watchdog."

12 years agoAdd isDebuggerActive API for the finalizer watchdog.
Jesse Wilson [Mon, 20 Jun 2011 22:09:16 +0000 (15:09 -0700)]
Add isDebuggerActive API for the finalizer watchdog.

Change-Id: Ib0afcd15327c0a3dd8c565036a8f010e318adc9e
http://b/4144865

12 years agoDon't be too specific in reference table summaries.
Elliott Hughes [Mon, 20 Jun 2011 18:53:41 +0000 (11:53 -0700)]
Don't be too specific in reference table summaries.

Implying that the examplar Class' specific type was true of all
the classes was misleading; we should just say "Class" in the
summary:

W/dalvikvm(  801): JNI local reference table summary (23 entries):
W/dalvikvm(  801):    20 of java.lang.Class (19 unique instances)
W/dalvikvm(  801):     2 of java.lang.String (2 unique instances)
W/dalvikvm(  801):     1 of java.lang.String[] (2 elements)

Change-Id: Ia961cfc689aa390c84ecbc96e44bdd64448ac051

12 years agoRemove incorrect comment.
Elliott Hughes [Mon, 20 Jun 2011 17:46:08 +0000 (10:46 -0700)]
Remove incorrect comment.

Change-Id: I3d1d84f8d36b8ee3d07e0af7e29faa72f3615e92

12 years agoFix build: rebase went wrong.
Elliott Hughes [Fri, 17 Jun 2011 23:57:49 +0000 (16:57 -0700)]
Fix build: rebase went wrong.

Change-Id: I390edcb3ddd52d2fb9285d2de42617dff68fdcf2

12 years agoMake some of the StringObject functions member functions.
Elliott Hughes [Fri, 17 Jun 2011 22:59:16 +0000 (15:59 -0700)]
Make some of the StringObject functions member functions.

Change-Id: I72ed13c16f0cb24498772c453ba268a0f65f208a

12 years agoAdd and use StringAppendF.
Elliott Hughes [Fri, 17 Jun 2011 20:55:27 +0000 (13:55 -0700)]
Add and use StringAppendF.

I've also removed the dvm prefix from the existing StringPrintf.

Change-Id: I3d01f676c876957b6c6e032c674e1a06c3670021

12 years agoMerge "Improve reference table dumping." into dalvik-dev
Elliott Hughes [Fri, 17 Jun 2011 17:33:10 +0000 (10:33 -0700)]
Merge "Improve reference table dumping." into dalvik-dev

12 years agoImprove reference table dumping.
Elliott Hughes [Thu, 16 Jun 2011 23:55:24 +0000 (16:55 -0700)]
Improve reference table dumping.

1. Show the newest entry first; I always assume the top is the newest.
2. Use human-readable type names.
3. Improve the human-readable type name code to show _which_ Class (i.e.
   java.lang.Class<java.lang.String> rather than just java.lang.Class).
4. Make it clear when we're reporting the number of elements in an array.
5. Show the first few characters of a string.
6. Show the length of a string if we truncate it.

(I've also removed some redundant casts and improved const-correctness.)

Example:

 Last 10 entries in JNI local reference table:
    16: 0x40f8ec70 java.lang.String "android.permissi... (41 chars)
    15: 0x40f8d450 android.os.Parcel
    14: 0x40f8eb90 java.lang.String "BlackSurface"
    13: 0x408caca0 android.view.SurfaceSession
    12: 0x40f8eb60 android.view.Surface
    11: 0x406bc6f0 java.lang.Class<com.android.server.SystemServer>
    10: 0x406c0278 java.lang.String "com/android/serv... (31 chars)
     9: 0x4015d488 dalvik.system.PathClassLoader
     8: 0x40148de8 java.lang.Class<java.lang.ClassLoader>
     7: 0x406bc560 java.lang.String[]
 JNI local reference table summary (17 entries):
     6 of java.lang.Class<com.android.server.SystemServer> (5 unique instances)
     5 of java.lang.String (5 unique instances)
     1 of java.lang.String[]
     1 of java.lang.String[] (2 elements)
     1 of dalvik.system.PathClassLoader
     1 of android.os.Parcel
     1 of android.view.SurfaceSession
     1 of android.view.Surface

Change-Id: I56494104cd0daada3ecc1e610f1c94df1e11c640

12 years agoam a7ab2182: Fix unbundled apps on pre-ICS devices.
Elliott Hughes [Thu, 16 Jun 2011 21:04:10 +0000 (14:04 -0700)]
am a7ab2182: Fix unbundled apps on pre-ICS devices.

* commit 'a7ab2182266fb9ea1e4e8d1347fc6d6da35760d4':
  Fix unbundled apps on pre-ICS devices.

12 years agoFix unbundled apps on pre-ICS devices.
Elliott Hughes [Thu, 16 Jun 2011 19:56:27 +0000 (12:56 -0700)]
Fix unbundled apps on pre-ICS devices.

Change-Id: I4aa58b5395423ec2f05be3dcb1783d0e35eabb2c

12 years agoBreak a dependency on frameworks/base when building a host VM.
Elliott Hughes [Wed, 15 Jun 2011 18:12:05 +0000 (11:12 -0700)]
Break a dependency on frameworks/base when building a host VM.

These aren't necessarily good abstractions, but they're no worse than what
we had, and having them factored out is a step in the right direction.

Change-Id: I5b839608317d2ca1ca54d8a38624fb686f2c37de

12 years agoBetter comments for yesterday's change.
Elliott Hughes [Wed, 15 Jun 2011 16:31:44 +0000 (09:31 -0700)]
Better comments for yesterday's change.

Change-Id: I1e05fb0e209d44874101b5ca8b7c8efec6810d5f

12 years agoam cd10c009: am f682dd64: (-s ours) am 1dd6e412: am a028d87f: Always grow the limit...
Carl Shapiro [Wed, 15 Jun 2011 05:08:41 +0000 (22:08 -0700)]
am cd10c009: am f682dd64: (-s ours) am 1dd6e412: am a028d87f: Always grow the limit address of the a heap along with its size.

* commit 'cd10c0092f7056f4d0b42bf734f8badf75d84fb9':
  Always grow the limit address of the a heap along with its size.

12 years agoam f682dd64: (-s ours) am 1dd6e412: am a028d87f: Always grow the limit address of...
Carl Shapiro [Wed, 15 Jun 2011 05:02:07 +0000 (22:02 -0700)]
am f682dd64: (-s ours) am 1dd6e412: am a028d87f: Always grow the limit address of the a heap along with its size.

* commit 'f682dd646a92f53221981a434abc06da5d249404':
  Always grow the limit address of the a heap along with its size.

12 years agoam 1dd6e412: am a028d87f: Always grow the limit address of the a heap along with...
Carl Shapiro [Wed, 15 Jun 2011 04:59:05 +0000 (21:59 -0700)]
am 1dd6e412: am a028d87f: Always grow the limit address of the a heap along with its size.

* commit '1dd6e4124b5ec8b7392163cb055028678aaf042d':
  Always grow the limit address of the a heap along with its size.

12 years agoam a028d87f: Always grow the limit address of the a heap along with its size.
Carl Shapiro [Wed, 15 Jun 2011 04:56:54 +0000 (21:56 -0700)]
am a028d87f: Always grow the limit address of the a heap along with its size.

* commit 'a028d87fb310eae8cac821183aa91567ec8cb0f9':
  Always grow the limit address of the a heap along with its size.

12 years agoAlways grow the limit address of the a heap along with its size.
Carl Shapiro [Wed, 15 Jun 2011 03:51:45 +0000 (20:51 -0700)]
Always grow the limit address of the a heap along with its size.

Previously, clearing the growth limit only updated the maximumSize of
the unlimited heap without updating the limit value.  This caused any
operations iterated over the extent of the heap to ignore allocations
beyond the original heap size.  With this change the limit is always
kept in agreement with the maximumSize.

Bug: 4539441
Change-Id: I08c8004e724549d196e1fd5d6ad22efc85b0c8d2

12 years agoNormalize the include guard style.
Carl Shapiro [Wed, 15 Jun 2011 03:31:24 +0000 (20:31 -0700)]
Normalize the include guard style.

An leading underscore followed by a capital letter is a reserved
name space in C and C++.

This change also moves any #include directives within the include
guard in some of the compiler/codegen/arm header files.

Change-Id: I9715e2c5301699d31886e61d0fe6e29483555a2a

12 years agoDx defaults to emitting dexfiles without jumbo opcodes.
jeffhao [Tue, 14 Jun 2011 23:37:22 +0000 (16:37 -0700)]
Dx defaults to emitting dexfiles without jumbo opcodes.

There's compatibility issues with going back and forth between versions,
and it's best to have dx default to a stable point and allow
optimizations to be controlled by switches. For jumbo opcodes to be
enabled, dx can be given the switch "--target-api=14".

Change-Id: I824092c795638ca329325b14c435bc41c1ab56d5

12 years agoAllow native methods to declare they don't need a JNIEnv*.
Elliott Hughes [Tue, 14 Jun 2011 20:51:55 +0000 (13:51 -0700)]
Allow native methods to declare they don't need a JNIEnv*.

Bug: 3069458
Change-Id: Ic9a6c562c5abf9607dd4c8a71b0d1e389e6d340b

12 years agoMerge "Fix an issue regarding FindClass and threads without native methods." into...
Carl Shapiro [Tue, 14 Jun 2011 03:10:18 +0000 (20:10 -0700)]
Merge "Fix an issue regarding FindClass and threads without native methods." into dalvik-dev

12 years agoMerge "Always grow the limit address of the a heap along with its size." into dalvik-dev
Carl Shapiro [Fri, 10 Jun 2011 19:54:06 +0000 (12:54 -0700)]
Merge "Always grow the limit address of the a heap along with its size." into dalvik-dev

12 years agoDo not initiate a concurrent collection if one is already running.
Carl Shapiro [Fri, 10 Jun 2011 06:45:49 +0000 (23:45 -0700)]
Do not initiate a concurrent collection if one is already running.

It is possible to cause a recursive garbage collection by writing a
program that triggers a concurrent garbage collection and initiates a
concurrent garbage collection before the garbage collection thread is
scheduled.  For example

  for (;;) { new byte[16 << 20]; System.gc(); }

When this condition occurs a warning is logged although such warnings
ought to be upgraded to fatal errors.  With this change, when the
garbage collection thread is scheduled it first checks to see if there
is a running collection before calling down to start the collection.

Change-Id: Ia7baf5eba245bbf3fe053d3bad3f90876cad2459

12 years agoAlways grow the limit address of the a heap along with its size.
Carl Shapiro [Fri, 10 Jun 2011 06:07:37 +0000 (23:07 -0700)]
Always grow the limit address of the a heap along with its size.

Previously, clearing the growth limit only updated the maximumSize of
the unlimited heap without updating the limit value.  This caused any
operations iterated over the extent of the heap to ignore allocations
beyond the original heap size.  With this change the limit is always
kept in agreement with the maximumSize.

Bug: 4539441
Change-Id: I08c8004e724549d196e1fd5d6ad22efc85b0c8d2

12 years agoFix an issue regarding FindClass and threads without native methods.
Carl Shapiro [Fri, 10 Jun 2011 05:03:57 +0000 (22:03 -0700)]
Fix an issue regarding FindClass and threads without native methods.

Chapter 4 of the JNI specification states that when FindClass is called
through the Invocation Interface and there is no associated method, the
result of ClassLoader.getBaseClassLoader() is used as the class loader.

Previously, the case where FindClass is called from a main thread was
special cased to ensure this behavior.  However, threads which attach to
the VM but are not the main thread require similar treatment.  With this
change those threads are similarly treated as a special case.

Change-Id: Idbe33e02a10d248262b9e9f089b033ffe05c4706

12 years agoOnly use O_BINARY if it is defined (windows compatibility)
Bruce Beare [Mon, 6 Jun 2011 17:50:57 +0000 (10:50 -0700)]
Only use O_BINARY if it is defined (windows compatibility)

Change-Id: Iaa3c0812ef4d90d46b4031be7f4faca84c7d7200
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
12 years agoUpdate to allow x86-atom build for FI on Gingerbread
Johnnie Birch [Fri, 18 Feb 2011 18:06:23 +0000 (10:06 -0800)]
Update to allow x86-atom build for FI on Gingerbread

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

Change-Id: Ifa627ac3d493447013524eb0be178b5b6d952612

12 years agoCombined patch from master branch
Bruce Beare [Wed, 1 Jun 2011 22:10:47 +0000 (15:10 -0700)]
Combined patch from master branch

  From: Jack Ren <jack.ren@intel.com>
  Date: Tue, 1 Mar 2011 21:10:42 +0800
  Subject: [PATCH 1/2] sync with korg/master commit dd19f5b91a1032e60871febb143850fd81000c5a

following patches are applied in one time:

commit dd19f5b91a1032e60871febb143850fd81000c5a
Merge: 2b3d7e8 a62c84f
Author: Romain Guy <romainguy@android.com>
Date:   Thu Feb 24 11:24:47 2011 -0800

    Merge "Fix for a crash when GC weak references."

commit 2b3d7e8eccd7cbf64b2ac41c05073a9191d0d3b3
Merge: ef4b061 b4719ed
Author: Raphael Moll <ralf@android.com>
Date:   Tue Feb 22 14:55:59 2011 -0800

    Merge "Open dexdump files in binary mode."

commit b4719eda048c4dc4a4b6e5280c7a2b8299051078
Author: Raphael Moll <ralf@android.com>
Date:   Wed Feb 16 13:39:27 2011 -0800

    Open dexdump files in binary mode.

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

commit a62c84f62a27a08d6bef6da0b96913d616dd659f
Author: Mattias Petersson <mattias.petersson@sonyericsson.com>
Date:   Tue Dec 21 09:28:04 2010 +0100

    Fix for a crash when GC weak references.

    When a weak reference had been cleared there was a small risk that
    the VM crashed when the cleared reference was garbage collected.

    This is an example of code that can cause the problem:
       Integer referent = new Integer(10);
       wref = new WeakReference<Integer>(referent);
       wref.clear(); //set the referent to null

    When a garbage collection starts, all objects are scanned, looking
    for objects that can be collected. During this phase, a list of
    weak references is created. A check is performed to ensure that
    only references with a non-null referent are added to this list.
    In most cases, for the example above, the referent will be null
    at this point, and it will never be added to the list. But if
    the timing is extremely bad it looks like it is possible for the
    reference to end up on the list before the referent has been set
    to null, and the referent is set to null a little while later.
    This means that we now have a reference on the list with a null
    referent.

    A bit later in the garbage collection flow, the list of weak

s is traversed in order to clear the references that
    can be collected. Here we got the crash because the code asserted
    that the referent of the references in the list should be
    non-null. And in some rare cases it actually was null. The fix
    is simply to remove the assert.

commit ef4b0613d6952770aefac07d503955eb7b962d2b
Merge: 464104b e9503ef
Author: Andy McFadden <fadden@android.com>
Date:   Mon Nov 8 19:38:19 2010 -0800

    am e9503ef8: am 886130bc: (-s ours) Two patches.

    * commit 'e9503ef8c460f4818062ecc80a9e0b4f8c6745b8':
      Two patches.

Change-Id: I04c1c9204af8197a4352358d805af40f1312d2ea
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
12 years agoMerge "Fix a minor leaks caused by failed initializations." into dalvik-dev
Carl Shapiro [Thu, 9 Jun 2011 07:33:49 +0000 (00:33 -0700)]
Merge "Fix a minor leaks caused by failed initializations." into dalvik-dev

12 years agoFix a minor leaks caused by failed initializations.
Carl Shapiro [Thu, 9 Jun 2011 01:35:26 +0000 (18:35 -0700)]
Fix a minor leaks caused by failed initializations.

Change-Id: Ie0939bce7422b224f4cfde9781470f2237ede497

12 years agoTidy up some includes.
Elliott Hughes [Wed, 8 Jun 2011 22:54:05 +0000 (15:54 -0700)]
Tidy up some includes.

Change-Id: I5abd4f8ab06db0c77fa369fcd97d8f1259b343df

12 years agoMerge "Favor Object* over void* for the heap bitmap interfaces." into dalvik-dev
Carl Shapiro [Wed, 8 Jun 2011 20:07:44 +0000 (13:07 -0700)]
Merge "Favor Object* over void* for the heap bitmap interfaces." into dalvik-dev

12 years agoFix two issues with the card table.
Carl Shapiro [Wed, 8 Jun 2011 04:42:44 +0000 (21:42 -0700)]
Fix two issues with the card table.

Several tricks are used to adjust the base of the card table to save
instructions in the write barrier.  This change corrects two
situtations where the card table did not properly account for the
effects of these tricks.

First, the card table is over allocated to ensure that the start
address can be magically aligned.  When releasing the allocation these
additional bytes were not supplied to munmap creating a potential
leak.

Second, the valid card check did not use the right base address for a
containment check.  The check used the allocation base which is may be
lower than the actual starting address.  This would cause valid cards
at the high end of the heap to be considered invalid and invalid cards
at the low end of the heap to be considered valid.

Change-Id: I83bf4167b7c081c8626b6ff504342f42d0e776a2

12 years agoFix regular exit.
Elliott Hughes [Wed, 8 Jun 2011 00:38:12 +0000 (17:38 -0700)]
Fix regular exit.

Change-Id: I653658f3b6e533a235f1108d0b625b9bdff7630c

12 years agoFavor Object* over void* for the heap bitmap interfaces.
Carl Shapiro [Wed, 8 Jun 2011 00:32:01 +0000 (17:32 -0700)]
Favor Object* over void* for the heap bitmap interfaces.

Change-Id: I615dbff3e81a1128dc3ba43d6d426c370ae3abcf

12 years agoImprove "waiting on"/"waiting to lock" SIGQUIT dump info.
Elliott Hughes [Tue, 7 Jun 2011 23:39:20 +0000 (16:39 -0700)]
Improve "waiting on"/"waiting to lock" SIGQUIT dump info.

In particular, when we're waiting on a Class, say which class:

  I(16573)   - waiting on <0xf5ed54f8> (java.lang.Class<java.lang.ref.ReferenceQueue>)

versus:

  I(16573)   - waiting on <0xf5feda38> (a java.util.LinkedList)

Bug: http://code.google.com/p/android/issues/detail?id=17349
Change-Id: I844d02c008b1499adb02995ff3da25ba8cad0e0a

12 years agoFix gunit test build.
Elliott Hughes [Tue, 7 Jun 2011 22:56:08 +0000 (15:56 -0700)]
Fix gunit test build.

Change-Id: I409e75202cc6af0b0a48b81602f2ac322da7f404

12 years agoSwitch dvmHumanReadableDescriptor over to std::string.
Elliott Hughes [Tue, 7 Jun 2011 21:24:45 +0000 (14:24 -0700)]
Switch dvmHumanReadableDescriptor over to std::string.

(Prep work before making a change to stack dumps.)

Change-Id: I0af49b920f450fd2611e4b96e717a637483122d6

12 years agoUse std::string rather than malloc/free for saneDirName.
Elliott Hughes [Tue, 7 Jun 2011 17:07:11 +0000 (10:07 -0700)]
Use std::string rather than malloc/free for saneDirName.

Also use std::vector instead of the cutils/array cruft.

Change-Id: I273147335cafbac5d336955f53b0b29d015f0589

12 years agoNote a possible improvement.
Dan Bornstein [Mon, 6 Jun 2011 18:14:07 +0000 (11:14 -0700)]
Note a possible improvement.

This section of code was left commented out because of a bug in
dx. Since the dex format version has since changed, we can now
use detection of the format version to enable the code. This
patch just notes that fact for the record.

Change-Id: I9129bc4420c17fb8c703b424a0bac9437f796210

12 years agoAdd some error checking and clean out some cruft.
Dan Bornstein [Thu, 2 Jun 2011 19:24:11 +0000 (12:24 -0700)]
Add some error checking and clean out some cruft.

Error checking #1: When a cached dex file can't be created, do extra
analysis to figure out (and report) why.

Error checking #2: When opening classpath entries, become sensitive
to the file extension, only trying to open files with the right
extensions and complaining explicitly if it's unrecognized.

Cruft cleaning: We've never supported finding class files in directory
hierarchies in Dalvik. Fix some related comments and clean out some
code that tried (in vain) to implement a piece of that.

Bug: 4523201
Change-Id: I05b7a8570f147955cd62229fca72b50d36703752

12 years agoMerge remote branch 'goog/dalvik-dev' into dalvik-dev-to-master
Brian Carlstrom [Fri, 27 May 2011 06:49:07 +0000 (23:49 -0700)]
Merge remote branch 'goog/dalvik-dev' into dalvik-dev-to-master

12 years agoMore LOG newline cleanup.
Dan Bornstein [Thu, 26 May 2011 19:01:03 +0000 (12:01 -0700)]
More LOG newline cleanup.

This changes all the places I could find where the log string was on the
line after its LOG call.

Change-Id: Iac6a9fcc64f46631fb093824ab60237dce1a5241

12 years agoPrefer printf format "%#x" over "0x%x".
Dan Bornstein [Thu, 26 May 2011 17:46:25 +0000 (10:46 -0700)]
Prefer printf format "%#x" over "0x%x".

I exist to serve.

Change-Id: I8e2880b20eefd466da8515d5b6b0c5cb75d56169

12 years agoFurther conservation of newlines.
Dan Bornstein [Thu, 26 May 2011 17:11:58 +0000 (10:11 -0700)]
Further conservation of newlines.

Friends don't let friends end LOG() strings with newlines.

Change-Id: I5a18c766c90c4ab5f03caa6acd601d34d91beb00