summaryrefslogtreecommitdiff
path: root/src/compiler/driver/compiler_driver.cc
AgeCommit message (Collapse)Author
2013-07-12Create separate Android.mk for main build targets Brian Carlstrom
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
2013-07-11libart-compiler cleanup Brian Carlstrom
- Move compile-time code to src/compiler and libart-compiler OatWriter, ImageWriter, ElfWriter, ElfFixup, ElfStripper, stub generation - Move ClassReference and MethodReference to remove MethodVerifier dependency on CompilerDriver - Move runtime_support_llvm.cc out of src/compiler and next to runtime_support.cc - Change dex2oat and gtests to directly depend on libart-compiler - Move non-common definitions from Android.common.mk to more specific makefiles - Add LOCAL_ADDITIONAL_DEPENDENCIES on appropriate makefiles Change-Id: I897027e69945914128f21f317a92caf9255bc600
2013-07-10Update class_initializer_black_list for master Brian Carlstrom
Change-Id: Id8c69cc349290ba7d255ea214f8d1b51d3ce062a
2013-07-01Add StandardCharsets to the class_initializer_black_list Brian Carlstrom
Change-Id: Id13a58fc6da8a2c39f47bcee14a743c88fc899b7
2013-06-25Added support for SEA IR. Dragos Sbirlea
- Modified makefile to take the existance of SEA_IR_ART file to mean "switch to sea ir mode". - Switching SEA IR mode on leads to the new compiler being fed the fibonacci methods only, if they are used as input. - Added partial support for the control flow subgraph of the SEA IR (instruction nodes and region nodes for conditional and unconditional branches). Change-Id: I29020b8e2df5a00fde75715c3683cc25038589f4 Conflicts: src/compiler/driver/compiler_driver.cc
2013-06-24Quickening support. Sebastien Hertz
This CL adds quickening support for methods which are interpreted at runtime. This CL introduces a DEX-to-DEX compiler. A method is now compiled in one of the two following modes: - Native compilation: the method is compiled by the Quick or Portable backends. At runtime, the generated native target-dependent code is executed. - DEX-to-DEX compilation: the method is executed by the interpreter at runtime. Its DEX code is compiled so some instructions can be replaced by special instructions only valid at runtime. No native code is generated. The quickening adds special instructions to improve runtime performance. They are "-quick" versions of the following instructions: - iget/iput - iget-wide/iput-wide - iget-object/iput-object - invoke-virtual/range. These special instructions cannot be treated by the verifier since they lose the field/method index referencing the field/method being accessed/invoked. To prevent this, the DEX-to-DEX compiler is run only on methods of preverified classes (without verification error at compilation time). The DEX-to-DEX compiler implements quickening support using the CompilerDriver interface like the native compiler does (Quick or Portable backends). To replace instructions, the DEX-to-DEX compiler must be able to modify the mmapped DEX file. Since it can be read-only protected, the DEX-to-DEX compiler must be able to temporarily change its protection to read-write mmapped file. To achieve this, this CL adds support for changing DEX file protection with DexFile::EnableWrite and DexFile::DisableWrite methods. Besides, it also adds a dedicated lock (DexFile::modification_lock) to ensure thread-safety and avoid concurrent DEX file protection change (from a parallel DEX-to-DEX compiler on the same DEX file). Change-Id: Iaafd103b9766810d7fc94a2c424a8fafba66e26a
2013-06-21GC clean up. Ian Rogers
Greater use of directories and namespaces. Fix bugs that cause verify options to fail. Address numerous other issues: GC barrier wait occurring holding locks: GC barrier waits occur when we wait for threads to run the check point function on themselves. This is happening with the heap bitmap and mutator lock held meaning that a thread that tries to take either lock exclusively will block waiting on a thread that is waiting. If this thread is the thread we're waiting to run the check point then the VM will deadlock. This deadlock occurred unnoticed as the call to check for wait safety was removed in: https://googleplex-android-review.googlesource.com/#/c/249423/1. NewTimingLogger: Existing timing log states when a split ends but not when it begins. This isn't good for systrace, in the context of GC it means that races between mutators and the GC are hard to discover what phase the GC is in, we know what phase it just finished and derive but that's not ideal. Support for only 1 discontinuous space: Code special cases continuous and large object space, rather than assuming we can have a collection of both. Sorted atomic stacks: Used to improve verification performance. Simplify their use and add extra checks. Simplify mod-union table abstractions. Reduce use of std::strings and their associated overhead in hot code. Make time units of fields explicit. Reduce confusion that IsAllocSpace is really IsDlMallocSpace. Make GetTotalMemory (exposed via System) equal to the footprint (as in Dalvik) rather than the max memory footprint. Change-Id: Ie87067140fa4499b15edab691fe6565d79599812
2013-06-20Don't always slow-path array casts/instance-of. Ian Rogers
Recent changes to IsAbstract for arrays pushed us in to always generating slow-paths. Change-Id: I52fb50953949f337243961a308eabf0d684eacf3
2013-06-14Move image class computation to the CompilerDriver Brian Carlstrom
Change-Id: Ia51cdc199cdeaf409755ab8da23323e204ce041e
2013-06-07Merge "Simplify CanAssumeTypeIsPresentInDexCache." into dalvik-dev Ian Rogers
2013-06-07Simplify CanAssumeTypeIsPresentInDexCache. Ian Rogers
Only use ScopedObjectAccess to check correct dex cache semantics. Change-Id: Ia4d3475368f92736c8a705b1b9a13175fc0af413
2013-06-07Created compiled stubs in image. Jeff Hao
Saves class linker from having to set code pointers when loading from an image. Added stubs for quick and portable resolution trampolines, and interpreter-to-interpreter and interpreter-to-quick entry points. Also added sizing stats output for oat writer. Change-Id: I3905fae81047742c23d1cf0ca001db798db971b1
2013-06-05Faster instance-of for final classes. Ian Rogers
If a class is final and not and array we can generate a 1/0 based on class equality. Use a method's declaring class if it matches the instance-of class (common in Java equals methods). Don't do a class pointer comparison in the case of an abstract or interface class, just go straight into the slow-path. Fix performance bug where peep-hole verifier pass didn't merge into the fall-through line if the next instruction wasn't interesting. Change-Id: Idb47ec6acebfd25a344ed74adaacba02fafc7df2
2013-06-05Don't apply instance-of peephole when vDest == vSrc. Ian Rogers
Bug: 9284898. Also statistic to show check-cast ellision use. Fix bug where the check-cast ellision was using wrong dex pc. Avoid a use of DecodedInstruction. Other formatting clean-up. Change-Id: Ibf67941a24148b615896d0be6f2f29ce5034e53a
2013-06-01Allow type based sharpening for imprecise references. Ian Rogers
When a reference is imprecise we may still be able to devirtualize if the method that is dispatched upon may not be overridden (ie final). Some other tidying of the devirtualization code. For boot this increases the frequency of type based devirtualization by a little more than 0.01%. Change-Id: I050efbcc78c6b89135a6432bd7c2e946d8efbab4
2013-05-31Verifier improvements. Ian Rogers
Make type hierarchy for unresolved and unitialized types explicit. Tidy and comment code. Add DexFile::FindStringId that takes UTF-16 to avoid unnecessary UTF-8 conversions during image writing. Explicitly disable RTTI that causes problems in debug builds. Change-Id: I701f1c3be8be5854fcabf5ec39e9f9c5d388aab0
2013-05-31More profiler driven tweaks. Ian Rogers
Make more code inlinable by moving to header files. Use reserve on std::vectors to avoid reallocation. Change-Id: I1bf67d32dd58ff5c06dec73a247fadc3de593e91
2013-05-30Profiler directed clean-up of dex2oat. Ian Rogers
Fix bad usage of std::string in: the verifier and compiler driver method arguments, causing unnecessary boxing and allocations; in creating a symbol for the dex compilation unit, that is only used in portable builds; in pattern matching for intrinsics by name. Make class linker dex and classes locks reader/writer to allow concurrent dex cache or class querying. Refactor ComputeCompilingMethodsClass to pass in a dex cache hint, to avoid taking any locks when the dex file of the compiling method matches that of the field or method being resolved. Make the RegType's HasClass method virtual to avoid frequent virtual method dispatch. Make RegTypeCache GetFromId inlinable. Various other bits of whitespace and formatting clean-up. Change-Id: Id152e1e5a6fed2961dad0b612b7aa0c48001ef94
2013-05-29Build fix. Ian Rogers
MIPS build exposed a latest bug in DexFile's binary search code. Portable build always requires a dex cache when using verifier based sharpening. Change-Id: I235c033d7eba0272b264f5dbda209ff5cd7cce93
2013-05-24Enable devirtualization for abstract and sub-class methods. Ian Rogers
If we know the type of a receiver in the verifier we record devirtualization data. Currently we only use this data to avoid virtual method dispatch when we know the receiver of a method isn't a sub-class. This change allows devirtualization of virtual and interface methods when we know the receiver's type and the method the we'd find via dispatch is either known within boot or has a reference from the current dex file. Pass the receiver through to the method resolution trampoline as devirtualization may mean the dex method index needs to be made more accurate for the receiver. Tidy up method devirtualization and related statistics. Push the devirtualization map lookup into a less common case to avoid taking its lock. Make MethodReference a struct rather than a typedef of a pair, so the members can have more meaningful names than first and second. Rough statistics show that we devirtualize using this change around 2.5% of the time, whilst some apps like GMS core devirtualize over 3.4% of the time. Change-Id: Ieed3471dbedfc4cc881d652631b67176bb37d394
2013-05-13Rename abstract method code_ to entry_point_from_compiled_code_. Jeff Hao
Change-Id: I9b02d2df95bbeafa6e6387b461f574c57337a61e
2013-05-10Improve interpreter to interpreter invokes. Jeff Hao
The interpreter constructs a shadow frame instead of arg array to make interpreter to interpreter transitions faster. This adds a pointer to an entry for the interpreter to each method. Change-Id: If48911d3aa3470847b8548a9e92090b829f4f254
2013-05-10Fixed Android.common.mk #define setting for small art Anwar Ghuloum
We were seeing things compile when they shouldn't have. This fixes it. Plus added a bit more documentation to options, set default values for the two small art related thresholds to zero. Change-Id: Id5db11962f3e30d8d4ee6b85d4cf7d6e66323adb
2013-05-04Tracking merge of JWR32E (#656244) to dalvik-dev Brian Carlstrom
Change-Id: I2c7baf8e3ccb7a0f05f767628917caed83720a2a
2013-05-02Supporting de-virtualization for precise types. Sameer Abu Asal
Sharpening invoke-virtual and invoke-interface calls to invoke-direct for cases where the type of "this" pointer in the invoke- params is precisely known. Instructions that have an invoke opcode are marked as interesting, for each invoke-virtual/interface we come across with a precise type for "this" we mark the location as a candidate for sharpening, resolve the concrete method and save its method reference <DexFile, DexMethodIndex> to be sharpened in CompilerDriver::ComputeInvokeInfo(). Added a new entry to AOT statistics showing the percentage of sharpened calls that were based on type analysis. Fix a minor bug in type creation for GetSuperClass(). Previously super class of a precise reference had precise types created which is not necessarily the case. Fixed DCHECK in Class::FindVirtualMethodForVirtual to handle cases for Miranda methods. Sharpening only takes place for cases where no soft failures happen at verification time. Change-Id: Ic027d0226d6f95260c1918014cb6313f2e0ca455
2013-05-01Merge "Compile filter for small applications and methods" into dalvik-dev Anwar Ghuloum
2013-04-30Compile filter for small applications and methods Anwar Ghuloum
Adds a filter per method and program size (in method count). Right now, options are treated as runtime options...but we might want to change this and separate options for compilers and runtime. Change-Id: I8c3e925116119af8ffa95ff09f77bcfdd173767b
2013-04-30Track rename of JSSE Kenny Root
Change-Id: I1e038e63ccad098a5812bbb1532ca4dd839d4be0
2013-04-30Revert "Supporting de-virtualization for precise types." Brian Carlstrom
This reverts commit 31d4b8e0058b33e2c5ce792a69e5e897583652e2.
2013-04-29Supporting de-virtualization for precise types. Sameer Abu Asal
Sharpening invoke-virtual and invoke-interface calls to invoke-direct for cases where the type of "this" pointer in the invoke- params is precisely known. Instructions that have an invoke opcode are marked as interesting, for each invoke-virtual/interface we come across with a precise type for "this" we mark the location as a candidate for sharpening, resolve the concrete method and save its method reference <DexFile, DexMethodIndex> to be sharpened in CompilerDriver::ComputeInvokeInfo(). Added a new entry to AOT statistics showing the percentage of sharpened calls that were based on type analysis. Fix a minor bug in type creation for GetSuperClass(). Previously super class of a precise reference had precise types created which is not necessarily the case. Fixed DCHECK in Class::FindVirtualMethodForVirtual to handle cases for Miranda methods. Change-Id: I0626d5cd1bc70a685db71abec067370ebdaf6edc
2013-04-26Merge "Revert "Supporting de-virtualization for precise types."" into dalvik-dev Ian Rogers
2013-04-26Revert "Supporting de-virtualization for precise types." Ian Rogers
This reverts commit b0682d5f7970470130f43d35f37ae7605a8a9bb8 Change-Id: I2b0dc3e716ee5c23b89d9fa6eb0ef05c24784b3e
2013-04-26Merge "Supporting de-virtualization for precise types." into dalvik-dev Ian Rogers
2013-04-26Removing remaining compiled stubs from image. Jeff Hao
Abstract method error stub and jni dlsym lookup stubs are gone. After this change, the image no longer needs to be executable. Change-Id: Ic75d72bf7e76e3b8ecc596e82af68ab592dde15e
2013-04-26Supporting de-virtualization for precise types. Sameer Abu Asal
Sharpening invoke-virtual and invoke-interface calls to invoke-direct for cases where the type of "this" pointer in the invoke- params is precisely known. Instructions that have an invoke opcode are marked as interesting, for each invoke-virtual/interface we come across with a precise type for "this" we mark the location as a candidate for sharpening, resolve the concrete method and save its method reference <DexFile, DexMethodIndex> to be sharpened in CompilerDriver::ComputeInvokeInfo(). Added a new entry to AOT statistics showing the percentage of sharpened calls that were based on type analysis. Fix a minor bug in type creation for GetSuperClass(). Previously super class of a precise reference had precise types created which is not necessarily the case. Change-Id: Iee61858e84242dfc82be363ee221d2747a1ac86a
2013-04-23Removed compiled resolution trampoline. Jeff Hao
Created assembly versions of resolution trampoline for portable and quick. Removed compiled version from the image. Change-Id: I183e110c4e102fb45ce6e7f4e855f8bed7986251
2013-04-17minor cleanup Anwar Ghuloum
Change-Id: I92dda15aaa2626821befcb9a5db3801b0ab074e5
2013-04-16Add bool to verifier to allow soft failures. Jeff Hao
When false, soft failures in the verifier become hard failures. It should only be false when not compiling, and calling the verifier from the class linker. Change-Id: I664e5cbe491784b280aa5bfdb7e7fc0b771814f5
2013-04-16Compile less stuff Anwar Ghuloum
Don't compile class initializers, compile programs with fewer than commmand-line specified number of methods, mildly refactor SLOW_MODE, rename into LIGHT_MODE. Also, walks the image for uncompiled methods and fixes up with pointers to the interpreter entry point. (Removed hot method list and light method limit as these are experimental.) Change-Id: I2ae33d8add84ab9f4d76f9d910cae422c81a7832
2013-04-11Remove SLOW_ART output spam in compiler driver. Jeff Hao
Change-Id: I3a0961be43dc366552b8f1f2219b16cf7d20fac9
2013-04-09Fix abort regression. Ian Rogers
Change https://googleplex-android-review.googlesource.com/#/c/249463/ set a boolean prior to testing it meaning that all aborts were seen as recursive and no meaningful log information was given. Also a fix related to https://googleplex-android-review.googlesource.com/293665 where we were attempting to dump other threads stacks during aborting even though those threads weren't suspended. Change-Id: I1f848512c5e380529579db3d16bb8f5ddda36ad3
2013-04-09Build fix. Ian Rogers
Change-Id: If187062cc456db49a6eb4987c0548f09fac75cf4
2013-04-08Interpreter entries and instrumentation as a listener. Ian Rogers
Make the instrumentation responsible for whether we want method entry/exit stubs, and allow it to use interpreter entry stubs when instruction by instruction instrumentation is required. Improve deoptimization so more JDWP test cases are passing. Refactor exception debug posting, in particular improve reporting in the interpreter. Improve class linker exception throwing so that broken dex files are more likely to be reported. Fixes the performance issue Bug: 8410519. Fix some error reporting lock level errors for the large object space. Make fast object verification faster. Add some debug mode robustness to finding dex PCs in GC maps. Add printf attributes to JniAbortF and fix errors. Expand run-test 044 to test return behaviors and fix issues with not throwing appropriate exceptions for proxies. Ensure causes are reported with a class linker NoClassDefFoundError and JNI NoSuchFieldError. Remove unused debugMe and updateDebuggerFromCode. There's a minor sizing tweak to the arg array builder, and an extra reference array check in the interpreter. Some clean-up of trace code. Fix reg type cache destructor if it is called after the reg type cache is shutdown (as is the case in oatdump). Change-Id: I6519c7b35df77f978d011999354c864f4918e8ce
2013-04-08Remove remaining code related to compiled invoke and proxy stubs. Jeff Hao
Change-Id: Ib0b2829fed9d7efee09d098ce4db9d13f2fa2eac
2013-03-30Merge branch 'dalvik-dev' of ↵ Brian Carlstrom
https://googleplex-android.googlesource.com/a/platform/art into fixes-for-art-build-with-mr2 Change-Id: Ie46d1f77f98b8a6f55f02b8614cb88b36b6a2d44
2013-03-27Merge "Remove code related to compiled invoke stubs." into dalvik-dev Jeff Hao
2013-03-27Remove code related to compiled invoke stubs. Jeff Hao
Note that the oat file version is now bumped to 004. A clean-oat will be necessary after syncing this change. Change-Id: If8875335b7fcc39b6b40c6f95de07da50da7b6b8
2013-03-27Disable close of compiler_library_ to workaround mclinker bug affecting ↵ Brian Carlstrom
gtest output Change-Id: I93b4a83861803a5e610c719bf3468f8967701ff0
2013-03-24Update class_initializer_black_list for jb-mr2 Brian Carlstrom
Change-Id: I7b5c604601958c80050d19fd337cfca494d94554
2013-03-20Slow ART. Ian Rogers
Run ART with the interpreter for all but boot.oat code. Change-Id: I1654ecff6769a6c754f713be7580717d5ce07dc1