summaryrefslogtreecommitdiffstats
path: root/runtime/transaction.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix missing transaction abort error messageSebastien Hertz2015-04-291-1/+1
| | | | Change-Id: I5157def06d385c082f9fdd4714e20bead9e707e8
* Refactor and improve GC root handlingMathieu Chartier2015-04-061-6/+6
| | | | | | | | | | | | | | | | | | | | | | Changed GcRoot to use compressed references. Changed root visiting to use virtual functions instead of function pointers. Changed root visting interface to be an array of roots instead of a single root at a time. Added buffered root marking helper to avoid dispatch overhead. Root marking seems a bit faster on EvaluateAndApplyChanges due to batch marking. Pause times unaffected. Mips64 is untested but might work, maybe. Before: MarkConcurrentRoots: Sum: 67.678ms 99% C.I. 2us-664.999us Avg: 161.138us Max: 671us After: MarkConcurrentRoots: Sum: 54.806ms 99% C.I. 2us-499.986us Avg: 136.333us Max: 602us Bug: 19264997 Change-Id: I0a71ebb5928f205b9b3f7945b25db6489d5657ca
* Use specific exception class to abort transactionSebastien Hertz2015-04-031-1/+4
| | | | | | | | | | | | | | | We used to throw a java.lang.InternalError when aborting a transaction (when preinitializing image classes at compilation time). We now use dedicated class dalvik.system.TransactionAbortError that is only thrown by the compiler to abort a transaction. This class has constructors taking a java.lang.Throwable "cause" so we can wrap exceptions causing the transaction to abort (for instance class java.lang.ClassNotFoundException) and give more information about the cause of the transaction abort. Bug: 20019689 Change-Id: I019a72a1c754d8bba6a7ad6bb0f02e4fd6668622
* Follow-up 128393Sebastien Hertz2015-03-031-1/+1
| | | | | | | | | | | | Avoids false warning when initializing the exception's class by marking the transaction aborted after throwing the InternalError exception. Also uses VLOG(compiler) to print the warning since it's only useful when investigating ahead-of-time class initialization. Bug: 19202032 Change-Id: I3c53639cbb888086ad345d668d1e5b73c5aaf861
* Fix transaction abortingSebastien Hertz2015-02-051-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During compilation, a java.lang.InternalError is used to indicate that class initialization failed and the enclosing transaction should be aborted and the changes rolled back. However there is nothing preventing the code executed from a class initializer from catching that exception (like catching Throwable and ignore it). Therefore we may return from the class initializer with no pending exception, even if the transaction was aborted, and not rollback the changes properly. To fix this, we now rely on the new Transaction::aborted_ field to know whether a transaction aborted. When returning from the class initializer without pending exception, we now check wether we aborted the enclosing transaction. If that's the case, we set the status of the class to kStatusError and throw a new java.lang.InternalError with the original abort message. This CL also contains some cleanup: - Renames Transaction::Abort to Transaction::Rollback which is less ambiguous and more reflect what is done. - Moves the code throwing the java.lang.InternalError exception into the Transaction::ThrowInternalError method so we do not duplicate code. Now we may abort transaction more than once (because we may have caught the java.lang.InternalError then execute code causing new transaction abort), we only keep the first abort message to throw the exception. - Updates transaction_test with more cases and more checks. - Bumps oat version to force recompilation with this fix. Bug: 19202032 Change-Id: Iedc6969528a68bbdf3123146e990df4dbc57834b
* Print more info in MarkSweep::VerifyRootMathieu Chartier2015-01-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Refactored old root callback to use a new class called RootInfo. RootInfo contains all the relevant info related to the root associated with the callback. The MarkSweep::VerifyRoot function now uses this info to print the StackVisitor's described location if the GC root is of the type kRootJavaFrame. Some other cleanup. Example output: E/art (12167): Tried to mark 0x123 not contained by any spaces E/art (12167): Attempting see if it's a bad root E/art (12167): Found invalid root: 0x123 with type RootJavaFrame E/art (12167): Location=Visiting method 'void java.lang.Runtime.gc()' at dex PC 0xffffffff (native PC 0x0) vreg=0 (cherry picked from commit 12f7423a2bb4bfab76700d84eb6d4338d211983a) Bug: 18588862 Change-Id: Ic5a2781f704e931265ffb3621c2eab4b2e25f60f
* Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.Ian Rogers2014-11-031-8/+9
| | | | | | | | | | | Fix associated errors about unused paramenters and implict sign conversions. For sign conversion this was largely in the area of enums, so add ostream operators for the effected enums and fix tools/generate-operator-out.py. Tidy arena allocation code and arena allocated data types, rather than fixing new and delete operators. Remove dead code. Change-Id: I5b433e722d2f75baacfacae4d32aef4a828bfe1b
* Change intern table to unordered set.Mathieu Chartier2014-09-021-7/+6
| | | | | | | | | | | Intern table active used bytes goes from 430k to 317k on system server. Similar %wise savings on other apps. Bug: 16238192 (cherry picked from commit d910fcef539e12ab181e56ec80684f39c4e95733) Change-Id: Ic70395124435c6f420a77e6d8639404a160f395a
* Reduced memory usage of primitive fields smaller than 4-bytesFred Shih2014-08-251-0/+21
| | | | | | | | | | Reduced memory used by byte and boolean fields from 4 bytes down to a single byte and shorts and chars down to two bytes. Fields are now arranged as Reference followed by decreasing component sizes, with fields shuffled forward as needed. Bug: 8135266 Change-Id: I65eaf31ed27e5bd5ba0c7d4606454b720b074752
* Add read barriers to the weak roots in the intern table.Hiroshi Yamauchi2014-05-281-2/+5
| | | | | Bug: 12687968 Change-Id: I424f1df76a7e3d7154fb9f3c951c973d19bd640f
* Cleanup transaction supportSebastien Hertz2014-04-021-1/+1
| | | | | | | | | | | | | | | | | | | 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
* Enable annotalysis on clang ART builds.Ian Rogers2014-03-061-2/+1
| | | | | | | | | | | 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
* Remove blacklistSebastien Hertz2014-02-171-0/+195
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