summaryrefslogtreecommitdiffstats
path: root/runtime/mem_map_test.cc
Commit message (Collapse)AuthorAgeFilesLines
* Add support for .bss section in oat files.Vladimir Marko2015-03-021-41/+80
| | | | Change-Id: I779b80b8139d9afdc28373f8c68edff5df7726ce
* Change MemMap::maps_ to not be global variableMathieu Chartier2014-10-141-1/+13
| | | | | | | | Runtime.exit() was causing globals to get destructed at the same time that another thread was using it for allocating a new mem map. Bug: 17962201 Change-Id: I400cb7b8141d858f3c08a6fe59a02838c04c6962
* stdint types all the way!Ian Rogers2014-10-091-11/+11
| | | | Change-Id: I4e4ef3a2002fc59ebd9097087f150eaf3f2a7e08
* ART: Fix things for valgrindAndreas Gampe2014-09-101-11/+16
| | | | | | | | | | | | | | | | | | | | | | Wire up valgrind gtests. Add valgrind-test-art-host, currently only depending on valgrind-test-art-host-gtest32. Fix an Alloc setting to allow running valgrind. Refactor the fault handler to manage (and correctly release) the handlers. Fix minor failure-case leaks exposed by tests. Failing tests: The optimizing compiler is leaking non-arena-ed structures (e.g., assembler buffers), as code generators are not destroyed. The solution has been moved to a follow-up CL. Note: All 64b tests are failing as we cannot allocate a heap. Change-Id: I7f854cfd098d9f68107ce492363e7dba9a82b9fa
* Fix mem_map_test for Mips.Douglas Leung2014-06-111-2/+3
| | | | | | | Mips' kuseg window is from 0x0 to 0x80000000. Change-Id: I3e90b04030672c003cdb4f7e9cda414b673b2d04 Signed-off-by: Douglas Leung <douglas@mips.com>
* Verify there's no mem map gap for immune region not to break.Hiroshi Yamauchi2014-06-041-0/+61
| | | | | | | | | | | This adds code that verifies that there's no memory map gap between the image space and the main space so that the immune region functionality won't silently break. For example, if there's a gap and a large object is allocated in that gap, the large object is incorrectly part of the immune region and the marking breaks. Bug: 14059466 Change-Id: Ie6ed82988d74b6d0562ebbbaac96ee43c15b14a6
* ART: Randomize mem_map start address for linear scan searchAndreas Gampe2014-05-201-0/+33
| | | | | | | When using linear scan for mem_map, randomize the start of the search with getauxval(AT_RANDOM). Change-Id: Id1e4c86b928147d74b9b0b73ff704de5d87b4500
* Now we have a proper C++ library, use std::unique_ptr.Ian Rogers2014-05-191-10/+11
| | | | | | | Also remove the Android.libcxx.mk and other bits of stlport compatibility mechanics. Change-Id: Icdf7188ba3c79cdf5617672c1cfd0a68ae596a61
* Compatibility layer to transition from UniquePtr to std::unique_ptr.Ian Rogers2014-05-151-1/+1
| | | | | | | | | Use ART_WITH_STLPORT (enabled for the target) to cause the use of UniquePtr, for the host switch to std::unique_ptr. For now the type remains called UniquePtr. Make dalvik compile with clang on the host, move its build to C++11. Change-Id: I5ba8d2757904bc089ed62047ea03de3c0853fb12
* ART: Resolve MAP_32BIT limitation in x86_64Qiming Shi2014-05-141-0/+53
| | | | | | | | | | | | | Add checks that ensure when low4gb is set and an expected pointer is given the requested memory fits into 4GB. On x86_64, only use MAP_32BIT when there is no expected pointer. This avoids a limitation in mmap (only 2GB visible). Add tests to check behavior. Original Author: Qiming Shi <qiming.shi@intel.com> Change-Id: Ia2e3e0a46764ef70126b0c264f1fae681622d3cb
* Make MemMap::MapAnonymous() fail if the requested address is not available.Hiroshi Yamauchi2014-03-141-0/+33
| | | | | | | | | | | | | | | | | | Change MapAnonymous() so that a requested address vs. actual map address mismatch will cause a failure. The existing MapAnonymous() call sites do not check this. This should prevent potential rare case bugs where mmap does not happen to map a region at an specified address. There's a potential bug that if MapAnonymous() does not guarantee the requested address (and there's a gap between the image/oat files and the zygote/malloc space), then GC could in theory allocate a large object space in the gap. This would break the GC notion of the immune space. This change will prevent this by causing all non-moving spaces to be (really) adjacent, with no gaps in between, which CL 87711 missed. Change-Id: Id4adb0e30adbad497334d7e00def4c0c66b15719
* Object model changes to support 64bit.Ian Rogers2014-02-061-54/+89
| | | | | | | | | | | | | | | | | | | | | | | 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
* Fix a double unmap issue in MemMap::UnMapAtEnd().Hiroshi Yamauchi2013-10-251-1/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MemMap::UnMapAtEnd() unmaps the unused tail of the alloc space during a zygote fork. But it can cause the same tail region of the memory to be unmapped twice (once in UnMapAtEnd() and once more in ~MemMap() during a shutdown.) I encountered a crash because of this issue in SpaceTest.ZygoteTest (which happens to happen only on a device in a branch with the rosalloc change probably due to some randomness in mmap address choice, etc.) Here's what happens: 1) CreateZygoteSpace() will call UnMapAtEnd() and unmap the unused tail of the alloc space. 2) In the same function, after UnMapAtEnd(), several libc new/malloc allocations, including a new DlMallocSpace object, happen. This happens to cause libc to map a new memory region that overlaps with the memory region that has just been unmapped in 1) and use it to allocate those allocations (that is, the new DlMallocSpace object is allocated in that memory region.) This is a second DlMallocSpace that becomes the new alloc space after zygote fork. The first DlMallocSpace becomes the zygote space. Note that that libc maps that memory region before the underlying memory of the second DlMallocSpace is mapped. 3) During a Runtime shutdown (which happens once for a normal VM shutdown or at the end of each test run) all the spaces get destructed including the the two DlMallocSpaces one by one. When the first DlMallocSpace gets destructed (note the space list is sorted by address,) its super destructor ~MemMap() unmaps the original memory region that's already partially unmapped in 2). Now this memory region includes the libc memory region that includes the second DlMallocSpace object. 4) When the second DlMallocSpace object gets attempted to be destructed, the memory in which the object resides is already unmapped in 3) and causes a SIGSEGV. This change replaces UnMapAtEnd() with a new function RemapAtEnd() which combines the unmapping of the tail region and remapping of it to achieve the following two things: 1) Fixes this double unmap issue by updating the base_size_ member variable to exclude the already-unmapped tail region so that ~MemMap() will not unmap the tail region again. 2) Improves on the non-atomicity issue in the unmap/map sequence in CreateZygoteSpace(). That is, once the unused tail portion of the memory region of the origina alloc space is unmapped, something like libc could come along and take that memory region, before the memory region is mapped again for the new alloc space. This, as a result, would make a hole between the old alloc (new zygote) space and the new alloc space and cause the two spaces to be non-contiguous. RemapAtEnd() eliminates new/malloc allocations between the unmap and the map calls. But note this still isn't perfect as other threads could in theory take the memory region between the munmap and the mmap calls. Added tests. Change-Id: I43bc3a33a2cbfc7a092890312e34aa5285384589
* Throw IOException at source of failing to open a dex file.Ian Rogers2013-10-211-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Allow MemMap to support empty map requestsBrian Carlstrom2013-07-291-0/+34
Discovered trying to use ZipEntry::ExtractToMemMap on an empty preloaded-classes. Bug: 8659045 Change-Id: Icfbbe6b313e2d1ee708b44a8d8d354d6203fd669