summaryrefslogtreecommitdiffstats
path: root/runtime/utils.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Fixed and refactored profiler options handlingCalin Juravle2014-06-061-4/+0
| | | | | | | | | | | | | - extracted profiler options in a separate class - switched from system property reading to command line arguments - added profile based compilation options to CompilerOptions - removed no longer used kProfile compilation filter - optimize dex files only if the profiler is enabled - clean up unused arguments Bug: 12877748 Bug: 15275634 Change-Id: I37ff68e7694370950ce8db2360562e9058ecebb7
* Clean up the sampling profilerCalin Juravle2014-06-061-0/+8
| | | | | | | | | | | | - rename variables/fields names to match the code style (use _underscore_names_) - extract common property parsing in utils.cc - fail to load profile file if any line is malformed - added ProfileFile to manage the profile data generate in the previous runs (replaces ProfileHelper and nests ProfileData) Bug: 12877748 Change-Id: Ie7bda30bfdeb7e78534c986615b0649eac12a97b
* Follow up to "Add ISA directory to image and odex pathnames."Brian Carlstrom2014-05-191-2/+2
| | | | Change-Id: I7f08cc3052fbed93a56ccf1ab7675ae8bc129da9
* Add ISA directory to image and odex pathnames.Brian Carlstrom2014-05-161-0/+8
| | | | | | Bug: 14882223 Bug: 14694978 Change-Id: Ic1b5ae836b8e91ea461dcd4f3da8e38dc3bec00f
* Replace CountOneBits and __builtin_popcount with POPCOUNT.Vladimir Marko2014-05-021-34/+33
| | | | | | Clean up utils.h, make some functions constexpr. Change-Id: I2399100280cbce81c3c4f5765f0680c1ddcb5883
* Use instruction specific dalvik cache dirs.Narayan Kamath2014-05-011-5/+8
| | | | | | | | | | | | - All oat & art files are now placed under /data/dalvik-cache/<isa>/. - GetDalvikCacheOrDie now requires a mandatory subdirectory argument, and is implicitly rooted under /data/. - Added helper methods to convert InstructionSet enums into strings and vice versa. (cherry picked from commit 2974bc3d8a5d161d449dd66826d668d87bdc3cbe) Change-Id: Ic7986938e6a7091a2af675ebafec768f7b5fb8cd
* Modify unwind to comply with stack parser tools.Christopher Ferris2014-04-181-1/+1
| | | | | | Bug: 14081592 Change-Id: I6906b2575c74d64f1c3ba7602779b3a789de1c69
* Centralize instruction-set pointer-size, alignment, 64b-width codeAndreas Gampe2014-04-141-0/+8
| | | | | | | | | in instruction_set.h/cc This allows to clean up some places that currently make explicit comparisons. Change-Id: I0dcc924c52fa53306f706aceea93a2d4a655c5df
* backtrace: use Java stack to help decode nativeKenny Root2014-03-061-1/+3
| | | | | | | | | | | | | | | | | | | | Before change: native: usb_host_run+16 [0x400a43f9] (/libusbhost.so) native: android::Vector<int>::do_move_forward(void*, void const*, unsigned int) const+54 [0x501b1c5b] (/libandroid_servers.so) native: ??? [0x624de480] (/system@framework@boot.oat) at com.android.server.usb.UsbHostManager.monitorUsbHostBus(Native method) at com.android.server.usb.UsbHostManager.access$000(UsbHostManager.java:38) After change: native: usb_host_run+16 [0x400933f9] (libusbhost.so) native: android::Vector<int>::do_move_forward(void*, void const*, unsigned int) const+54 [0x4e984c5b] (libandroid_servers.so) native: Java_com_android_server_usb_UsbHostManager_monitorUsbHostBus__+92 [0x624de480] (system@framework@boot.oat) at com.android.server.usb.UsbHostManager.monitorUsbHostBus(Native method) at com.android.server.usb.UsbHostManager.access$000(UsbHostManager.java:38) Change-Id: Iea550a251a12e9ba7df9582fd454093bfa4e90e0
* Remove some stray stringpiece.h includesBrian Carlstrom2014-02-271-1/+0
| | | | | Bug: 13186058 Change-Id: I2cb313425864a5d4e988fcf71a99c60ad63c63fb
* Create CompilerOptionsBrian Carlstrom2014-02-241-0/+3
| | | | | | | | | | | | | | | | | | 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
* Object model changes to support 64bit.Ian Rogers2014-02-061-11/+33
| | | | | | | | | | | | | | | | | | | | | | | 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
* Background compaction support.Mathieu Chartier2014-01-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the process state changes to a state which does not perceives jank, we copy from the main free-list backed allocation space to the bump pointer space and enable the semispace allocator. When we transition back to foreground, we copy back to a free-list backed space. Create a seperate non-moving space which only holds non-movable objects. This enables us to quickly wipe the current alloc space (DlMalloc / RosAlloc) when we transition to background. Added multiple alloc space support to the sticky mark sweep GC. Added a -XX:BackgroundGC option which lets you specify which GC to use for background apps. Passing in -XX:BackgroundGC=SS makes the heap compact the heap for apps which do not perceive jank. Results: Simple background foreground test: 0. Reboot phone, unlock. 1. Open browser, click on home. 2. Open calculator, click on home. 3. Open calendar, click on home. 4. Open camera, click on home. 5. Open clock, click on home. 6. adb shell dumpsys meminfo PSS Normal ART: Sample 1: 88468 kB: Dalvik 3188 kB: Dalvik Other Sample 2: 81125 kB: Dalvik 3080 kB: Dalvik Other PSS Dalvik: Total PSS by category: Sample 1: 81033 kB: Dalvik 27787 kB: Dalvik Other Sample 2: 81901 kB: Dalvik 28869 kB: Dalvik Other PSS ART + Background Compaction: Sample 1: 71014 kB: Dalvik 1412 kB: Dalvik Other Sample 2: 73859 kB: Dalvik 1400 kB: Dalvik Other Dalvik other reduction can be explained by less deep allocation stacks / less live bitmaps / less dirty cards. TODO improvements: Recycle mem-maps which are unused in the current state. Not hardcode 64 MB capacity of non movable space (avoid returning linear alloc nightmares). Figure out ways to deal with low virtual address memory problems. Bug: 8981901 Change-Id: Ib235d03f45548ffc08a06b8ae57bf5bada49d6f3
* Compacting collector.Mathieu Chartier2013-11-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The compacting collector is currently similar to semispace. It works by copying objects back and forth between two bump pointer spaces. There are types of objects which are "non-movable" due to current runtime limitations. These are Classes, Methods, and Fields. Bump pointer spaces are a new type of continuous alloc space which have no lock in the allocation code path. When you allocate from these it uses atomic operations to increase an index. Traversing the objects in the bump pointer space relies on Object::SizeOf matching the allocated size exactly. Runtime changes: JNI::GetArrayElements returns copies objects if you attempt to get the backing data of a movable array. For GetArrayElementsCritical, we return direct backing storage for any types of arrays, but temporarily disable the GC until the critical region is completed. Added a new runtime call called VisitObjects, this is used in place of the old pattern which was flushing the allocation stack and walking the bitmaps. Changed image writer to be compaction safe and use object monitor word for forwarding addresses. Added a bunch of added SIRTs to ClassLinker, MethodLinker, etc.. TODO: Enable switching allocators, compacting on background, etc.. Bug: 8981901 Change-Id: I3c886fd322a6eef2b99388d19a765042ec26ab99
* Support hardware divide instructionDave Allison2013-11-051-3/+6
| | | | | | | | | | | | | | | | | | | | | Bug: 11299025 Uses sdiv for division and a combo of sdiv, mul and sub for modulus. Only does this on processors that are capable of the sdiv instruction, as determined by the build system. Also provides a command line arg --instruction-set-features= to allow cross compilation. Makefile adds the --instruction-set-features= arg to build-time dex2oat runs and defaults it to something obtained from the target architecture. Provides a GetInstructionSetFeatures() function on CompilerDriver that can be queried for various features. The only feature supported right now is hasDivideInstruction(). Also adds a few more instructions to the ARM disassembler b/11535253 is an addition to this CL to be done later. Change-Id: Ia8aaf801fd94bc71e476902749cf20f74eba9f68
* Fix a DCHECK failure due to unmatching numbers of cards scanned.Hiroshi Yamauchi2013-11-051-0/+13
| | | | | | | | | | | | | | | | - See the bug for details of the failure. - After a discussion, we decided to get rid of the DCHECK as a simple solution would not detect corner failure cases and a full solution would add undesired complexity, and left a comment that explains what situation had caused a DCHECK failure. - Fix a potential error of failing to scan the last card that the end of the image space falls on as a result of the image end being not necessarily aligned by the card size. - Remove dead/unused MarkSweep::ScanRoot(). - Add AlignUp and AlignDown for aligning pointers. Bug: 11465268 Change-Id: Iee3018a42c48a159feb0e9cf77b1a6b303f5d245
* Throw IOException at source of failing to open a dex file.Ian Rogers2013-10-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before is: java.lang.ClassNotFoundException: Didn't find class "GCBench" on path: DexPathList[[zip file "/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar"],nativeLibraryDirectories=[/disk2/dalvik-dev/out/host/linux-x86/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) Suppressed: java.lang.ClassNotFoundException: GCBench at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 1 more Caused by: java.lang.NoClassDefFoundError: Class "LGCBench;" not found ... 5 more And after is: java.lang.ClassNotFoundException: Didn't find class "GCBench" on path: DexPathList[[zip file "/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar"],nativeLibraryDirectories=[/disk2/dalvik-dev/out/host/linux-x86/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) Suppressed: java.io.IOException: Zip archive '/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar' doesn't contain classes.dex at dalvik.system.DexFile.openDexFile(Native Method) at dalvik.system.DexFile.<init>(DexFile.java:80) at dalvik.system.DexFile.<init>(DexFile.java:59) at dalvik.system.DexPathList.loadDexFile(DexPathList.java:268) at dalvik.system.DexPathList.makeDexElements(DexPathList.java:235) at dalvik.system.DexPathList.<init>(DexPathList.java:113) at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48) at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:38) at java.lang.ClassLoader.createSystemClassLoader(ClassLoader.java:128) at java.lang.ClassLoader.access$000(ClassLoader.java:65) at java.lang.ClassLoader$SystemClassLoader.<clinit>(ClassLoader.java:81) at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:137) Suppressed: java.lang.ClassNotFoundException: GCBench at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 1 more Caused by: java.lang.NoClassDefFoundError: Class "LGCBench;" not found ... 5 more Also, move dex file verifier messages out of logs. In the process the ClassLinker::dex_lock_ needed tidying to cover a smaller scope. Bug 11301553. Change-Id: I80058652e11e7ea63457cc01a0cb48afe1c15543
* am 7c798419: am 7c3d13ae: Use file magic to determine file type, not file ↵Brian Carlstrom2013-10-041-5/+4
|\ | | | | | | | | | | | | extension. * commit '7c79841982c3f3c2fd7fba0d338a52a27c50bc52': Use file magic to determine file type, not file extension.
| * Use file magic to determine file type, not file extension.Brian Carlstrom2013-10-031-5/+4
| | | | | | | | | | Bug: 10614658 Change-Id: I9156dfca78ac8cd1c62fb258825cc791629270a4
* | Remove some non-const references in utilsBrian Carlstrom2013-09-231-2/+2
|/ | | | Change-Id: Ib2d3c39fadb6a750c68c37b0aa53daab155a65a3
* Fix dumpsys meminfo for artAnwar Ghuloum2013-09-191-0/+1
| | | | | BUG:10112253 Change-Id: I2a34cc0841bdcf922c4ab4eadda360313858a0d6
* Fix non concurrent GC ergonomics.Mathieu Chartier2013-08-191-2/+2
| | | | | | | | | | If we dont have concurrent GC enabled, we need to force GC for alloc when we hit the maximum allowed footprint so that our heap doesn't keep growing until it hits the growth limit. Refactored a bit of stuff. Change-Id: I8eceac4ef01e969fd286ebde3a735a09d0a6dfc1
* Fix sampling profiler to use thread's cpu clock.Jeff Hao2013-08-151-3/+0
| | | | | | | The sampling profiler was using the sampling thread's cpu clock to measure cpu time, instead of the sampled thread's cpu clock. Change-Id: Ief1f82e07e0353192c61521f67dec7a761905f64
* Refactor java.lang.reflect implementationBrian Carlstrom2013-08-131-6/+6
| | | | | | | | | | | Cherry-picked from commit ed41d5c44299ec5d44b8514f6e17f802f48094d1. Move to ArtMethod/Field instead of AbstractMethod/Field and have java.lang.reflect APIs delegate to ArtMethod/ArtField. Bug: 10014286. Change-Id: Iafc1d8c5b62562c9af8fb9fd8c5e1d61270536e7
* GC data structures allocation trackingMathieu Chartier2013-07-251-0/+12
| | | | | | | | | | | | | Adds a new stl compatible allocator that is used in most GC data structures. When the data structures allocate and free memory, it lets the heap know of how much memory was allocated or freed. Using this info, we dump the approximated stl data structures memory usage when a sigquit occurs. The allocation tracking can be disabled with a compile time boolean flag to remove performance impact. Change-Id: Idddb6713169e07be913bceeb50f305c8573e4392
* Fix cpplint whitespace/parens issuesBrian Carlstrom2013-07-181-3/+3
| | | | Change-Id: Ifc678d59a8bed24ffddde5a0e543620b17b0aba9
* Fix multiple inclusion guards to match new pathnamesBrian Carlstrom2013-07-171-3/+3
| | | | Change-Id: Id7735be1d75bc315733b1773fba45c1deb8ace43
* Create separate Android.mk for main build targetsBrian Carlstrom2013-07-121-0/+375
The runtime, compiler, dex2oat, and oatdump now are in seperate trees to prevent dependency creep. They can now be individually built without rebuilding the rest of the art projects. dalvikvm and jdwpspy were already this way. Builds in the art directory should behave as before, building everything including tests. Change-Id: Ic6b1151e5ed0f823c3dd301afd2b13eb2d8feb81