summaryrefslogtreecommitdiffstats
path: root/runtime/runtime.cc
Commit message (Collapse)AuthorAgeFilesLines
* Interpreter-only mode should cause dex-to-dex compilation.Ian Rogers2014-04-171-0/+4
| | | | | | | | | | | Also, fix quick iget/iput that had similar issues to: https://android-review.googlesource.com/91423 Also, remove fall-back resolution code from quick invokes/igets/iputs as we allow class loading for the exception throw and regular verification already allows class loading. Bug: 14133618 Change-Id: I51199e6e2392da0354f64b157e79af494c183778
* Decrease target utilization for foreground apps.Mathieu Chartier2014-04-161-0/+1
| | | | | | | | | | GC time in FormulaEvaluationActions.EvaluateAndApplyChanges goes from 26.1s to 23.2s. Benchmark score goes down ~50 in FormulaEvaluationActions.EvaluateAndApplyChanges, and up ~50 in GenericCalcActions.MemAllocTest. Bug: 8788501 Change-Id: I412af1205f8b67e70a12237c990231ea62167bc0
* Prevent deadlocks in Runtime::Abort.Mathieu Chartier2014-04-101-13/+20
| | | | | | | | | If we have the threads suspended, attempting to use a ScopedObjectAccess causes a deadlock. We now specifically avoid this to prevent deadlocks. Bug: 13747880 Change-Id: I45fd3fff917da98b22970e5351a9e25b143a4eed
* Merge "Profile: made startImmediately settable"Calin Juravle2014-04-081-4/+5
|\
| * Profile: made startImmediately settableCalin Juravle2014-04-071-4/+5
| | | | | | | | | | | | | | | | By default the profiler starts immediately upon app startup. To delay the startup by some random offset use -Xprofile-start_lazy. Bug: 12877748 Change-Id: Ifc1bb7f79f9f9aa53204b2fb1fbae3cd5c780cac
* | Make frame size dependent on arch-specific constants.Andreas Gampe2014-04-031-5/+5
| | | | | | | | | | | | Necessary for proper cross-compiling. Change-Id: I852901ee6ca5121e480b83a8e318bdc9c7d615e8
* | Merge "Runtime::PreZygoteFork returns void, not boolean."Narayan Kamath2014-04-031-2/+1
|\ \ | |/ |/|
| * Runtime::PreZygoteFork returns void, not boolean.Narayan Kamath2014-04-021-2/+1
| | | | | | | | | | | | | | This method aborts on failure (as it should) and unconditionally returns true, so making it return void simplifies callers. Change-Id: Iae39bd327f20311579ece47efa8afd1be7defce9
* | Add support for -Xverify:none mode.Jeff Hao2014-04-021-1/+3
| | | | | | | | | | | | | | This mode skips all verification and compilation. Public bug: https://code.google.com/p/android/issues/detail?id=67664 Change-Id: Idd00ab8e9e46d129c02988b063c41a507e07bf5b
* | Pass instruction-set from runtime through to spawned dex2oat.Ian Rogers2014-04-021-0/+55
|/ | | | Change-Id: I1727af7beb9f710c29124d4d6bc9175e4856f3cc
* Merge "Move most zygote related code to frameworks/base."Narayan Kamath2014-04-021-1/+1
|\
| * Move most zygote related code to frameworks/base.Narayan Kamath2014-04-011-1/+1
| | | | | | | | | | | | | | | | Avoids code duplication across art/dalvik. Also, most of this code is not directly related to the runtime (mounting external storage, multi user etc.) and therefore belongs in the frameworks. Change-Id: Icf4723dd0ec4521ef6b1f785c99d50aebca7779a
* | Merge "Cleanup transaction support"Sebastien Hertz2014-04-021-18/+13
|\ \
| * | Cleanup transaction supportSebastien Hertz2014-04-021-18/+13
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Updates Thread::CreateInternalStackTrace to support both transactional and non-transactional modes using template. Generalizes non-transactional mode for invariant fields (which are set only once). Removes ArrayLog::VisitRoots as we never create Array logs of ObjectArray. As ObjectArray elements are set using Object::SetFieldObject, they are already recorded in the object logs: the object is the array itself and the offset corresponds to the element index in this array. And also checks we never log ObjectArray in array logs. Fixes location of thrown exception when calling native method during class initialization. Change-Id: Idbc368d3b8292b85ff40bc8a7c559e085477bf89
* | Merge "Fix running with DlMalloc instead of RosAlloc."Mathieu Chartier2014-04-011-0/+2
|\ \
| * | Fix running with DlMalloc instead of RosAlloc.Mathieu Chartier2014-04-011-0/+2
| | | | | | | | | | | | | | | | | | | | | Bug: 13748830 Bug: 13744490 Change-Id: Ieec97cf58ebf9864a40ee85aae582cdcf3f27c0c
* | | Add handler for printing java stack traces for compiled code SIGSEGV.Mathieu Chartier2014-04-011-4/+8
|/ / | | | | | | | | | | | | | | | | | | | | Added a new FaultHandler which attempts to print a java stack trace when a SIGSEGV occurse in generated code. This should help debugging compiler and GC related heap corruption. Bug: 13725693 Bug: 12934910 Change-Id: Id54d83ea180c222eb86d449c61926e83f0b026ad
* | Allow mixing of thread offsets between 32 and 64bit architectures.Ian Rogers2014-04-011-1/+1
|/ | | | | | | Begin a more full implementation x86-64 REX prefixes. Doesn't implement 64bit thread offset support for the JNI compiler. Change-Id: If9af2f08a1833c21ddb4b4077f9b03add1a05147
* Add missing debugger root visiting.Mathieu Chartier2014-03-251-1/+3
| | | | | Bug: 13634574 Change-Id: I2a76f6c43f1d0ad1922f06deb40a71ff651129fd
* 64bit: make runtime offsets more deterministic.Ian Rogers2014-03-201-5/+5
| | | | | | | STL implementations vary causing offsets not to be consistent. Place member variables we care about the offsets of at the start of Runtime. Change-Id: I3ad7fe606cb99bcdd884a8fdbdd06bd7e047cd84
* AArch64: Add arm64 runtime support.Stuart Monteith2014-03-191-0/+41
| | | | | | | | | Adds support for arm64 to ART. Assembler stubs are sufficient for down calls into interpreter. JNI compiler and generics are not finished. Basic Generic JNI functionality. Change-Id: I4a07c79d1e037b9f5746673480e32cf456867b82
* Refactor reflective method invocation.Ian Rogers2014-03-141-4/+2
| | | | | | | | | | Move invocation code out of JNI internal into reflection, including ArgArray code. Make reflective invocation use the ArgArray to build arguments rather than allocating a jvalue[] and unboxing arguments into that. Move reflection part of jni_internal_test into reflection_test. Make greater use of fast JNI. Change-Id: Ib381372df5f9a83679e30e7275de24fa0e6b1057
* Implicit null/suspend checks (oat version bump)Dave Allison2014-03-131-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the ability to use SEGV signals to throw NullPointerException exceptions from Java code rather than having the compiler generate explicit comparisons and branches. It does this by using sigaction to trap SIGSEGV and when triggered makes sure it's in compiled code and if so, sets the return address to the entry point to throw the exception. It also uses this signal mechanism to determine whether to check for thread suspension. Instead of the compiler generating calls to a function to check for threads being suspended, the compiler will now load indirect via an address in the TLS area. To trigger a suspend, the contents of this address are changed from something valid to 0. A SIGSEGV will occur and the handler will check for a valid instruction pattern before invoking the thread suspension check code. If a user program taps SIGSEGV it will prevent our signal handler working. This will cause a failure in the runtime. There are two signal handlers at present. You can control them individually using the flags -implicit-checks: on the runtime command line. This takes a string parameter, a comma separated set of strings. Each can be one of: none switch off null null pointer checks suspend suspend checks all all checks So to switch only suspend checks on, pass: -implicit-checks:suspend There is also -explicit-checks to provide the reverse once we change the default. For dalvikvm, pass --runtime-arg -implicit-checks:foo,bar The default is -implicit-checks:none There is also a property 'dalvik.vm.implicit_checks' whose value is the same string as the command option. The default is 'none'. For example to switch on null checks using the option: setprop dalvik.vm.implicit_checks null It only works for ARM right now. Bumps OAT version number due to change to Thread offsets. Bug: 13121132 Change-Id: If743849138162f3c7c44a523247e413785677370
* Make use of profiling information for dex2oatDave Allison2014-03-071-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the profile file exists, the compiler driver will read it and store the data in an internal map. Then, when we want to work out whether to compile a method or not, the map is consulted and if the method shows up with a high enough percentage of use we compile it. The profile file itself is created by installd and is writeable by the app. The file is in /data/dalvik-cache/profiles and is named by the package name. This also modifies the profiler itself to: 1. Only count runnable threads (not suspended threads) in the profile 2. Use system properties to allow tuning of the profile parameters 3. Merge profiles from multiple processes using file locking. Bug: 12877748 Change-Id: Iab2f3a327a2860db2a80d5724277d6c626227f2b Conflicts: compiler/dex/frontend.cc compiler/dex/mir_analysis.cc compiler/dex/verification_results.cc compiler/driver/compiler_driver.cc dex2oat/dex2oat.cc runtime/class_linker.cc runtime/runtime.cc runtime/runtime.h
* Enable annotalysis on clang ART builds.Ian Rogers2014-03-061-4/+4
| | | | | | | | | | | Fix clang build errors aswell as restructure locking/mutex code for correct thread safety analysis support. Reorder make dependencies so that host builds build first as they should provide better compilation errors than target. Remove host's use of -fno-omit-frame-pointer as it has no value with correct use of CFI, which we should have. Change-Id: I72cea8da9a3757b1a0b3acb4081feccb7c6cef90
* Support compiler filters for boot classpathBrian Carlstrom2014-03-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | image_writer.cc Remove assumption that all methods in the boot classpath are compiled oat_writer.cc Don't skip writing ArtMethod::quick_code_offset_ for methods that need resolution, leave that to ImageWriter dex2oat.cc Allow dex2dex compilation of image dex files by making the in memory pages writable in all cases, not just app case. oatdump.cc dump new OatHeader fields use ImageSpace.GetImageFilename, not command line image filename, since location may be in dalvik-cache remove inaccurate check about non-null GC map quick_trampoline_entrypoints.cc add and improve some DCHECKS that were useful while debugging class_linker.cc image_space.cc fix double facepalm parsed_options.cc fix zygote logging to not skip values to two part options like -classpath <foo> runtime.cc wireup parsed compiler options to runtime Change-Id: Iad314df0b80623c0663d61713d5098297ab9ac87
* Avoid marking old class linker and intern table roots during pause.Mathieu Chartier2014-03-041-15/+20
| | | | | | | | | | | | | | | | | | | | The new root visiting logic has a concept of a root log which holds new roots which were added since the start of the GC. This is an optimization since it lets us only mark these newly added roots during the pause (or pre-cleaning) since the other roots intern table and class linker roots were marked concurrently at the start of the GC. Before (EvaluateAndApplyChanges): MarkConcurrentRoots: Sum: 605.193ms After: MarkConcurrentRoots: Sum: 271.858ms This should also reduce pathological GC pauses which used to be able to happen when the intern table or class linker became "dirty" during the concurrent GC. Change-Id: I433fab021f2c339d50c35aaae7161a50a0901dec
* Remove oat file location in the image.Nicolas Geoffray2014-03-041-3/+0
| | | | | | | | | The oat file is now always in the same directory, and has the same name as the image file. Only difference is the extension. This also removes the need for host-prefix. Change-Id: I16d1f7aeb1d58372d41921694664e9c321afc1ad
* Add ART -help and -showversionBrian Carlstrom2014-03-031-496/+22
| | | | | Bug: https://code.google.com/p/android/issues/detail?id=62149 Change-Id: I5c21c0433f5f341f94e7d977e8d2d69cc46d6fe3
* Add custom SIGSEGV handler to help find heap corruption.Mathieu Chartier2014-02-281-0/+7
| | | | | | | | | | | | | | | | The new signal handler prints heap diagnostics when you get a SIGSEGV. Added a fault message member in runtime which is modifiable by Runtime::SetFaultMessage. When you get a SIGSEGV it will print out whatever is stored in this string as well as the normal information. This is useful for debugging heap corruption since it lets you see which threads were in which methods when the last GC occured. Added some smarter object dumping logic when the faulting address is in the heap. Bug: 12934910 Change-Id: Ia72be2c39f70ad711cbd746d66fad2b617d5d29f
* Create CompilerOptionsBrian Carlstrom2014-02-241-45/+16
| | | | | | | | | | | | | | | | | | Package up most compiler related options in CompilerOptions. Details include: - Includes compiler filter, method thresholds, SEA IR mode. - Excludes those needed during Runtime::Init such as CompilerCallbacks and VerificationResults. - Pass CompilerOptions to CompilerDriver. - Remove CompilerOptions from Runtime. - Add ability to pass options for app and image dex2oat to runtime via -Xcompiler-option and -Ximage-compiler-option respectively. Other - Replace 2x CompilerCallbacks implementations with one. - Factor out execv code for use by both image and oat generation. - More OatFile error_msg reporting. - DCHECK for SuspendAll found trying to run valgrind. Change-Id: Iecb57da907be0c856d00c3cd634b5042a229e620
* Upcall support for x86-64.Ian Rogers2014-02-201-2/+8
| | | | | | Sufficient to pass jni_internal_test. Change-Id: Ia0d9b8241ab8450e04765b9c32eb6dc8fc1a8733
* Change root visitor to use Object**.Mathieu Chartier2014-02-181-10/+7
| | | | | | | Simplifies code and improves the performance of root visiting since we usually don't need to check to see if the object moved. Change-Id: Iba998f5a15ae1fa1b53ca5226dd2168a411196cf
* Remove blacklistSebastien Hertz2014-02-171-3/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removes the class initialization blacklist and use transaction to detect and revert class initialization attempting to invoke native method. This only concerns class initialization happening at compilation time when generating an image (like boot.art for the system). In transactional mode, we log every object's field assignment and array update. Therefore we're able to abort a transaction to restore values of fields and array as they were before the transaction starts. We also log changes to the intern string table so we can restore its state prior to transaction start. Since transactional mode only happens at compilation time, we don't need to log all these changes at runtime. In order to reduce the overhead of testing if transactional mode is on/off, we templatize interfaces of mirror::Object and mirror::Array, respectively responsible for setting a field and setting an array element. For various reasons, we skip some specific fields from transaction: - Object's class and array's length must remain unchanged so garbage collector can compute object's size. - Immutable fields only set during class loading: list of fields, method, dex caches, vtables, ... as all classes have been loaded and verified before a transaction occurs. - Object's monitor for performance reason. Before generating the image, we browse the heap to collect objects that need to be written into it. Since the heap may still holds references to unreachable objects due to aborted transactions, we trigger one collection at the end of the class preinitialization phase. Since the transaction is held by the runtime and all compilation threads share the same runtime, we need to ensure only one compilation thread has exclusive access to the runtime. To workaround this issue, we force class initialization phase to run with only one thread. Note this is only done when generating image so application compilation is not impacted. This issue will be addressed in a separate CL. Bug: 9676614 Change-Id: I221910a9183a5ba6c2b99a277f5a5a68bc69b5f9
* Revert "Revert "Revert "Add a script for running art standalone."""Ian Rogers2014-02-141-7/+1
| | | | | | This reverts commit 4b23250f4cbf3047924c646c1a0c078394f8362d. Change-Id: Ib749a8267abf35e51552b741ba749d6ed6975f95
* Revert "Revert "Add a script for running art standalone.""Nicolas Geoffray2014-02-131-1/+7
| | | | | | This reverts commit 41dcb9f856a2051527cd595f8fe7d200066acba4. Change-Id: Ide6fa696c6fb43fe17e0993e8c9d1b588c99b1f3
* Revert "Add a script for running art standalone."Brian Carlstrom2014-02-121-7/+1
| | | | This reverts commit 1f5a90f28443886ebefcfbd531b8e41ece298cca.
* Merge "Add a script for running art standalone."Nicolas Geoffray2014-02-121-1/+7
|\
| * Add a script for running art standalone.Nicolas Geoffray2014-02-121-1/+7
| | | | | | | | Change-Id: I0c48856d811c40662a6e4a4782478a0bc8e0f697
* | Merge "Work in the direction of hard float quick ABIs."Ian Rogers2014-02-121-6/+5
|\ \
| * | Work in the direction of hard float quick ABIs.Ian Rogers2014-02-111-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pass a shorty to ArtMethod::Invoke so that register setup can use it. Document x86-64 ABI. Add extra debug output for one JNI native method registration fails, namely a dump of the Class and its dex file's location. Add hack to get testing of OatMethod's without GC maps working in 64bit. Change-Id: Ic06b68e18eac33637df2caf5e7e775ff95ae70f3
* | | Add root types and thread id to root visiting.Mathieu Chartier2014-02-111-32/+35
|/ / | | | | | | | | | | | | Enables us to pass the root type and thread id to hprof. Bug: 12680863 Change-Id: I6a0f1f9e3aa8f9b4033d695818ae7ca3460d67cb
* | Make debugger / jdwp compaction safe.Mathieu Chartier2014-02-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Fixed GetInstances, GetReferringObjects, CountInstances to use VisitObjects instead of the live bitmap. We now treat the object registry as system weaks and update the objects when/if they move. Also added the recent_allocation_records_ as roots. Bug: 12936165 Change-Id: I615c289efbf2977ceab5c4ffa73d216d799e6e33
* | RosAlloc verification.Hiroshi Yamauchi2014-02-071-2/+14
|/ | | | | | | | | | | If enabled, RosAlloc verification checks the allocator internal metadata and invariants to detect bugs, heap corruptions, and race conditions. Added runtime options for enabling and disabling it. Enable it for the debug build. Bug: 9986565 Bug: 12592026 Change-Id: I923742b87805ae839f1549d78d0d492733da6a58
* Object model changes to support 64bit.Ian Rogers2014-02-061-35/+80
| | | | | | | | | | | | | | | | | | | | | | | Modify mirror objects so that references between them use an ObjectReference value type rather than an Object* so that functionality to compress larger references can be captured in the ObjectRefererence implementation. ObjectReferences are 32bit and all other aspects of object layout remain as they are currently. Expand fields in objects holding pointers so they can hold 64bit pointers. Its expected the size of these will come down by improving where we hold compiler meta-data. Stub out x86_64 architecture specific runtime implementation. Modify OutputStream so that reads and writes are of unsigned quantities. Make the use of portable or quick code more explicit. Templatize AtomicInteger to support more than just int32_t as a type. Add missing, and fix issues relating to, missing annotalysis information on the mutator lock. Refactor and share implementations for array copy between System and uses elsewhere in the runtime. Fix numerous 64bit build issues. Change-Id: I1a5694c251a42c9eff71084dfdd4b51fff716822
* Add missing SIRT to LoadNativeLibrary.Mathieu Chartier2014-02-061-1/+2
| | | | | | | When we transition to kWaitingForJniOnLoad, we are suspended and a GC can occur. This caused issues since classloaders are movable. Change-Id: Iae59019c22ac64322a82300107d06a4323ee602b
* Fix GC options to make the setting availablelzang12014-01-291-40/+41
| | | | | | | | | | | The concurrent gc thread number and parallel gc thread number is configurable by the options, This patch fix the bug that making the options value valid. This patch also fix that GC log threshold settings as MillionSecond. Change-Id: I737838ef4af44396c23a538cd8a33581d9ae5e4d Author: Lin Zang <lin.zang@intel.com> Signed-off-by: Jack Ren <jack.ren@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
* Use direct class pointers at allocation sites in the compiled code.Hiroshi Yamauchi2014-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | - Rather than looking up a class from its type ID (and checking if it's resolved/initialized, resolving/initializing if not), use direct class pointers, if possible (boot-code-to-boot-class pointers and app-code-to-boot-class pointers.) - This results in a 1-2% speedup in Ritz MemAllocTest on Nexus 4. - Embedding the object size (along with class pointers) caused a 1-2% slowdown in MemAllocTest and isn't implemented in this change. - TODO: do the same for array allocations. - TODO: when/if an application gets its own image, implement app-code-to-app-class pointers. - Fix a -XX:gc bug. cf. https://android-review.googlesource.com/79460/ - Add /tmp/android-data/dalvik-cache to the list of locations to remove oat files in clean-oat-host. cf. https://android-review.googlesource.com/79550 - Add back a dropped UNLIKELY in FindMethodFromCode(). cf. https://android-review.googlesource.com/74205 Bug: 9986565 Change-Id: I590b96bd21f7a7472f88e36752e675547559a5b1
* Fix heap verification and add runtime options.Mathieu Chartier2014-01-171-23/+36
| | | | | | | | | | | | Post GC heap verification is now enabled by default for debug builds. Added four Xgc runtime options: preverify, nopreverify, postverify, nopostverify. Fixed another bug where the non-moving space could theoretically end up outside of the card table address range. Bug: 10672951 Change-Id: I5ba3cd96dbfb900263dba795242df74c563deaa3
* Revert accidental default collector type change.Mathieu Chartier2014-01-141-2/+1
| | | | | | | Default collector type had been changed to generational semi-space by default by accident. Change-Id: I060b3f292261b8bb258ca2a350e26a328340c49c