12faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes/* 22faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * Copyright (C) 2011 The Android Open Source Project 32faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * 42faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * Licensed under the Apache License, Version 2.0 (the "License"); 52faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * you may not use this file except in compliance with the License. 62faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * You may obtain a copy of the License at 72faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * 82faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * http://www.apache.org/licenses/LICENSE-2.0 92faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * 102faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * Unless required by applicable law or agreed to in writing, software 112faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * distributed under the License is distributed on an "AS IS" BASIS, 122faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 132faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * See the License for the specific language governing permissions and 142faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes * limitations under the License. 152faa5f1271587cda765f26bcf2951065300a01ffElliott Hughes */ 167b21670581d13db32f1384a3b2692bcfc8f57320Carl Shapiro 17fc0e3219edc9a5bf81b166e82fd5db2796eb6a0dBrian Carlstrom#ifndef ART_RUNTIME_RUNTIME_H_ 18fc0e3219edc9a5bf81b166e82fd5db2796eb6a0dBrian Carlstrom#define ART_RUNTIME_RUNTIME_H_ 196b6b5f0e67ce03f38223a525612955663bc1799bCarl Shapiro 20a0e180632411f7fe0edf454e571c42209ee7b540Elliott Hughes#include <jni.h> 21c5f7c91ab89055cffb573fff7e06dbdd860bccedElliott Hughes#include <stdio.h> 22c5f7c91ab89055cffb573fff7e06dbdd860bccedElliott Hughes 23e27955ca3ca960928d4dbd6cb79711fce06950b3Elliott Hughes#include <iosfwd> 24799eb3a5555254427db269921042419bc30d4d86Hiroshi Yamauchi#include <set> 256ea095ad30bf13cc00b4fee7afbbe4731a349c83Brian Carlstrom#include <string> 26fc322c72d7a89a6f7a05c8bdc232d780aecd9232Carl Shapiro#include <utility> 2716d1dd86dca33520b44d9802695e19d3b658af3eChang Xing#include <memory> 286ea095ad30bf13cc00b4fee7afbbe4731a349c83Brian Carlstrom#include <vector> 29578bbdc684db8ed68e9fedbc678669d27fa68b6eBrian Carlstrom 30d582fa4ea62083a7598dded5b82dc2198b3daac7Ian Rogers#include "arch/instruction_set.h" 31794ad76e8d5b5b9132819d5b08a0570e27615644Andreas Gampe#include "base/macros.h" 3204bbb5be5b9c0f0b3a72116353d23ea63c8bc5e9Andreas Gampe#include "base/mutex.h" 334e92c3ce7ef354620a785553bbada554fca83a67Nicolas Geoffray#include "deoptimization_kind.h" 349e734c7ab4599d7747a05db0dc73c7b668cb6683David Sehr#include "dex/dex_file_types.h" 35eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light#include "experimental_flags.h" 3694f7b49578b6aaa80de8ffed230648d601393905Hiroshi Yamauchi#include "gc_root.h" 3762d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers#include "instrumentation.h" 38403207107da7f11525c4d305184c56b35ec1c17aAlex Light#include "jdwp_provider.h" 398778c521de4f686118549ef7b20ae497e53b9e93Mathieu Chartier#include "obj_ptr.h" 40576ca0cd692c0b6ae70e776de91015b8ff000a08Ian Rogers#include "offsets.h" 41f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier#include "process_state.h" 427624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko#include "quick/quick_method_frame_info.h" 439d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes#include "runtime_stats.h" 44b557353b22c728eecbd1c68593b482622c7782a8Carl Shapiro 456b6b5f0e67ce03f38223a525612955663bc1799bCarl Shapironamespace art { 467b21670581d13db32f1384a3b2692bcfc8f57320Carl Shapiro 471d54e73444e017d3a65234e0f193846f3e27472bIan Rogersnamespace gc { 482ffb703bf431d74326c88266b4ddaf225eb3c6adIgor Murashkinclass AbstractSystemWeakHolder; 492ffb703bf431d74326c88266b4ddaf225eb3c6adIgor Murashkinclass Heap; 50576ca0cd692c0b6ae70e776de91015b8ff000a08Ian Rogers} // namespace gc 51e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier 52a5dc52c023be28850e4d7422655d96771cb472f5Mathew Inwoodnamespace hiddenapi { 53a5dc52c023be28850e4d7422655d96771cb472f5Mathew Inwoodenum class EnforcementPolicy; 54a5dc52c023be28850e4d7422655d96771cb472f5Mathew Inwood} // namespace hiddenapi 55a5dc52c023be28850e4d7422655d96771cb472f5Mathew Inwood 56e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartiernamespace jit { 572ffb703bf431d74326c88266b4ddaf225eb3c6adIgor Murashkinclass Jit; 582ffb703bf431d74326c88266b4ddaf225eb3c6adIgor Murashkinclass JitOptions; 59e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier} // namespace jit 60e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier 612dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogersnamespace mirror { 622ffb703bf431d74326c88266b4ddaf225eb3c6adIgor Murashkinclass Array; 632ffb703bf431d74326c88266b4ddaf225eb3c6adIgor Murashkinclass ClassLoader; 642ffb703bf431d74326c88266b4ddaf225eb3c6adIgor Murashkinclass DexCache; 652ffb703bf431d74326c88266b4ddaf225eb3c6adIgor Murashkintemplate<class T> class ObjectArray; 662ffb703bf431d74326c88266b4ddaf225eb3c6adIgor Murashkintemplate<class T> class PrimitiveArray; 672ffb703bf431d74326c88266b4ddaf225eb3c6adIgor Murashkintypedef PrimitiveArray<int8_t> ByteArray; 682ffb703bf431d74326c88266b4ddaf225eb3c6adIgor Murashkinclass String; 692ffb703bf431d74326c88266b4ddaf225eb3c6adIgor Murashkinclass Throwable; 702dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers} // namespace mirror 717233c7e752c0d26387d143ee74420e9cd1f09390Alex Lightnamespace ti { 722ffb703bf431d74326c88266b4ddaf225eb3c6adIgor Murashkinclass Agent; 73aadcbc64c674995ccdaf686789c8d39ada9913adAndreas Gampeclass AgentSpec; 747233c7e752c0d26387d143ee74420e9cd1f09390Alex Light} // namespace ti 75c528dba35b5faece51ca658fc008b688f8b690adMathieu Chartiernamespace verifier { 762ffb703bf431d74326c88266b4ddaf225eb3c6adIgor Murashkinclass MethodVerifier; 772ffb703bf431d74326c88266b4ddaf225eb3c6adIgor Murashkinenum class VerifyMode : int8_t; 786a3c1fcb4ba42ad4d5d142c17a3712a6ddd3866fIan Rogers} // namespace verifier 79e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartierclass ArenaPool; 80e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartierclass ArtMethod; 818228cdf4ad6322ec8133564aaa51f966d36c0f17Andreas Gampeenum class CalleeSaveType: uint32_t; 8261e019d291583029c01b61b93bea750f2b663c37Carl Shapiroclass ClassLinker; 83e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartierclass CompilerCallbacks; 84fc322c72d7a89a6f7a05c8bdc232d780aecd9232Carl Shapiroclass DexFile; 85cf4c6c41b0084dc4567ff709fb8ce9ebd72b26acElliott Hughesclass InternTable; 86d482e73fe26cb9161511a80e3db39e08b9808ab6Andreas Gampeclass IsMarkedVisitor; 87b48b9eb6d181a1f52e2e605cf26a21505f1d46edIan Rogersclass JavaVMExt; 88e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartierclass LinearAlloc; 892ac67d526eb348019433138b04eb1473d45cb0f4Andreas Gampeclass MemMap; 90c33a32bccc4c66ed82ce3a580b16636399385cb4Elliott Hughesclass MonitorList; 91ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogersclass MonitorPool; 92576ca0cd692c0b6ae70e776de91015b8ff000a08Ian Rogersclass NullPointerHandler; 93f9c6fc610b27887f832e453a0da1789187293408Mathieu Chartierclass OatFileManager; 94185d134a3b43ab7529053e965917e0fa74bceba4Alex Lightclass Plugin; 9588b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Markostruct RuntimeArgumentMap; 96ac30fa2151095d2b5fe42f169a02ed09fea312b4Andreas Gampeclass RuntimeCallbacks; 97e27955ca3ca960928d4dbd6cb79711fce06950b3Elliott Hughesclass SignalCatcher; 98576ca0cd692c0b6ae70e776de91015b8ff000a08Ian Rogersclass StackOverflowHandler; 99576ca0cd692c0b6ae70e776de91015b8ff000a08Ian Rogersclass SuspensionHandler; 10061e019d291583029c01b61b93bea750f2b663c37Carl Shapiroclass ThreadList; 1012692b573a56cd63a3c8c8aa1636e3766b6d8c9c4jeffhaoclass Trace; 102f6a780abeaed4bf745720e8f836a3064d3ffbec4Andreas Gampestruct TraceConfig; 103d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertzclass Transaction; 10461e019d291583029c01b61b93bea750f2b663c37Carl Shapiro 105e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogerstypedef std::vector<std::pair<std::string, const void*>> RuntimeOptions; 106e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogers 1071fb8620309a4e94d11879aabc33364acfa733904Carl Shapiroclass Runtime { 1087b21670581d13db32f1384a3b2692bcfc8f57320Carl Shapiro public: 10988b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko // Parse raw runtime options. 11088b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko static bool ParseOptions(const RuntimeOptions& raw_options, 11188b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko bool ignore_unrecognized, 11288b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko RuntimeArgumentMap* runtime_options); 11388b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko 11488b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko // Creates and initializes a new runtime. 11588b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko static bool Create(RuntimeArgumentMap&& runtime_options) 11688b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko SHARED_TRYLOCK_FUNCTION(true, Locks::mutator_lock_); 11788b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko 11861e019d291583029c01b61b93bea750f2b663c37Carl Shapiro // Creates and initializes a new runtime. 11988b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko static bool Create(const RuntimeOptions& raw_options, bool ignore_unrecognized) 120b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_TRYLOCK_FUNCTION(true, Locks::mutator_lock_); 12169b15fb098162f19a4c20e6dccdcead04d9c77f0Brian Carlstrom 122e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier // IsAotCompiler for compilers that don't have a running runtime. Only dex2oat currently. 123e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier bool IsAotCompiler() const { 124ffc87076dda9878cb2cc098149bae441d38b9268Calin Juravle return !UseJitCompilation() && IsCompiler(); 125e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier } 126e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier 127e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier // IsCompiler is any runtime which has a running compiler, either dex2oat or JIT. 128d9c67be7c116875d96b31e640ad47d587b205605Elliott Hughes bool IsCompiler() const { 1292b5eaa2b49f7489bafdadc4b4463ae27e4261817Vladimir Marko return compiler_callbacks_ != nullptr; 1302b5eaa2b49f7489bafdadc4b4463ae27e4261817Vladimir Marko } 1312b5eaa2b49f7489bafdadc4b4463ae27e4261817Vladimir Marko 1324585f876eb5dfb936bd0d6cb6acd78a1f2182ba6Andreas Gampe // If a compiler, are we compiling a boot image? 1334585f876eb5dfb936bd0d6cb6acd78a1f2182ba6Andreas Gampe bool IsCompilingBootImage() const; 1344585f876eb5dfb936bd0d6cb6acd78a1f2182ba6Andreas Gampe 1354585f876eb5dfb936bd0d6cb6acd78a1f2182ba6Andreas Gampe bool CanRelocate() const; 136a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light 137a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light bool ShouldRelocate() const { 138a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light return must_relocate_ && CanRelocate(); 139a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light } 140a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light 141a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light bool MustRelocateIfPossible() const { 142a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light return must_relocate_; 143a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light } 144a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light 1454fcdc94d22a4608e355aa8df36240181149d10e8Nicolas Geoffray bool IsDex2OatEnabled() const { 14664ad14dbe2225441fb7734bf6d89358d96692eeaAlex Light return dex2oat_enabled_ && IsImageDex2OatEnabled(); 14764ad14dbe2225441fb7734bf6d89358d96692eeaAlex Light } 14864ad14dbe2225441fb7734bf6d89358d96692eeaAlex Light 14964ad14dbe2225441fb7734bf6d89358d96692eeaAlex Light bool IsImageDex2OatEnabled() const { 15064ad14dbe2225441fb7734bf6d89358d96692eeaAlex Light return image_dex2oat_enabled_; 1514fcdc94d22a4608e355aa8df36240181149d10e8Nicolas Geoffray } 1524fcdc94d22a4608e355aa8df36240181149d10e8Nicolas Geoffray 1532b5eaa2b49f7489bafdadc4b4463ae27e4261817Vladimir Marko CompilerCallbacks* GetCompilerCallbacks() { 1542b5eaa2b49f7489bafdadc4b4463ae27e4261817Vladimir Marko return compiler_callbacks_; 155d9c67be7c116875d96b31e640ad47d587b205605Elliott Hughes } 156d9c67be7c116875d96b31e640ad47d587b205605Elliott Hughes 15707ddb6f713f8c919e6da7c4b473cfb3bacb7cf10Mathieu Chartier void SetCompilerCallbacks(CompilerCallbacks* callbacks) { 15807ddb6f713f8c919e6da7c4b473cfb3bacb7cf10Mathieu Chartier CHECK(callbacks != nullptr); 15907ddb6f713f8c919e6da7c4b473cfb3bacb7cf10Mathieu Chartier compiler_callbacks_ = callbacks; 16007ddb6f713f8c919e6da7c4b473cfb3bacb7cf10Mathieu Chartier } 16107ddb6f713f8c919e6da7c4b473cfb3bacb7cf10Mathieu Chartier 162caabb1b77b4a55eb1bb45ebcd3071c9ea01dd3cfBrian Carlstrom bool IsZygote() const { 163caabb1b77b4a55eb1bb45ebcd3071c9ea01dd3cfBrian Carlstrom return is_zygote_; 164caabb1b77b4a55eb1bb45ebcd3071c9ea01dd3cfBrian Carlstrom } 165caabb1b77b4a55eb1bb45ebcd3071c9ea01dd3cfBrian Carlstrom 1668718359763aa3dcd0033a2d2e67e0cb145fb9c53Anwar Ghuloum bool IsExplicitGcDisabled() const { 1678718359763aa3dcd0033a2d2e67e0cb145fb9c53Anwar Ghuloum return is_explicit_gc_disabled_; 1688718359763aa3dcd0033a2d2e67e0cb145fb9c53Anwar Ghuloum } 1698718359763aa3dcd0033a2d2e67e0cb145fb9c53Anwar Ghuloum 17012e6d7446384a7a5fbec25fe116bbb271c62842eTsu Chiang Chuang std::string GetCompilerExecutable() const; 171a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light std::string GetPatchoatExecutable() const; 17212e6d7446384a7a5fbec25fe116bbb271c62842eTsu Chiang Chuang 1736449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom const std::vector<std::string>& GetCompilerOptions() const { 1746449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom return compiler_options_; 175a024a0686c3b0fea13f362bff70d65981e5febc5buzbee } 176a024a0686c3b0fea13f362bff70d65981e5febc5buzbee 1775c657fe8e3afdce77dc610446f37a43865cff702Vladimir Marko void AddCompilerOption(const std::string& option) { 178d2abbc9829ea0f657557c247a7c48c825dacfccdAndreas Gampe compiler_options_.push_back(option); 179d2abbc9829ea0f657557c247a7c48c825dacfccdAndreas Gampe } 180d2abbc9829ea0f657557c247a7c48c825dacfccdAndreas Gampe 1816449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom const std::vector<std::string>& GetImageCompilerOptions() const { 1826449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom return image_compiler_options_; 1838447d84d847d4562d7a7bce62768c27e7d20a9aaAnwar Ghuloum } 1848447d84d847d4562d7a7bce62768c27e7d20a9aaAnwar Ghuloum 18531d8f5295c24730a57cb36cbc41197f0b7e8397cBrian Carlstrom const std::string& GetImageLocation() const { 18631d8f5295c24730a57cb36cbc41197f0b7e8397cBrian Carlstrom return image_location_; 18731d8f5295c24730a57cb36cbc41197f0b7e8397cBrian Carlstrom } 18831d8f5295c24730a57cb36cbc41197f0b7e8397cBrian Carlstrom 18969b15fb098162f19a4c20e6dccdcead04d9c77f0Brian Carlstrom // Starts a runtime, which may cause threads to be started and code to run. 190bd86bccf1b47f1151842152ee52cf5d46d6b34abBrian Carlstrom bool Start() UNLOCK_FUNCTION(Locks::mutator_lock_); 1912ed144c2b49ae1da6c464d7a1be0062870530802Carl Shapiro 192590fee9e8972f872301c2d16a575d579ee564beeMathieu Chartier bool IsShuttingDown(Thread* self); 19390443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier bool IsShuttingDownLocked() const REQUIRES(Locks::runtime_shutdown_lock_) { 1949af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers return shutting_down_; 1959af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers } 1969af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers 19790443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier size_t NumberOfThreadsBeingBorn() const REQUIRES(Locks::runtime_shutdown_lock_) { 198120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers return threads_being_born_; 199120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers } 200120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers 20190443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier void StartThreadBirth() REQUIRES(Locks::runtime_shutdown_lock_) { 202120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers threads_being_born_++; 203120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers } 204120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers 20590443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier void EndThreadBirth() REQUIRES(Locks::runtime_shutdown_lock_); 206120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers 2079af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers bool IsStarted() const { 2089af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers return started_; 2099af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers } 210dcc247493fd8fb243e335c3ec08e5e625896a47cElliott Hughes 2117664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier bool IsFinishedStarting() const { 2127664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier return finished_starting_; 2137664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier } 2147664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier 2152ed144c2b49ae1da6c464d7a1be0062870530802Carl Shapiro static Runtime* Current() { 2162ed144c2b49ae1da6c464d7a1be0062870530802Carl Shapiro return instance_; 2172ed144c2b49ae1da6c464d7a1be0062870530802Carl Shapiro } 21861e019d291583029c01b61b93bea750f2b663c37Carl Shapiro 219db978719dbcb73fc6acfd193561445c4462786b8Nicolas Geoffray // Aborts semi-cleanly. Used in the implementation of LOG(FATAL), which most 220db978719dbcb73fc6acfd193561445c4462786b8Nicolas Geoffray // callers should prefer. 22190a32b16feb58d4edf932fdcb6a070be3418e365Andreas Gampe NO_RETURN static void Abort(const char* msg) REQUIRES(!Locks::abort_lock_); 222ffe6736397d17457188727510f0a2953f69a383aElliott Hughes 223365c10235438607541fa2259a5fec48061b90bd8Ian Rogers // Returns the "main" ThreadGroup, used when attaching user threads. 224034f76b91225bea769d6185d7dad5e243af4ffa0Brian Carlstrom jobject GetMainThreadGroup() const; 225365c10235438607541fa2259a5fec48061b90bd8Ian Rogers 226365c10235438607541fa2259a5fec48061b90bd8Ian Rogers // Returns the "system" ThreadGroup, used when attaching our internal threads. 227034f76b91225bea769d6185d7dad5e243af4ffa0Brian Carlstrom jobject GetSystemThreadGroup() const; 228365c10235438607541fa2259a5fec48061b90bd8Ian Rogers 229ce88853ab316c70ef7b598978a3609611db60552Brian Carlstrom // Returns the system ClassLoader which represents the CLASSPATH. 230ce88853ab316c70ef7b598978a3609611db60552Brian Carlstrom jobject GetSystemClassLoader() const; 231ce88853ab316c70ef7b598978a3609611db60552Brian Carlstrom 232462c94449720e0dc6b93d7138d835d345ccf67aeElliott Hughes // Attaches the calling native thread to the runtime. 233b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin bool AttachCurrentThread(const char* thread_name, bool as_daemon, jobject thread_group, 234664bebf92eb2151b9b570ccd42ac4b6056c3ea9cMathieu Chartier bool create_peer); 235b557353b22c728eecbd1c68593b482622c7782a8Carl Shapiro 236bf86d0438e9ef9c145ebcf16a2e74c4efaa2686aElliott Hughes void CallExitHook(jint status); 237bf86d0438e9ef9c145ebcf16a2e74c4efaa2686aElliott Hughes 23861e019d291583029c01b61b93bea750f2b663c37Carl Shapiro // Detaches the current native thread from the runtime. 23990443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier void DetachCurrentThread() REQUIRES(!Locks::mutator_lock_); 24061e019d291583029c01b61b93bea750f2b663c37Carl Shapiro 2414e92c3ce7ef354620a785553bbada554fca83a67Nicolas Geoffray void DumpDeoptimizations(std::ostream& os); 2427b078e8c04f3e1451dbdd18543c8b9692b5b067eIan Rogers void DumpForSigQuit(std::ostream& os); 24321a5bf2dc8c9cb3fbe5a30a88d1149c328e3aacaElliott Hughes void DumpLockHolders(std::ostream& os); 244e27955ca3ca960928d4dbd6cb79711fce06950b3Elliott Hughes 24561e019d291583029c01b61b93bea750f2b663c37Carl Shapiro ~Runtime(); 246b557353b22c728eecbd1c68593b482622c7782a8Carl Shapiro 247a004aa933a58428489e42d77f707c2b063b73747Brian Carlstrom const std::string& GetBootClassPathString() const { 248a004aa933a58428489e42d77f707c2b063b73747Brian Carlstrom return boot_class_path_string_; 249b765be0d656c3073402693aeaf64e95a0e49f218Brian Carlstrom } 250b765be0d656c3073402693aeaf64e95a0e49f218Brian Carlstrom 251a004aa933a58428489e42d77f707c2b063b73747Brian Carlstrom const std::string& GetClassPathString() const { 252a004aa933a58428489e42d77f707c2b063b73747Brian Carlstrom return class_path_string_; 2537a90959d4ef7a69f3bcb7b8763f646e12d9267d3Carl Shapiro } 2547a90959d4ef7a69f3bcb7b8763f646e12d9267d3Carl Shapiro 255a004aa933a58428489e42d77f707c2b063b73747Brian Carlstrom ClassLinker* GetClassLinker() const { 256a004aa933a58428489e42d77f707c2b063b73747Brian Carlstrom return class_linker_; 2577ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes } 2587ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes 2597ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes size_t GetDefaultStackSize() const { 2607ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes return default_stack_size_; 2617ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes } 2627ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes 2631d54e73444e017d3a65234e0f193846f3e27472bIan Rogers gc::Heap* GetHeap() const { 264b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes return heap_; 265b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes } 266b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes 267cf4c6c41b0084dc4567ff709fb8ce9ebd72b26acElliott Hughes InternTable* GetInternTable() const { 2682cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier DCHECK(intern_table_ != nullptr); 269cf4c6c41b0084dc4567ff709fb8ce9ebd72b26acElliott Hughes return intern_table_; 270cf4c6c41b0084dc4567ff709fb8ce9ebd72b26acElliott Hughes } 271cf4c6c41b0084dc4567ff709fb8ce9ebd72b26acElliott Hughes 2720af5543f8ea20c3e655b2d748a1b7dcf283792feElliott Hughes JavaVMExt* GetJavaVM() const { 273da0a69edb24122d3d35ce1483c5ab94de919d714Richard Uhler return java_vm_.get(); 274f2682d5a6ce0f7de58da8fd4ec8aec200c43b92eElliott Hughes } 275f2682d5a6ce0f7de58da8fd4ec8aec200c43b92eElliott Hughes 276b3da36c182329f228b8c78d306a57fa11a6004eaHans Boehm size_t GetMaxSpinsBeforeThinLockInflation() const { 277d9c4fc94fa618617f94e1de9af5f034549100753Ian Rogers return max_spins_before_thin_lock_inflation_; 278d9c4fc94fa618617f94e1de9af5f034549100753Ian Rogers } 279d9c4fc94fa618617f94e1de9af5f034549100753Ian Rogers 280c33a32bccc4c66ed82ce3a580b16636399385cb4Elliott Hughes MonitorList* GetMonitorList() const { 281c33a32bccc4c66ed82ce3a580b16636399385cb4Elliott Hughes return monitor_list_; 282c33a32bccc4c66ed82ce3a580b16636399385cb4Elliott Hughes } 283c33a32bccc4c66ed82ce3a580b16636399385cb4Elliott Hughes 284ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers MonitorPool* GetMonitorPool() const { 285ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers return monitor_pool_; 286ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers } 287ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers 288c0542af3e2170143ba40d89136e284997e16bf64Ian Rogers // Is the given object the special object used to mark a cleared JNI weak global? 2898778c521de4f686118549ef7b20ae497e53b9e93Mathieu Chartier bool IsClearedJniWeakGlobal(ObjPtr<mirror::Object> obj) REQUIRES_SHARED(Locks::mutator_lock_); 290c0542af3e2170143ba40d89136e284997e16bf64Ian Rogers 291c0542af3e2170143ba40d89136e284997e16bf64Ian Rogers // Get the special object used to mark a cleared JNI weak global. 292bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe mirror::Object* GetClearedJniWeakGlobal() REQUIRES_SHARED(Locks::mutator_lock_); 293c0542af3e2170143ba40d89136e284997e16bf64Ian Rogers 294bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe mirror::Throwable* GetPreAllocatedOutOfMemoryError() REQUIRES_SHARED(Locks::mutator_lock_); 295225f5a1df25241babd16cdba54056b9e2cd166a2Elliott Hughes 296b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin mirror::Throwable* GetPreAllocatedNoClassDefFoundError() 297bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe REQUIRES_SHARED(Locks::mutator_lock_); 29863557459a4098294a9ff44d035241de2966047c0Ian Rogers 299225f5a1df25241babd16cdba54056b9e2cd166a2Elliott Hughes const std::vector<std::string>& GetProperties() const { 300225f5a1df25241babd16cdba54056b9e2cd166a2Elliott Hughes return properties_; 301225f5a1df25241babd16cdba54056b9e2cd166a2Elliott Hughes } 302225f5a1df25241babd16cdba54056b9e2cd166a2Elliott Hughes 303d92bec457dc6c506c80e9da6b8e0c958266b5cdcElliott Hughes ThreadList* GetThreadList() const { 304d92bec457dc6c506c80e9da6b8e0c958266b5cdcElliott Hughes return thread_list_; 305d92bec457dc6c506c80e9da6b8e0c958266b5cdcElliott Hughes } 306d92bec457dc6c506c80e9da6b8e0c958266b5cdcElliott Hughes 307491ca9e75fad381468dd7f5fdbff56d1a9738dd7Brian Carlstrom static const char* GetVersion() { 3082153f93df36b59a61fed15bef8e7304010be04b5Andreas Gampe return "2.1.0"; 3097ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes } 3107ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes 31125352fc06c84cdab8a2ab6d173b0514066ade2b9Narayan Kamath bool IsMethodHandlesEnabled() const { 3129320675cb21a53b3dd59d80d440a96e04c84f28dNarayan Kamath return true; 31325352fc06c84cdab8a2ab6d173b0514066ade2b9Narayan Kamath } 31425352fc06c84cdab8a2ab6d173b0514066ade2b9Narayan Kamath 315bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe void DisallowNewSystemWeaks() REQUIRES_SHARED(Locks::mutator_lock_); 316bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe void AllowNewSystemWeaks() REQUIRES_SHARED(Locks::mutator_lock_); 3173049324f4ef71b5d7a3de49bd77c75f07dbf8f3aHiroshi Yamauchi // broadcast_for_checkpoint is true when we broadcast for making blocking threads to respond to 3183049324f4ef71b5d7a3de49bd77c75f07dbf8f3aHiroshi Yamauchi // checkpoint requests. It's false when we broadcast to unblock blocking threads after system weak 3193049324f4ef71b5d7a3de49bd77c75f07dbf8f3aHiroshi Yamauchi // access is reenabled. 3203049324f4ef71b5d7a3de49bd77c75f07dbf8f3aHiroshi Yamauchi void BroadcastForNewSystemWeaks(bool broadcast_for_checkpoint = false); 321c11d9b8870de5f860b13c84003ade7b3f3125a52Mathieu Chartier 3221d54e73444e017d3a65234e0f193846f3e27472bIan Rogers // Visit all the roots. If only_dirty is true then non-dirty roots won't be visited. If 3231d54e73444e017d3a65234e0f193846f3e27472bIan Rogers // clean_dirty is true then dirty roots will be marked as non-dirty after visiting. 324bb87e0f1a52de656bc77cb01cb887e51a0e5198bMathieu Chartier void VisitRoots(RootVisitor* visitor, VisitRootFlags flags = kVisitRootFlagAllRoots) 325d98b4ed7a73af40f5292337495333616d9974da0Andreas Gampe REQUIRES(!Locks::classlinker_classes_lock_, !Locks::trace_lock_) 326bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe REQUIRES_SHARED(Locks::mutator_lock_); 3271f87008b165d26541d832ff805250afdc89c253dBrian Carlstrom 328461687d898dfd91253f242072849a9fe43e5f523Mathieu Chartier // Visit image roots, only used for hprof since the GC uses the image space mod union table 329461687d898dfd91253f242072849a9fe43e5f523Mathieu Chartier // instead. 330bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe void VisitImageRoots(RootVisitor* visitor) REQUIRES_SHARED(Locks::mutator_lock_); 331461687d898dfd91253f242072849a9fe43e5f523Mathieu Chartier 332ef012225dcec8f736fc8fd848f5d8ee01c3c280fRoland Levillain // Visit all of the roots we can safely visit concurrently. 333b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin void VisitConcurrentRoots(RootVisitor* visitor, 334b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin VisitRootFlags flags = kVisitRootFlagAllRoots) 335d98b4ed7a73af40f5292337495333616d9974da0Andreas Gampe REQUIRES(!Locks::classlinker_classes_lock_, !Locks::trace_lock_) 336bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe REQUIRES_SHARED(Locks::mutator_lock_); 3379ebae1f30b84dfd8dab4144f80eebec4f8fc8851Mathieu Chartier 338858f1c5fd5e528d0b16040ced74d4636046a42d8Mathieu Chartier // Visit all of the non thread roots, we can do this with mutators unpaused. 339bb87e0f1a52de656bc77cb01cb887e51a0e5198bMathieu Chartier void VisitNonThreadRoots(RootVisitor* visitor) 340bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe REQUIRES_SHARED(Locks::mutator_lock_); 341858f1c5fd5e528d0b16040ced74d4636046a42d8Mathieu Chartier 342bb87e0f1a52de656bc77cb01cb887e51a0e5198bMathieu Chartier void VisitTransactionRoots(RootVisitor* visitor) 343bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe REQUIRES_SHARED(Locks::mutator_lock_); 3442cd334ae2d4287216523882f0d298cf3901b7ab1Hiroshi Yamauchi 3452cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier // Sweep system weaks, the system weak is deleted if the visitor return null. Otherwise, the 3466aa3df965395566ed6a4fec4af37c2b7577992e9Mathieu Chartier // system weak is updated to be the visitor's returned value. 34797509954404d031594b2ecbda607314d169d512eMathieu Chartier void SweepSystemWeaks(IsMarkedVisitor* visitor) 348bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe REQUIRES_SHARED(Locks::mutator_lock_); 3496aa3df965395566ed6a4fec4af37c2b7577992e9Mathieu Chartier 3509af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers // Returns a special method that calls into a trampoline for runtime method resolution 351fbc31087932a65e036a153afab3049dc5298656aMathieu Chartier ArtMethod* GetResolutionMethod(); 3529af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers 3539af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers bool HasResolutionMethod() const { 354e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier return resolution_method_ != nullptr; 3559af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers } 3569af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers 357bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe void SetResolutionMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_); 3588275fbaccc012072948a16f537844a552db9be84Igor Murashkin void ClearResolutionMethod() { 3598275fbaccc012072948a16f537844a552db9be84Igor Murashkin resolution_method_ = nullptr; 3608275fbaccc012072948a16f537844a552db9be84Igor Murashkin } 3619af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers 362bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe ArtMethod* CreateResolutionMethod() REQUIRES_SHARED(Locks::mutator_lock_); 3631984651929744dd603fd082e23eacd877b9bc177Ian Rogers 364e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogers // Returns a special method that calls into a trampoline for runtime imt conflicts. 365fbc31087932a65e036a153afab3049dc5298656aMathieu Chartier ArtMethod* GetImtConflictMethod(); 366fbc31087932a65e036a153afab3049dc5298656aMathieu Chartier ArtMethod* GetImtUnimplementedMethod(); 36788474b416eb257078e590bf9bc7957cee604a186Jeff Hao 36888474b416eb257078e590bf9bc7957cee604a186Jeff Hao bool HasImtConflictMethod() const { 369e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier return imt_conflict_method_ != nullptr; 37088474b416eb257078e590bf9bc7957cee604a186Jeff Hao } 37188474b416eb257078e590bf9bc7957cee604a186Jeff Hao 3728275fbaccc012072948a16f537844a552db9be84Igor Murashkin void ClearImtConflictMethod() { 3738275fbaccc012072948a16f537844a552db9be84Igor Murashkin imt_conflict_method_ = nullptr; 3748275fbaccc012072948a16f537844a552db9be84Igor Murashkin } 3758275fbaccc012072948a16f537844a552db9be84Igor Murashkin 376e42888f9df4163303244070c65d5229d3e201742Mathieu Chartier void FixupConflictTables(); 377bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe void SetImtConflictMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_); 378bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe void SetImtUnimplementedMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_); 37988474b416eb257078e590bf9bc7957cee604a186Jeff Hao 380796d63050a18f263b93ea34951a61deaecab3422Nicolas Geoffray ArtMethod* CreateImtConflictMethod(LinearAlloc* linear_alloc) 381bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe REQUIRES_SHARED(Locks::mutator_lock_); 38288474b416eb257078e590bf9bc7957cee604a186Jeff Hao 3838275fbaccc012072948a16f537844a552db9be84Igor Murashkin void ClearImtUnimplementedMethod() { 3848275fbaccc012072948a16f537844a552db9be84Igor Murashkin imt_unimplemented_method_ = nullptr; 3858275fbaccc012072948a16f537844a552db9be84Igor Murashkin } 3868275fbaccc012072948a16f537844a552db9be84Igor Murashkin 3879af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers bool HasCalleeSaveMethod(CalleeSaveType type) const { 3888228cdf4ad6322ec8133564aaa51f966d36c0f17Andreas Gampe return callee_save_methods_[static_cast<size_t>(type)] != 0u; 3899af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers } 3909af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers 391e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier ArtMethod* GetCalleeSaveMethod(CalleeSaveType type) 392bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe REQUIRES_SHARED(Locks::mutator_lock_); 393ab088118d33caafb00815ab72ac0fd7374169f64Hiroshi Yamauchi 394e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier ArtMethod* GetCalleeSaveMethodUnchecked(CalleeSaveType type) 395bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe REQUIRES_SHARED(Locks::mutator_lock_); 3969af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers 3977624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko QuickMethodFrameInfo GetCalleeSaveMethodFrameInfo(CalleeSaveType type) const { 3988228cdf4ad6322ec8133564aaa51f966d36c0f17Andreas Gampe return callee_save_method_frame_infos_[static_cast<size_t>(type)]; 3997624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko } 4007624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko 401e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier QuickMethodFrameInfo GetRuntimeMethodFrameInfo(ArtMethod* method) 402bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe REQUIRES_SHARED(Locks::mutator_lock_); 4037624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko 404936b37f3a7f224d990a36b2ec66782a4462180d6Ian Rogers static size_t GetCalleeSaveMethodOffset(CalleeSaveType type) { 4058228cdf4ad6322ec8133564aaa51f966d36c0f17Andreas Gampe return OFFSETOF_MEMBER(Runtime, callee_save_methods_[static_cast<size_t>(type)]); 406936b37f3a7f224d990a36b2ec66782a4462180d6Ian Rogers } 407936b37f3a7f224d990a36b2ec66782a4462180d6Ian Rogers 4087624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko InstructionSet GetInstructionSet() const { 4097624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko return instruction_set_; 4107624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko } 4114f0d07c783afef89703dce32c94440fc8621a29bIan Rogers 4127624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko void SetInstructionSet(InstructionSet instruction_set); 4138275fbaccc012072948a16f537844a552db9be84Igor Murashkin void ClearInstructionSet(); 4149af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers 415e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier void SetCalleeSaveMethod(ArtMethod* method, CalleeSaveType type); 4168275fbaccc012072948a16f537844a552db9be84Igor Murashkin void ClearCalleeSaveMethods(); 41700f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers 418bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe ArtMethod* CreateCalleeSaveMethod() REQUIRES_SHARED(Locks::mutator_lock_); 419ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers 4209d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes int32_t GetStat(int kind); 4219d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes 4229af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers RuntimeStats* GetStats() { 4239af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers return &stats_; 4249af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers } 4259d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes 4269d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes bool HasStatsEnabled() const { 4279d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes return stats_enabled_; 4289d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes } 4299d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes 4309d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes void ResetStats(int kinds); 4319d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes 43290443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier void SetStatsEnabled(bool new_state) 43390443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier REQUIRES(!Locks::instrument_entrypoints_lock_, !Locks::mutator_lock_); 4349d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes 4356be67eeedbe60afce42300ae3e7f0e7180a96efaAndreas Gampe enum class NativeBridgeAction { // private 4366be67eeedbe60afce42300ae3e7f0e7180a96efaAndreas Gampe kUnload, 4376be67eeedbe60afce42300ae3e7f0e7180a96efaAndreas Gampe kInitialize 4386be67eeedbe60afce42300ae3e7f0e7180a96efaAndreas Gampe }; 439e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier 440433b79a9130df5f2375b9d3d7518c1f3fb84a467Nicolas Geoffray jit::Jit* GetJit() const { 441e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier return jit_.get(); 442e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier } 443ffc87076dda9878cb2cc098149bae441d38b9268Calin Juravle 444ffc87076dda9878cb2cc098149bae441d38b9268Calin Juravle // Returns true if JIT compilations are enabled. GetJit() will be not null in this case. 445ffc87076dda9878cb2cc098149bae441d38b9268Calin Juravle bool UseJitCompilation() const; 446e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier 4473de95a7b0a2d30cde6dc92b72c35df3a61002124Narayan Kamath void PreZygoteFork(); 448d66c8621610dc18d324132c8e5b081520f719777Nicolas Geoffray void InitNonZygoteOrPostFork( 449fb74d8bc938b1095b8e1e51083070feeb65cbd0fCalin Juravle JNIEnv* env, 450fb74d8bc938b1095b8e1e51083070feeb65cbd0fCalin Juravle bool is_system_server, 451fb74d8bc938b1095b8e1e51083070feeb65cbd0fCalin Juravle NativeBridgeAction action, 452fb74d8bc938b1095b8e1e51083070feeb65cbd0fCalin Juravle const char* isa, 453fb74d8bc938b1095b8e1e51083070feeb65cbd0fCalin Juravle bool profile_system_server = false); 454caabb1b77b4a55eb1bb45ebcd3071c9ea01dd3cfBrian Carlstrom 4559bc54406ba3377980cfce44901dc2be246178ba9Ian Rogers const instrumentation::Instrumentation* GetInstrumentation() const { 4569bc54406ba3377980cfce44901dc2be246178ba9Ian Rogers return &instrumentation_; 4579bc54406ba3377980cfce44901dc2be246178ba9Ian Rogers } 4589bc54406ba3377980cfce44901dc2be246178ba9Ian Rogers 45962d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers instrumentation::Instrumentation* GetInstrumentation() { 46062d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers return &instrumentation_; 46162d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers } 4622692b573a56cd63a3c8c8aa1636e3766b6d8c9c4jeffhao 46366f55237679db90cb0a0a265043a787932b466f8Calin Juravle void RegisterAppInfo(const std::vector<std::string>& code_paths, 46477651c4bbd56d502bcf05347e641061bbebca099Calin Juravle const std::string& profile_output_filename); 4650aded089f565008ba5908e395e5914ca4f91f2deDave Allison 466d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertz // Transaction support. 467605fe24d07062a038c8332a4d98f47052e9cee6aChang Xing bool IsActiveTransaction() const; 46816d1dd86dca33520b44d9802695e19d3b658af3eChang Xing void EnterTransactionMode(); 4695a906fcc111ffc07d9fd1e7265e8b4a89609f00eChang Xing void EnterTransactionMode(bool strict, mirror::Class* root); 470d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertz void ExitTransactionMode(); 471605fe24d07062a038c8332a4d98f47052e9cee6aChang Xing void RollbackAllTransactions() REQUIRES_SHARED(Locks::mutator_lock_); 47216d1dd86dca33520b44d9802695e19d3b658af3eChang Xing // Transaction rollback and exit transaction are always done together, it's convenience to 47316d1dd86dca33520b44d9802695e19d3b658af3eChang Xing // do them in one function. 47416d1dd86dca33520b44d9802695e19d3b658af3eChang Xing void RollbackAndExitTransactionMode() REQUIRES_SHARED(Locks::mutator_lock_); 4751c80becf5406cd6d95dc24bf47a0c5a3809ea281Sebastien Hertz bool IsTransactionAborted() const; 476605fe24d07062a038c8332a4d98f47052e9cee6aChang Xing const std::unique_ptr<Transaction>& GetTransaction() const; 4775a906fcc111ffc07d9fd1e7265e8b4a89609f00eChang Xing bool IsActiveStrictTransactionMode() const; 4781c80becf5406cd6d95dc24bf47a0c5a3809ea281Sebastien Hertz 4792fd7e69505195cda4caaa3161aaf37315552a698Sebastien Hertz void AbortTransactionAndThrowAbortError(Thread* self, const std::string& abort_message) 480bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe REQUIRES_SHARED(Locks::mutator_lock_); 4812fd7e69505195cda4caaa3161aaf37315552a698Sebastien Hertz void ThrowTransactionAbortError(Thread* self) 482bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe REQUIRES_SHARED(Locks::mutator_lock_); 4831c80becf5406cd6d95dc24bf47a0c5a3809ea281Sebastien Hertz 484b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin void RecordWriteFieldBoolean(mirror::Object* obj, MemberOffset field_offset, uint8_t value, 48537f05ef45e0393de812d51261dc293240c17294dFred Shih bool is_volatile) const; 486b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin void RecordWriteFieldByte(mirror::Object* obj, MemberOffset field_offset, int8_t value, 48737f05ef45e0393de812d51261dc293240c17294dFred Shih bool is_volatile) const; 488b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin void RecordWriteFieldChar(mirror::Object* obj, MemberOffset field_offset, uint16_t value, 48937f05ef45e0393de812d51261dc293240c17294dFred Shih bool is_volatile) const; 490b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin void RecordWriteFieldShort(mirror::Object* obj, MemberOffset field_offset, int16_t value, 49137f05ef45e0393de812d51261dc293240c17294dFred Shih bool is_volatile) const; 492b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin void RecordWriteField32(mirror::Object* obj, MemberOffset field_offset, uint32_t value, 493d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertz bool is_volatile) const; 494b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin void RecordWriteField64(mirror::Object* obj, MemberOffset field_offset, uint64_t value, 495d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertz bool is_volatile) const; 496a058fdf0cf7435a13a6e8cae5e3a9bfa1513828dMathieu Chartier void RecordWriteFieldReference(mirror::Object* obj, 497a058fdf0cf7435a13a6e8cae5e3a9bfa1513828dMathieu Chartier MemberOffset field_offset, 498a058fdf0cf7435a13a6e8cae5e3a9bfa1513828dMathieu Chartier ObjPtr<mirror::Object> value, 499a058fdf0cf7435a13a6e8cae5e3a9bfa1513828dMathieu Chartier bool is_volatile) const 500a058fdf0cf7435a13a6e8cae5e3a9bfa1513828dMathieu Chartier REQUIRES_SHARED(Locks::mutator_lock_); 501d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertz void RecordWriteArray(mirror::Array* array, size_t index, uint64_t value) const 502bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe REQUIRES_SHARED(Locks::mutator_lock_); 5039e868098b4a5d666570e3924518978d7abd3542eMathieu Chartier void RecordStrongStringInsertion(ObjPtr<mirror::String> s) const 50490443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier REQUIRES(Locks::intern_table_lock_); 5059e868098b4a5d666570e3924518978d7abd3542eMathieu Chartier void RecordWeakStringInsertion(ObjPtr<mirror::String> s) const 50690443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier REQUIRES(Locks::intern_table_lock_); 5079e868098b4a5d666570e3924518978d7abd3542eMathieu Chartier void RecordStrongStringRemoval(ObjPtr<mirror::String> s) const 50890443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier REQUIRES(Locks::intern_table_lock_); 5099e868098b4a5d666570e3924518978d7abd3542eMathieu Chartier void RecordWeakStringRemoval(ObjPtr<mirror::String> s) const 51090443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier REQUIRES(Locks::intern_table_lock_); 5118a0128a5ca0784f6d2b4ca27907e8967a74bc4c5Andreas Gampe void RecordResolveString(ObjPtr<mirror::DexCache> dex_cache, dex::StringIndex string_idx) const 512bb816d66aabb9c2a2e095517d2013041116332dbMathieu Chartier REQUIRES_SHARED(Locks::mutator_lock_); 513d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertz 51490443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier void SetFaultMessage(const std::string& message) REQUIRES(!fault_message_lock_); 51515d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier // Only read by the signal handler, NO_THREAD_SAFETY_ANALYSIS to prevent lock order violations 51615d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier // with the unexpected_signal_lock_. 51715d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier const std::string& GetFaultMessage() NO_THREAD_SAFETY_ANALYSIS { 51815d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier return fault_message_; 51915d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier } 52015d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier 521b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin void AddCurrentRuntimeFeaturesAsDex2OatArguments(std::vector<std::string>* arg_vector) const; 5228afeb85d3def12b559b7565fb6d3956f81b55132Ian Rogers 523b373e091eac39b1a79c11f2dcbd610af01e9e8a9Dave Allison bool ExplicitStackOverflowChecks() const { 524928f72bd75c385ba2708c58521171a77264d4486Andreas Gampe return !implicit_so_checks_; 525b373e091eac39b1a79c11f2dcbd610af01e9e8a9Dave Allison } 526b373e091eac39b1a79c11f2dcbd610af01e9e8a9Dave Allison 52768bf3903250ff0bea11c4705ba331818c5bf5792Nicolas Geoffray void DisableVerifier(); 5287617abdb402fd0419daa3eefb2ad059ccbb8b6dbIgor Murashkin bool IsVerificationEnabled() const; 5297617abdb402fd0419daa3eefb2ad059ccbb8b6dbIgor Murashkin bool IsVerificationSoftFail() const; 5304a200f56b7075309316b04d550c9cc50f8314eddJeff Hao 531a5dc52c023be28850e4d7422655d96771cb472f5Mathew Inwood void SetHiddenApiEnforcementPolicy(hiddenapi::EnforcementPolicy policy) { 532a5dc52c023be28850e4d7422655d96771cb472f5Mathew Inwood hidden_api_policy_ = policy; 5333e0fa0aa5d929737f1d1c4bac07e2695ac438324David Brazdil } 5343e0fa0aa5d929737f1d1c4bac07e2695ac438324David Brazdil 535a5dc52c023be28850e4d7422655d96771cb472f5Mathew Inwood hiddenapi::EnforcementPolicy GetHiddenApiEnforcementPolicy() const { 536a5dc52c023be28850e4d7422655d96771cb472f5Mathew Inwood return hidden_api_policy_; 5373e0fa0aa5d929737f1d1c4bac07e2695ac438324David Brazdil } 5383e0fa0aa5d929737f1d1c4bac07e2695ac438324David Brazdil 539ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil void SetPendingHiddenApiWarning(bool value) { 540ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil pending_hidden_api_warning_ = value; 541ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil } 542ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil 5433383aa5cc3bac56576cf48086183f59ac4de279eMathew Inwood void SetHiddenApiExemptions(const std::vector<std::string>& exemptions) { 5443383aa5cc3bac56576cf48086183f59ac4de279eMathew Inwood hidden_api_exemptions_ = exemptions; 5453383aa5cc3bac56576cf48086183f59ac4de279eMathew Inwood } 5463383aa5cc3bac56576cf48086183f59ac4de279eMathew Inwood 5473383aa5cc3bac56576cf48086183f59ac4de279eMathew Inwood const std::vector<std::string>& GetHiddenApiExemptions() { 5483383aa5cc3bac56576cf48086183f59ac4de279eMathew Inwood return hidden_api_exemptions_; 5493383aa5cc3bac56576cf48086183f59ac4de279eMathew Inwood } 5503383aa5cc3bac56576cf48086183f59ac4de279eMathew Inwood 551ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil bool HasPendingHiddenApiWarning() const { 552ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil return pending_hidden_api_warning_; 553ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil } 554ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil 555ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil void SetDedupeHiddenApiWarnings(bool value) { 556ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil dedupe_hidden_api_warnings_ = value; 557ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil } 558ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil 559ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil bool ShouldDedupeHiddenApiWarnings() { 560ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil return dedupe_hidden_api_warnings_; 561ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil } 562ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil 56392265222f1e1df56ee6d106493b1bd2be65d5ce9David Brazdil void AlwaysSetHiddenApiWarningFlag() { 56492265222f1e1df56ee6d106493b1bd2be65d5ce9David Brazdil always_set_hidden_api_warning_flag_ = true; 56592265222f1e1df56ee6d106493b1bd2be65d5ce9David Brazdil } 56692265222f1e1df56ee6d106493b1bd2be65d5ce9David Brazdil 56792265222f1e1df56ee6d106493b1bd2be65d5ce9David Brazdil bool ShouldAlwaysSetHiddenApiWarningFlag() const { 56892265222f1e1df56ee6d106493b1bd2be65d5ce9David Brazdil return always_set_hidden_api_warning_flag_; 56992265222f1e1df56ee6d106493b1bd2be65d5ce9David Brazdil } 57092265222f1e1df56ee6d106493b1bd2be65d5ce9David Brazdil 57173ddda4403c8088a730b8d456de46bb8e0307ed8Mathew Inwood void SetHiddenApiEventLogSampleRate(uint32_t rate) { 57273ddda4403c8088a730b8d456de46bb8e0307ed8Mathew Inwood hidden_api_access_event_log_rate_ = rate; 57373ddda4403c8088a730b8d456de46bb8e0307ed8Mathew Inwood } 57473ddda4403c8088a730b8d456de46bb8e0307ed8Mathew Inwood 57573ddda4403c8088a730b8d456de46bb8e0307ed8Mathew Inwood uint32_t GetHiddenApiEventLogSampleRate() const { 57673ddda4403c8088a730b8d456de46bb8e0307ed8Mathew Inwood return hidden_api_access_event_log_rate_; 57773ddda4403c8088a730b8d456de46bb8e0307ed8Mathew Inwood } 57873ddda4403c8088a730b8d456de46bb8e0307ed8Mathew Inwood 5795bcef17fcee4f535c6d39177b1c55eefea81f854Mathew Inwood const std::string& GetProcessPackageName() const { 5805bcef17fcee4f535c6d39177b1c55eefea81f854Mathew Inwood return process_package_name_; 5815bcef17fcee4f535c6d39177b1c55eefea81f854Mathew Inwood } 5825bcef17fcee4f535c6d39177b1c55eefea81f854Mathew Inwood 5835bcef17fcee4f535c6d39177b1c55eefea81f854Mathew Inwood void SetProcessPackageName(const char* package_name) { 5845bcef17fcee4f535c6d39177b1c55eefea81f854Mathew Inwood if (package_name == nullptr) { 5855bcef17fcee4f535c6d39177b1c55eefea81f854Mathew Inwood process_package_name_.clear(); 5865bcef17fcee4f535c6d39177b1c55eefea81f854Mathew Inwood } else { 5875bcef17fcee4f535c6d39177b1c55eefea81f854Mathew Inwood process_package_name_ = package_name; 5885bcef17fcee4f535c6d39177b1c55eefea81f854Mathew Inwood } 5895bcef17fcee4f535c6d39177b1c55eefea81f854Mathew Inwood } 5905bcef17fcee4f535c6d39177b1c55eefea81f854Mathew Inwood 59124e04aa68c575d349eac0d9d09aab9bd3106ef94Jean Christophe Beyler bool IsDexFileFallbackEnabled() const { 59224e04aa68c575d349eac0d9d09aab9bd3106ef94Jean Christophe Beyler return allow_dex_file_fallback_; 59324e04aa68c575d349eac0d9d09aab9bd3106ef94Jean Christophe Beyler } 59424e04aa68c575d349eac0d9d09aab9bd3106ef94Jean Christophe Beyler 595785049f8083e56e88dfeab5ff74fb3817f9854e3Dmitriy Ivanov const std::vector<std::string>& GetCpuAbilist() const { 596785049f8083e56e88dfeab5ff74fb3817f9854e3Dmitriy Ivanov return cpu_abilist_; 597785049f8083e56e88dfeab5ff74fb3817f9854e3Dmitriy Ivanov } 598785049f8083e56e88dfeab5ff74fb3817f9854e3Dmitriy Ivanov 5991e13374baf7dfaf442ffbf9809c37c131d681eafEvgenii Stepanov bool IsRunningOnMemoryTool() const { 6001e13374baf7dfaf442ffbf9809c37c131d681eafEvgenii Stepanov return is_running_on_memory_tool_; 601da44d773dedf8aae6153e3423012f236cba3bfcdMathieu Chartier } 602da44d773dedf8aae6153e3423012f236cba3bfcdMathieu Chartier 603f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao void SetTargetSdkVersion(int32_t version) { 604f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao target_sdk_version_ = version; 605f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao } 606f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao 607f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao int32_t GetTargetSdkVersion() const { 608f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao return target_sdk_version_; 609f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao } 610f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao 6115a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath uint32_t GetZygoteMaxFailedBoots() const { 6125a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath return zygote_max_failed_boots_; 6135a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath } 6145a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath 615eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light bool AreExperimentalFlagsEnabled(ExperimentalFlags flags) { 616eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light return (experimental_flags_ & flags) != ExperimentalFlags::kNone; 617158f35c98e2ec0d40d2c032b8cdce5fb60944a7fIgor Murashkin } 618158f35c98e2ec0d40d2c032b8cdce5fb60944a7fIgor Murashkin 619455f67c4cf0b4f04e117db3024fd189fa1c7dab9Mathieu Chartier // Create the JIT and instrumentation and code cache. 620e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier void CreateJit(); 621e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier 6229b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier ArenaPool* GetArenaPool() { 6239b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier return arena_pool_.get(); 6249b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier } 62525e0456b6ea13eba290b63ea88b6b7120ed89413Nicolas Geoffray ArenaPool* GetJitArenaPool() { 62625e0456b6ea13eba290b63ea88b6b7120ed89413Nicolas Geoffray return jit_arena_pool_.get(); 62725e0456b6ea13eba290b63ea88b6b7120ed89413Nicolas Geoffray } 6289b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier const ArenaPool* GetArenaPool() const { 6299b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier return arena_pool_.get(); 6309b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier } 631ca76a1a0c1737b3e04961ba382c113102fdc00bfJean-Philippe Halimi 632ca76a1a0c1737b3e04961ba382c113102fdc00bfJean-Philippe Halimi void ReclaimArenaPoolMemory(); 633ca76a1a0c1737b3e04961ba382c113102fdc00bfJean-Philippe Halimi 634c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier LinearAlloc* GetLinearAlloc() { 635c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier return linear_alloc_.get(); 636c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier } 6379b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier 638455f67c4cf0b4f04e117db3024fd189fa1c7dab9Mathieu Chartier jit::JitOptions* GetJITOptions() { 639455f67c4cf0b4f04e117db3024fd189fa1c7dab9Mathieu Chartier return jit_options_.get(); 640455f67c4cf0b4f04e117db3024fd189fa1c7dab9Mathieu Chartier } 641455f67c4cf0b4f04e117db3024fd189fa1c7dab9Mathieu Chartier 642433b79a9130df5f2375b9d3d7518c1f3fb84a467Nicolas Geoffray bool IsJavaDebuggable() const { 643433b79a9130df5f2375b9d3d7518c1f3fb84a467Nicolas Geoffray return is_java_debuggable_; 64481356645157af44152c7b7db383596b5cf3479b5Vladimir Marko } 645a0619e25aacf8b8074132f4951f75fdbcfd42925Nicolas Geoffray 646433b79a9130df5f2375b9d3d7518c1f3fb84a467Nicolas Geoffray void SetJavaDebuggable(bool value); 647433b79a9130df5f2375b9d3d7518c1f3fb84a467Nicolas Geoffray 648433b79a9130df5f2375b9d3d7518c1f3fb84a467Nicolas Geoffray // Deoptimize the boot image, called for Java debuggable apps. 649433b79a9130df5f2375b9d3d7518c1f3fb84a467Nicolas Geoffray void DeoptimizeBootImage(); 6506b16d891bdf18cabed861cd67407eef9be639efdAlex Light 651f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky bool IsNativeDebuggable() const { 652f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky return is_native_debuggable_; 653f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky } 654f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky 655f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky void SetNativeDebuggable(bool value) { 656f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky is_native_debuggable_ = value; 657f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky } 658f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky 6597919db947bc41f6f5d194c50b88d0cba47319a1cAlex Light bool AreAsyncExceptionsThrown() const { 6607919db947bc41f6f5d194c50b88d0cba47319a1cAlex Light return async_exceptions_thrown_; 6617919db947bc41f6f5d194c50b88d0cba47319a1cAlex Light } 6627919db947bc41f6f5d194c50b88d0cba47319a1cAlex Light 6637919db947bc41f6f5d194c50b88d0cba47319a1cAlex Light void SetAsyncExceptionsThrown() { 6647919db947bc41f6f5d194c50b88d0cba47319a1cAlex Light async_exceptions_thrown_ = true; 6657919db947bc41f6f5d194c50b88d0cba47319a1cAlex Light } 6667919db947bc41f6f5d194c50b88d0cba47319a1cAlex Light 667dd6712578b6aa8a292bc6249295b6d2a7b182717Andreas Gampe // Returns the build fingerprint, if set. Otherwise an empty string is returned. 668dd6712578b6aa8a292bc6249295b6d2a7b182717Andreas Gampe std::string GetFingerprint() { 669dd6712578b6aa8a292bc6249295b6d2a7b182717Andreas Gampe return fingerprint_; 670dd6712578b6aa8a292bc6249295b6d2a7b182717Andreas Gampe } 671dd6712578b6aa8a292bc6249295b6d2a7b182717Andreas Gampe 672673ed3d8aedc5462a47ded827c99f35d46525457Mathieu Chartier // Called from class linker. 673bdf7f1c3ab65ccb70f62db5ab31dba060632d458Andreas Gampe void SetSentinel(mirror::Object* sentinel) REQUIRES_SHARED(Locks::mutator_lock_); 674673ed3d8aedc5462a47ded827c99f35d46525457Mathieu Chartier 675951ec2c93c79c5539cbcc669566f0808d4460338Mathieu Chartier // Create a normal LinearAlloc or low 4gb version if we are 64 bit AOT compiler. 676951ec2c93c79c5539cbcc669566f0808d4460338Mathieu Chartier LinearAlloc* CreateLinearAlloc(); 677951ec2c93c79c5539cbcc669566f0808d4460338Mathieu Chartier 678f9c6fc610b27887f832e453a0da1789187293408Mathieu Chartier OatFileManager& GetOatFileManager() const { 679f9c6fc610b27887f832e453a0da1789187293408Mathieu Chartier DCHECK(oat_file_manager_ != nullptr); 680e58991b3b2282b5761f1a6023a16c803e1c4eb45Mathieu Chartier return *oat_file_manager_; 681f9c6fc610b27887f832e453a0da1789187293408Mathieu Chartier } 682f9c6fc610b27887f832e453a0da1789187293408Mathieu Chartier 68332cc9ee0cdffecb0ec8d80a7fd55d7dccae3a7eeMathieu Chartier double GetHashTableMinLoadFactor() const; 68432cc9ee0cdffecb0ec8d80a7fd55d7dccae3a7eeMathieu Chartier double GetHashTableMaxLoadFactor() const; 68532cc9ee0cdffecb0ec8d80a7fd55d7dccae3a7eeMathieu Chartier 686787ae8eb018d46b4b464e3a7c8de37d9262deb61Nicolas Geoffray void SetSafeMode(bool mode) { 687787ae8eb018d46b4b464e3a7c8de37d9262deb61Nicolas Geoffray safe_mode_ = mode; 688787ae8eb018d46b4b464e3a7c8de37d9262deb61Nicolas Geoffray } 689787ae8eb018d46b4b464e3a7c8de37d9262deb61Nicolas Geoffray 690a73280df8cac1279b6dea0424722f42ef0048613Nicolas Geoffray bool GetDumpNativeStackOnSigQuit() const { 691a73280df8cac1279b6dea0424722f42ef0048613Nicolas Geoffray return dump_native_stack_on_sig_quit_; 692a73280df8cac1279b6dea0424722f42ef0048613Nicolas Geoffray } 693a73280df8cac1279b6dea0424722f42ef0048613Nicolas Geoffray 694a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe bool GetPrunedDalvikCache() const { 695a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe return pruned_dalvik_cache_; 696a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe } 697a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe 698a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe void SetPrunedDalvikCache(bool pruned) { 699a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe pruned_dalvik_cache_ = pruned; 700a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe } 701a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe 702f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier void UpdateProcessState(ProcessState process_state); 703f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier 704f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier // Returns true if we currently care about long mutator pause. 705f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier bool InJankPerceptibleProcessState() const { 706f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier return process_state_ == kProcessStateJankPerceptible; 707f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier } 708f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier 70997cbc9206e9adc473a90650ebdb5d620f517ff04Calin Juravle void RegisterSensitiveThread() const; 71097cbc9206e9adc473a90650ebdb5d620f517ff04Calin Juravle 711f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe void SetZygoteNoThreadSection(bool val) { 712f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe zygote_no_threads_ = val; 713f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe } 714f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe 715f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe bool IsZygoteNoThreadSection() const { 716f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe return zygote_no_threads_; 717f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe } 718f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe 719433b79a9130df5f2375b9d3d7518c1f3fb84a467Nicolas Geoffray // Returns if the code can be deoptimized asynchronously. Code may be compiled with some 720f711f2cf3c28dfe865e36f17419a16f06a0ebb5aMingyao Yang // optimization that makes it impossible to deoptimize. 721433b79a9130df5f2375b9d3d7518c1f3fb84a467Nicolas Geoffray bool IsAsyncDeoptimizeable(uintptr_t code) const REQUIRES_SHARED(Locks::mutator_lock_); 722f711f2cf3c28dfe865e36f17419a16f06a0ebb5aMingyao Yang 723d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr // Returns a saved copy of the environment (getenv/setenv values). 724d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr // Used by Fork to protect against overwriting LD_LIBRARY_PATH, etc. 725d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr char** GetEnvSnapshot() const { 726d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr return env_snapshot_.GetSnapshot(); 727d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr } 728d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr 729fda5714edb368270b7ef639054f4cba1d5f4874cAndreas Gampe void AddSystemWeakHolder(gc::AbstractSystemWeakHolder* holder); 730fda5714edb368270b7ef639054f4cba1d5f4874cAndreas Gampe void RemoveSystemWeakHolder(gc::AbstractSystemWeakHolder* holder); 731fda5714edb368270b7ef639054f4cba1d5f4874cAndreas Gampe 73290f8addf6c68a9be6d813e5da7f6bea370a048f9Alex Light void AttachAgent(JNIEnv* env, const std::string& agent_arg, jobject class_loader); 733eb84221ffc00357be6d69e2e461c7a45ee96334aLeonard Mosescu 734aadcbc64c674995ccdaf686789c8d39ada9913adAndreas Gampe const std::list<std::unique_ptr<ti::Agent>>& GetAgents() const { 73565af20b1aaa2b23abaae3e4a21d7b6cdcb156889Alex Light return agents_; 73665af20b1aaa2b23abaae3e4a21d7b6cdcb156889Alex Light } 73765af20b1aaa2b23abaae3e4a21d7b6cdcb156889Alex Light 738ac30fa2151095d2b5fe42f169a02ed09fea312b4Andreas Gampe RuntimeCallbacks* GetRuntimeCallbacks(); 73904bbb5be5b9c0f0b3a72116353d23ea63c8bc5e9Andreas Gampe 74077fee87b262e969b29a9ac121a8bcbf87b68d9ceAlex Light bool HasLoadedPlugins() const { 74177fee87b262e969b29a9ac121a8bcbf87b68d9ceAlex Light return !plugins_.empty(); 74277fee87b262e969b29a9ac121a8bcbf87b68d9ceAlex Light } 74377fee87b262e969b29a9ac121a8bcbf87b68d9ceAlex Light 744bad529da18122c7044fbfd7d56153535d34367b1Andreas Gampe void InitThreadGroups(Thread* self); 745bad529da18122c7044fbfd7d56153535d34367b1Andreas Gampe 7461d4950167b45369299fe30d7381516c3b5380a01Mathieu Chartier void SetDumpGCPerformanceOnShutdown(bool value) { 7471d4950167b45369299fe30d7381516c3b5380a01Mathieu Chartier dump_gc_performance_on_shutdown_ = value; 7481d4950167b45369299fe30d7381516c3b5380a01Mathieu Chartier } 7491d4950167b45369299fe30d7381516c3b5380a01Mathieu Chartier 7504e92c3ce7ef354620a785553bbada554fca83a67Nicolas Geoffray void IncrementDeoptimizationCount(DeoptimizationKind kind) { 7514e92c3ce7ef354620a785553bbada554fca83a67Nicolas Geoffray DCHECK_LE(kind, DeoptimizationKind::kLast); 7524e92c3ce7ef354620a785553bbada554fca83a67Nicolas Geoffray deoptimization_counts_[static_cast<size_t>(kind)]++; 7534e92c3ce7ef354620a785553bbada554fca83a67Nicolas Geoffray } 7544e92c3ce7ef354620a785553bbada554fca83a67Nicolas Geoffray 755b9bec2e3846f3f500ca1354c849a81dfbb095b6bNicolas Geoffray uint32_t GetNumberOfDeoptimizations() const { 756b9bec2e3846f3f500ca1354c849a81dfbb095b6bNicolas Geoffray uint32_t result = 0; 757b9bec2e3846f3f500ca1354c849a81dfbb095b6bNicolas Geoffray for (size_t i = 0; i <= static_cast<size_t>(DeoptimizationKind::kLast); ++i) { 758b9bec2e3846f3f500ca1354c849a81dfbb095b6bNicolas Geoffray result += deoptimization_counts_[i]; 759b9bec2e3846f3f500ca1354c849a81dfbb095b6bNicolas Geoffray } 760b9bec2e3846f3f500ca1354c849a81dfbb095b6bNicolas Geoffray return result; 761b9bec2e3846f3f500ca1354c849a81dfbb095b6bNicolas Geoffray } 762b9bec2e3846f3f500ca1354c849a81dfbb095b6bNicolas Geoffray 763c42cb0e08a7c8f7085115e57b0ea92da9eee1575Mathieu Chartier // Whether or not we use MADV_RANDOM on files that are thought to have random access patterns. 764c42cb0e08a7c8f7085115e57b0ea92da9eee1575Mathieu Chartier // This is beneficial for low RAM devices since it reduces page cache thrashing. 765c42cb0e08a7c8f7085115e57b0ea92da9eee1575Mathieu Chartier bool MAdviseRandomAccess() const { 766c42cb0e08a7c8f7085115e57b0ea92da9eee1575Mathieu Chartier return madvise_random_access_; 767c42cb0e08a7c8f7085115e57b0ea92da9eee1575Mathieu Chartier } 768c42cb0e08a7c8f7085115e57b0ea92da9eee1575Mathieu Chartier 769403207107da7f11525c4d305184c56b35ec1c17aAlex Light const std::string& GetJdwpOptions() { 770403207107da7f11525c4d305184c56b35ec1c17aAlex Light return jdwp_options_; 771403207107da7f11525c4d305184c56b35ec1c17aAlex Light } 772403207107da7f11525c4d305184c56b35ec1c17aAlex Light 773403207107da7f11525c4d305184c56b35ec1c17aAlex Light JdwpProvider GetJdwpProvider() const { 774403207107da7f11525c4d305184c56b35ec1c17aAlex Light return jdwp_provider_; 775403207107da7f11525c4d305184c56b35ec1c17aAlex Light } 776403207107da7f11525c4d305184c56b35ec1c17aAlex Light 777a7db026ff647eefb589043dbb55bbf28637755e8David Brazdil static constexpr int32_t kUnsetSdkVersion = 0u; 778a7db026ff647eefb589043dbb55bbf28637755e8David Brazdil 779b557353b22c728eecbd1c68593b482622c7782a8Carl Shapiro private: 780457005c557b8762475db3220ce5a747d629f975bElliott Hughes static void InitPlatformSignalHandlers(); 781ffe6736397d17457188727510f0a2953f69a383aElliott Hughes 782dcc247493fd8fb243e335c3ec08e5e625896a47cElliott Hughes Runtime(); 78361e019d291583029c01b61b93bea750f2b663c37Carl Shapiro 784c1674ed06662420213441ff2b818f2f71f9098dcElliott Hughes void BlockSignals(); 785c1674ed06662420213441ff2b818f2f71f9098dcElliott Hughes 78688b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko bool Init(RuntimeArgumentMap&& runtime_options) 787b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers SHARED_TRYLOCK_FUNCTION(true, Locks::mutator_lock_); 78890443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier void InitNativeMethods() REQUIRES(!Locks::mutator_lock_); 789ff17f1fd3ff32f93e45588eb2b158832d73f9afaElliott Hughes void RegisterRuntimeNativeMethods(JNIEnv* env); 790d1cc8363d4f4bbac7568b1d02a5ca481cd10830fElliott Hughes 79185d1545e985ac689db4bad7849880e843707c862Elliott Hughes void StartDaemonThreads(); 792d1cc8363d4f4bbac7568b1d02a5ca481cd10830fElliott Hughes void StartSignalCatcher(); 79361e019d291583029c01b61b93bea750f2b663c37Carl Shapiro 79431f2c155975c5794d481df03eb0947cb48d2c6b5Calin Juravle void MaybeSaveJitProfilingInfo(); 79531f2c155975c5794d481df03eb0947cb48d2c6b5Calin Juravle 796585da955bc8e5040705dcfd941b2131025ebcef8Andreas Gampe // Visit all of the thread roots. 797585da955bc8e5040705dcfd941b2131025ebcef8Andreas Gampe void VisitThreadRoots(RootVisitor* visitor, VisitRootFlags flags) 798585da955bc8e5040705dcfd941b2131025ebcef8Andreas Gampe REQUIRES_SHARED(Locks::mutator_lock_); 799585da955bc8e5040705dcfd941b2131025ebcef8Andreas Gampe 800585da955bc8e5040705dcfd941b2131025ebcef8Andreas Gampe // Visit all other roots which must be done with mutators suspended. 801585da955bc8e5040705dcfd941b2131025ebcef8Andreas Gampe void VisitNonConcurrentRoots(RootVisitor* visitor, VisitRootFlags flags) 802585da955bc8e5040705dcfd941b2131025ebcef8Andreas Gampe REQUIRES_SHARED(Locks::mutator_lock_); 803585da955bc8e5040705dcfd941b2131025ebcef8Andreas Gampe 804585da955bc8e5040705dcfd941b2131025ebcef8Andreas Gampe // Constant roots are the roots which never change after the runtime is initialized, they only 805585da955bc8e5040705dcfd941b2131025ebcef8Andreas Gampe // need to be visited once per GC cycle. 806585da955bc8e5040705dcfd941b2131025ebcef8Andreas Gampe void VisitConstantRoots(RootVisitor* visitor) 807585da955bc8e5040705dcfd941b2131025ebcef8Andreas Gampe REQUIRES_SHARED(Locks::mutator_lock_); 808585da955bc8e5040705dcfd941b2131025ebcef8Andreas Gampe 8092cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier // A pointer to the active runtime or null. 810b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes static Runtime* instance_; 811b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes 8128afeb85d3def12b559b7565fb6d3956f81b55132Ian Rogers // NOTE: these must match the gc::ProcessState values as they come directly from the framework. 8138afeb85d3def12b559b7565fb6d3956f81b55132Ian Rogers static constexpr int kProfileForground = 0; 81431f2c155975c5794d481df03eb0947cb48d2c6b5Calin Juravle static constexpr int kProfileBackground = 1; 8158afeb85d3def12b559b7565fb6d3956f81b55132Ian Rogers 8160a87a653a296854c9a0abacd9bb1557ee4c4d05dMingyao Yang static constexpr uint32_t kCalleeSaveSize = 6u; 8178228cdf4ad6322ec8133564aaa51f966d36c0f17Andreas Gampe 818e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier // 64 bit so that we can share the same asm offsets for both 32 and 64 bits. 8198228cdf4ad6322ec8133564aaa51f966d36c0f17Andreas Gampe uint64_t callee_save_methods_[kCalleeSaveSize]; 82094f7b49578b6aaa80de8ffed230648d601393905Hiroshi Yamauchi GcRoot<mirror::Throwable> pre_allocated_OutOfMemoryError_; 82163557459a4098294a9ff44d035241de2966047c0Ian Rogers GcRoot<mirror::Throwable> pre_allocated_NoClassDefFoundError_; 822e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier ArtMethod* resolution_method_; 823e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier ArtMethod* imt_conflict_method_; 8242d2621a1463d2f3f03fa73503fa42e43657cdcfcMathieu Chartier // Unresolved method has the same behavior as the conflict method, it is used by the class linker 8252d2621a1463d2f3f03fa73503fa42e43657cdcfcMathieu Chartier // for differentiating between unfilled imt slots vs conflict slots in superclasses. 826e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier ArtMethod* imt_unimplemented_method_; 8276ed19fd1b08abbc438781ae3e6fea111c1f92315Ian Rogers 828c0542af3e2170143ba40d89136e284997e16bf64Ian Rogers // Special sentinel object used to invalid conditions in JNI (cleared weak references) and 829c0542af3e2170143ba40d89136e284997e16bf64Ian Rogers // JDWP (invalid references). 830c0542af3e2170143ba40d89136e284997e16bf64Ian Rogers GcRoot<mirror::Object> sentinel_; 831c0542af3e2170143ba40d89136e284997e16bf64Ian Rogers 8327624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko InstructionSet instruction_set_; 8338228cdf4ad6322ec8133564aaa51f966d36c0f17Andreas Gampe QuickMethodFrameInfo callee_save_method_frame_infos_[kCalleeSaveSize]; 8347624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko 8352b5eaa2b49f7489bafdadc4b4463ae27e4261817Vladimir Marko CompilerCallbacks* compiler_callbacks_; 8369ca7a1fdd0daa546b790adb6a24dbc13c22df76aElliott Hughes bool is_zygote_; 837a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light bool must_relocate_; 838069387a60cb2b72e116cc38b32e14403f092df8fMathieu Chartier bool is_concurrent_gc_enabled_; 8398718359763aa3dcd0033a2d2e67e0cb145fb9c53Anwar Ghuloum bool is_explicit_gc_disabled_; 8404fcdc94d22a4608e355aa8df36240181149d10e8Nicolas Geoffray bool dex2oat_enabled_; 84164ad14dbe2225441fb7734bf6d89358d96692eeaAlex Light bool image_dex2oat_enabled_; 8420a5b14de5115f51e0ed2dd6c3fcc5b84bbce690eBrian Carlstrom 84312e6d7446384a7a5fbec25fe116bbb271c62842eTsu Chiang Chuang std::string compiler_executable_; 844a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light std::string patchoat_executable_; 8456449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom std::vector<std::string> compiler_options_; 8466449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom std::vector<std::string> image_compiler_options_; 84731d8f5295c24730a57cb36cbc41197f0b7e8397cBrian Carlstrom std::string image_location_; 8487467ee05012e1fd9834df74663c1ebda46f5636bDragos Sbirlea 849a004aa933a58428489e42d77f707c2b063b73747Brian Carlstrom std::string boot_class_path_string_; 850a004aa933a58428489e42d77f707c2b063b73747Brian Carlstrom std::string class_path_string_; 8517ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes std::vector<std::string> properties_; 8527ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes 853aadcbc64c674995ccdaf686789c8d39ada9913adAndreas Gampe std::list<ti::AgentSpec> agent_specs_; 854aadcbc64c674995ccdaf686789c8d39ada9913adAndreas Gampe std::list<std::unique_ptr<ti::Agent>> agents_; 855185d134a3b43ab7529053e965917e0fa74bceba4Alex Light std::vector<Plugin> plugins_; 8567233c7e752c0d26387d143ee74420e9cd1f09390Alex Light 857b765be0d656c3073402693aeaf64e95a0e49f218Brian Carlstrom // The default stack size for managed threads created by the runtime. 858be759c63c6bb58b76ac71cad2c5a736bd31f374dElliott Hughes size_t default_stack_size_; 859b765be0d656c3073402693aeaf64e95a0e49f218Brian Carlstrom 8601d54e73444e017d3a65234e0f193846f3e27472bIan Rogers gc::Heap* heap_; 861b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes 86225e0456b6ea13eba290b63ea88b6b7120ed89413Nicolas Geoffray std::unique_ptr<ArenaPool> jit_arena_pool_; 8639b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier std::unique_ptr<ArenaPool> arena_pool_; 864c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier // Special low 4gb pool for compiler linear alloc. We need ArtFields to be in low 4gb if we are 865c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier // compiling using a 32 bit image on a 64 bit compiler in case we resolve things in the image 866c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier // since the field arrays are int arrays in this case. 867c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier std::unique_ptr<ArenaPool> low_4gb_arena_pool_; 868c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier 869c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier // Shared linear alloc for now. 870c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier std::unique_ptr<LinearAlloc> linear_alloc_; 8719b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier 872d9c4fc94fa618617f94e1de9af5f034549100753Ian Rogers // The number of spins that are done before thread suspension is used to forcibly inflate. 873d9c4fc94fa618617f94e1de9af5f034549100753Ian Rogers size_t max_spins_before_thin_lock_inflation_; 874c33a32bccc4c66ed82ce3a580b16636399385cb4Elliott Hughes MonitorList* monitor_list_; 875ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers MonitorPool* monitor_pool_; 876c33a32bccc4c66ed82ce3a580b16636399385cb4Elliott Hughes 877b557353b22c728eecbd1c68593b482622c7782a8Carl Shapiro ThreadList* thread_list_; 87861e019d291583029c01b61b93bea750f2b663c37Carl Shapiro 879cf4c6c41b0084dc4567ff709fb8ce9ebd72b26acElliott Hughes InternTable* intern_table_; 880cf4c6c41b0084dc4567ff709fb8ce9ebd72b26acElliott Hughes 881b0460eaa2cb131f1dbdd5a7217bd36b9a9f1b995Brian Carlstrom ClassLinker* class_linker_; 882b0460eaa2cb131f1dbdd5a7217bd36b9a9f1b995Brian Carlstrom 883e27955ca3ca960928d4dbd6cb79711fce06950b3Elliott Hughes SignalCatcher* signal_catcher_; 884eb71033745325ffd5682fe7a6a48900e74657b02Narayan Kamath 885eb71033745325ffd5682fe7a6a48900e74657b02Narayan Kamath // If true, the runtime will connect to tombstoned via a socket to 886eb71033745325ffd5682fe7a6a48900e74657b02Narayan Kamath // request an open file descriptor to write its traces to. 887eb71033745325ffd5682fe7a6a48900e74657b02Narayan Kamath bool use_tombstoned_traces_; 888eb71033745325ffd5682fe7a6a48900e74657b02Narayan Kamath 889eb71033745325ffd5682fe7a6a48900e74657b02Narayan Kamath // Location to which traces must be written on SIGQUIT. Only used if 890eb71033745325ffd5682fe7a6a48900e74657b02Narayan Kamath // tombstoned_traces_ == false. 89194ce37a3919a0bdb8855a3d3264a50df1dbc41beElliott Hughes std::string stack_trace_file_; 892e27955ca3ca960928d4dbd6cb79711fce06950b3Elliott Hughes 893da0a69edb24122d3d35ce1483c5ab94de919d714Richard Uhler std::unique_ptr<JavaVMExt> java_vm_; 894f2682d5a6ce0f7de58da8fd4ec8aec200c43b92eElliott Hughes 895e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier std::unique_ptr<jit::Jit> jit_; 896e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier std::unique_ptr<jit::JitOptions> jit_options_; 897e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier 89815d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier // Fault message, printed when we get a SIGSEGV. 89915d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier Mutex fault_message_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; 90015d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier std::string fault_message_ GUARDED_BY(fault_message_lock_); 90115d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier 902120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers // A non-zero value indicates that a thread has been created but not yet initialized. Guarded by 903120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers // the shutdown lock so that threads aren't born while we're shutting down. 904120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers size_t threads_being_born_ GUARDED_BY(Locks::runtime_shutdown_lock_); 905120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers 906120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers // Waited upon until no threads are being born. 907700a402244a1a423da4f3ba8032459f4b65fa18fIan Rogers std::unique_ptr<ConditionVariable> shutdown_cond_ GUARDED_BY(Locks::runtime_shutdown_lock_); 908120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers 909120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers // Set when runtime shutdown is past the point that new threads may attach. 910120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers bool shutting_down_ GUARDED_BY(Locks::runtime_shutdown_lock_); 911120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers 912120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers // The runtime is starting to shutdown but is blocked waiting on shutdown_cond_. 913120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers bool shutting_down_started_ GUARDED_BY(Locks::runtime_shutdown_lock_); 914120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers 915dcc247493fd8fb243e335c3ec08e5e625896a47cElliott Hughes bool started_; 916dcc247493fd8fb243e335c3ec08e5e625896a47cElliott Hughes 9177664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier // New flag added which tells us if the runtime has finished starting. If 9187664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier // this flag is set then the Daemon threads are created and the class loader 9197664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier // is created. This flag is needed for knowing if its safe to request CMS. 9207664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier bool finished_starting_; 9217664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier 9226ea095ad30bf13cc00b4fee7afbbe4731a349c83Brian Carlstrom // Hooks supported by JNI_CreateJavaVM 9236ea095ad30bf13cc00b4fee7afbbe4731a349c83Brian Carlstrom jint (*vfprintf_)(FILE* stream, const char* format, va_list ap); 9246ea095ad30bf13cc00b4fee7afbbe4731a349c83Brian Carlstrom void (*exit_)(jint status); 9256ea095ad30bf13cc00b4fee7afbbe4731a349c83Brian Carlstrom void (*abort_)(); 9266ea095ad30bf13cc00b4fee7afbbe4731a349c83Brian Carlstrom 9279d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes bool stats_enabled_; 9289d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes RuntimeStats stats_; 9299d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes 9301e13374baf7dfaf442ffbf9809c37c131d681eafEvgenii Stepanov const bool is_running_on_memory_tool_; 931da44d773dedf8aae6153e3423012f236cba3bfcdMathieu Chartier 932f6a780abeaed4bf745720e8f836a3064d3ffbec4Andreas Gampe std::unique_ptr<TraceConfig> trace_config_; 933f6a780abeaed4bf745720e8f836a3064d3ffbec4Andreas Gampe 93462d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers instrumentation::Instrumentation instrumentation_; 935131aef8c94292cc530da2fd91ee98d1432352959Elliott Hughes 936365c10235438607541fa2259a5fec48061b90bd8Ian Rogers jobject main_thread_group_; 937365c10235438607541fa2259a5fec48061b90bd8Ian Rogers jobject system_thread_group_; 938365c10235438607541fa2259a5fec48061b90bd8Ian Rogers 939ce88853ab316c70ef7b598978a3609611db60552Brian Carlstrom // As returned by ClassLoader.getSystemClassLoader(). 940ce88853ab316c70ef7b598978a3609611db60552Brian Carlstrom jobject system_class_loader_; 941ce88853ab316c70ef7b598978a3609611db60552Brian Carlstrom 9422e899a92439dc6bdaaa67b8230933006284aa600Hiroshi Yamauchi // If true, then we dump the GC cumulative timings on shutdown. 9432e899a92439dc6bdaaa67b8230933006284aa600Hiroshi Yamauchi bool dump_gc_performance_on_shutdown_; 9442e899a92439dc6bdaaa67b8230933006284aa600Hiroshi Yamauchi 945605fe24d07062a038c8332a4d98f47052e9cee6aChang Xing // Transactions used for pre-initializing classes at compilation time. 946605fe24d07062a038c8332a4d98f47052e9cee6aChang Xing // Support nested transactions, maintain a list containing all transactions. Transactions are 947605fe24d07062a038c8332a4d98f47052e9cee6aChang Xing // handled under a stack discipline. Because GC needs to go over all transactions, we choose list 948605fe24d07062a038c8332a4d98f47052e9cee6aChang Xing // as substantial data structure instead of stack. 949605fe24d07062a038c8332a4d98f47052e9cee6aChang Xing std::list<std::unique_ptr<Transaction>> preinitialization_transactions_; 950d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertz 9517617abdb402fd0419daa3eefb2ad059ccbb8b6dbIgor Murashkin // If kNone, verification is disabled. kEnable by default. 9527617abdb402fd0419daa3eefb2ad059ccbb8b6dbIgor Murashkin verifier::VerifyMode verify_; 9534a200f56b7075309316b04d550c9cc50f8314eddJeff Hao 95424e04aa68c575d349eac0d9d09aab9bd3106ef94Jean Christophe Beyler // If true, the runtime may use dex files directly with the interpreter if an oat file is not 95524e04aa68c575d349eac0d9d09aab9bd3106ef94Jean Christophe Beyler // available/usable. 95624e04aa68c575d349eac0d9d09aab9bd3106ef94Jean Christophe Beyler bool allow_dex_file_fallback_; 95724e04aa68c575d349eac0d9d09aab9bd3106ef94Jean Christophe Beyler 958785049f8083e56e88dfeab5ff74fb3817f9854e3Dmitriy Ivanov // List of supported cpu abis. 959785049f8083e56e88dfeab5ff74fb3817f9854e3Dmitriy Ivanov std::vector<std::string> cpu_abilist_; 960785049f8083e56e88dfeab5ff74fb3817f9854e3Dmitriy Ivanov 961f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao // Specifies target SDK version to allow workarounds for certain API levels. 962f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao int32_t target_sdk_version_; 963f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao 96469dfe51b684dd9d510dbcb63295fe180f998efdeDave Allison // Implicit checks flags. 96569dfe51b684dd9d510dbcb63295fe180f998efdeDave Allison bool implicit_null_checks_; // NullPointer checks are implicit. 96669dfe51b684dd9d510dbcb63295fe180f998efdeDave Allison bool implicit_so_checks_; // StackOverflow checks are implicit. 96769dfe51b684dd9d510dbcb63295fe180f998efdeDave Allison bool implicit_suspend_checks_; // Thread suspension checks are implicit. 96869dfe51b684dd9d510dbcb63295fe180f998efdeDave Allison 96901aaf6ef3e3e35cc8e41cf3fe899a7bf337042f4Calin Juravle // Whether or not the sig chain (and implicitly the fault handler) should be 97001aaf6ef3e3e35cc8e41cf3fe899a7bf337042f4Calin Juravle // disabled. Tools like dex2oat or patchoat don't need them. This enables 97101aaf6ef3e3e35cc8e41cf3fe899a7bf337042f4Calin Juravle // building a statically link version of dex2oat. 97201aaf6ef3e3e35cc8e41cf3fe899a7bf337042f4Calin Juravle bool no_sig_chain_; 97301aaf6ef3e3e35cc8e41cf3fe899a7bf337042f4Calin Juravle 974d3e7c6c76f564b58e66010c30b62bb56ef046f2cCalin Juravle // Force the use of native bridge even if the app ISA matches the runtime ISA. 975d3e7c6c76f564b58e66010c30b62bb56ef046f2cCalin Juravle bool force_native_bridge_; 976d3e7c6c76f564b58e66010c30b62bb56ef046f2cCalin Juravle 97707d83c7a25022064ac0a8dac4fe2a7a38681fa4bCalin Juravle // Whether or not a native bridge has been loaded. 978c8423521c1d1136c70b153479b7df3bf4fd7fc2aCalin Juravle // 979c8423521c1d1136c70b153479b7df3bf4fd7fc2aCalin Juravle // The native bridge allows running native code compiled for a foreign ISA. The way it works is, 980c8423521c1d1136c70b153479b7df3bf4fd7fc2aCalin Juravle // if standard dlopen fails to load native library associated with native activity, it calls to 981c8423521c1d1136c70b153479b7df3bf4fd7fc2aCalin Juravle // the native bridge to load it and then gets the trampoline for the entry to native activity. 98207d83c7a25022064ac0a8dac4fe2a7a38681fa4bCalin Juravle // 98307d83c7a25022064ac0a8dac4fe2a7a38681fa4bCalin Juravle // The option 'native_bridge_library_filename' specifies the name of the native bridge. 98407d83c7a25022064ac0a8dac4fe2a7a38681fa4bCalin Juravle // When non-empty the native bridge will be loaded from the given file. An empty value means 98507d83c7a25022064ac0a8dac4fe2a7a38681fa4bCalin Juravle // that there's no native bridge. 98607d83c7a25022064ac0a8dac4fe2a7a38681fa4bCalin Juravle bool is_native_bridge_loaded_; 987c8423521c1d1136c70b153479b7df3bf4fd7fc2aCalin Juravle 988f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky // Whether we are running under native debugger. 989f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky bool is_native_debuggable_; 990f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky 9917919db947bc41f6f5d194c50b88d0cba47319a1cAlex Light // whether or not any async exceptions have ever been thrown. This is used to speed up the 9927919db947bc41f6f5d194c50b88d0cba47319a1cAlex Light // MterpShouldSwitchInterpreters function. 9937919db947bc41f6f5d194c50b88d0cba47319a1cAlex Light bool async_exceptions_thrown_; 9947919db947bc41f6f5d194c50b88d0cba47319a1cAlex Light 995433b79a9130df5f2375b9d3d7518c1f3fb84a467Nicolas Geoffray // Whether Java code needs to be debuggable. 996433b79a9130df5f2375b9d3d7518c1f3fb84a467Nicolas Geoffray bool is_java_debuggable_; 9976b16d891bdf18cabed861cd67407eef9be639efdAlex Light 9985a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath // The maximum number of failed boots we allow before pruning the dalvik cache 9995a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath // and trying again. This option is only inspected when we're running as a 10005a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath // zygote. 10015a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath uint32_t zygote_max_failed_boots_; 10025a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath 1003158f35c98e2ec0d40d2c032b8cdce5fb60944a7fIgor Murashkin // Enable experimental opcodes that aren't fully specified yet. The intent is to 1004158f35c98e2ec0d40d2c032b8cdce5fb60944a7fIgor Murashkin // eventually publish them as public-usable opcodes, but they aren't ready yet. 1005158f35c98e2ec0d40d2c032b8cdce5fb60944a7fIgor Murashkin // 1006158f35c98e2ec0d40d2c032b8cdce5fb60944a7fIgor Murashkin // Experimental opcodes should not be used by other production code. 1007eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light ExperimentalFlags experimental_flags_; 1008158f35c98e2ec0d40d2c032b8cdce5fb60944a7fIgor Murashkin 1009dd6712578b6aa8a292bc6249295b6d2a7b182717Andreas Gampe // Contains the build fingerprint, if given as a parameter. 1010dd6712578b6aa8a292bc6249295b6d2a7b182717Andreas Gampe std::string fingerprint_; 1011dd6712578b6aa8a292bc6249295b6d2a7b182717Andreas Gampe 1012f9c6fc610b27887f832e453a0da1789187293408Mathieu Chartier // Oat file manager, keeps track of what oat files are open. 1013e58991b3b2282b5761f1a6023a16c803e1c4eb45Mathieu Chartier OatFileManager* oat_file_manager_; 1014f9c6fc610b27887f832e453a0da1789187293408Mathieu Chartier 101532cc9ee0cdffecb0ec8d80a7fd55d7dccae3a7eeMathieu Chartier // Whether or not we are on a low RAM device. 101632cc9ee0cdffecb0ec8d80a7fd55d7dccae3a7eeMathieu Chartier bool is_low_memory_mode_; 101732cc9ee0cdffecb0ec8d80a7fd55d7dccae3a7eeMathieu Chartier 1018c42cb0e08a7c8f7085115e57b0ea92da9eee1575Mathieu Chartier // Whether or not we use MADV_RANDOM on files that are thought to have random access patterns. 1019c42cb0e08a7c8f7085115e57b0ea92da9eee1575Mathieu Chartier // This is beneficial for low RAM devices since it reduces page cache thrashing. 1020c42cb0e08a7c8f7085115e57b0ea92da9eee1575Mathieu Chartier bool madvise_random_access_; 1021c42cb0e08a7c8f7085115e57b0ea92da9eee1575Mathieu Chartier 1022787ae8eb018d46b4b464e3a7c8de37d9262deb61Nicolas Geoffray // Whether the application should run in safe mode, that is, interpreter only. 1023787ae8eb018d46b4b464e3a7c8de37d9262deb61Nicolas Geoffray bool safe_mode_; 1024787ae8eb018d46b4b464e3a7c8de37d9262deb61Nicolas Geoffray 10253e0fa0aa5d929737f1d1c4bac07e2695ac438324David Brazdil // Whether access checks on hidden API should be performed. 1026a5dc52c023be28850e4d7422655d96771cb472f5Mathew Inwood hiddenapi::EnforcementPolicy hidden_api_policy_; 10273e0fa0aa5d929737f1d1c4bac07e2695ac438324David Brazdil 1028c8ce5f520d2ba84ff8f393f78ba953ae6d467ca8Mathew Inwood // List of signature prefixes of methods that have been removed from the blacklist, and treated 1029c8ce5f520d2ba84ff8f393f78ba953ae6d467ca8Mathew Inwood // as if whitelisted. 10303383aa5cc3bac56576cf48086183f59ac4de279eMathew Inwood std::vector<std::string> hidden_api_exemptions_; 10313383aa5cc3bac56576cf48086183f59ac4de279eMathew Inwood 1032ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil // Whether the application has used an API which is not restricted but we 1033ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil // should issue a warning about it. 1034ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil bool pending_hidden_api_warning_; 1035ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil 1036ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil // Do not warn about the same hidden API access violation twice. 1037ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil // This is only used for testing. 1038ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil bool dedupe_hidden_api_warnings_; 1039ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4bDavid Brazdil 104092265222f1e1df56ee6d106493b1bd2be65d5ce9David Brazdil // Hidden API can print warnings into the log and/or set a flag read by the 104192265222f1e1df56ee6d106493b1bd2be65d5ce9David Brazdil // framework to show a UI warning. If this flag is set, always set the flag 104292265222f1e1df56ee6d106493b1bd2be65d5ce9David Brazdil // when there is a warning. This is only used for testing. 104392265222f1e1df56ee6d106493b1bd2be65d5ce9David Brazdil bool always_set_hidden_api_warning_flag_; 104492265222f1e1df56ee6d106493b1bd2be65d5ce9David Brazdil 10455bcef17fcee4f535c6d39177b1c55eefea81f854Mathew Inwood // How often to log hidden API access to the event log. An integer between 0 10465bcef17fcee4f535c6d39177b1c55eefea81f854Mathew Inwood // (never) and 0x10000 (always). 104773ddda4403c8088a730b8d456de46bb8e0307ed8Mathew Inwood uint32_t hidden_api_access_event_log_rate_; 104873ddda4403c8088a730b8d456de46bb8e0307ed8Mathew Inwood 10495bcef17fcee4f535c6d39177b1c55eefea81f854Mathew Inwood // The package of the app running in this process. 10505bcef17fcee4f535c6d39177b1c55eefea81f854Mathew Inwood std::string process_package_name_; 10515bcef17fcee4f535c6d39177b1c55eefea81f854Mathew Inwood 1052a73280df8cac1279b6dea0424722f42ef0048613Nicolas Geoffray // Whether threads should dump their native stack on SIGQUIT. 1053a73280df8cac1279b6dea0424722f42ef0048613Nicolas Geoffray bool dump_native_stack_on_sig_quit_; 1054a73280df8cac1279b6dea0424722f42ef0048613Nicolas Geoffray 1055a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe // Whether the dalvik cache was pruned when initializing the runtime. 1056a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe bool pruned_dalvik_cache_; 1057a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe 1058f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier // Whether or not we currently care about pause times. 1059f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier ProcessState process_state_; 1060f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier 1061f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe // Whether zygote code is in a section that should not start threads. 1062f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe bool zygote_no_threads_; 1063f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe 1064403207107da7f11525c4d305184c56b35ec1c17aAlex Light // The string containing requested jdwp options 1065403207107da7f11525c4d305184c56b35ec1c17aAlex Light std::string jdwp_options_; 1066403207107da7f11525c4d305184c56b35ec1c17aAlex Light 1067403207107da7f11525c4d305184c56b35ec1c17aAlex Light // The jdwp provider we were configured with. 1068403207107da7f11525c4d305184c56b35ec1c17aAlex Light JdwpProvider jdwp_provider_; 1069403207107da7f11525c4d305184c56b35ec1c17aAlex Light 1070d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr // Saved environment. 1071d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr class EnvSnapshot { 1072d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr public: 1073d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr EnvSnapshot() = default; 1074d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr void TakeSnapshot(); 1075d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr char** GetSnapshot() const; 1076d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr 1077d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr private: 1078d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr std::unique_ptr<char*[]> c_env_vector_; 1079d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr std::vector<std::unique_ptr<std::string>> name_value_pairs_; 1080d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr 1081d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr DISALLOW_COPY_AND_ASSIGN(EnvSnapshot); 1082d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr } env_snapshot_; 1083d106d9f871c957286ccdeb79c1c2a5ed41f859a6David Sehr 1084fda5714edb368270b7ef639054f4cba1d5f4874cAndreas Gampe // Generic system-weak holders. 1085fda5714edb368270b7ef639054f4cba1d5f4874cAndreas Gampe std::vector<gc::AbstractSystemWeakHolder*> system_weak_holders_; 1086fda5714edb368270b7ef639054f4cba1d5f4874cAndreas Gampe 1087ac30fa2151095d2b5fe42f169a02ed09fea312b4Andreas Gampe std::unique_ptr<RuntimeCallbacks> callbacks_; 108804bbb5be5b9c0f0b3a72116353d23ea63c8bc5e9Andreas Gampe 108981cc43e7d3c4dcd197b3d3a0fa9d1a3be9413367Nicolas Geoffray std::atomic<uint32_t> deoptimization_counts_[ 109081cc43e7d3c4dcd197b3d3a0fa9d1a3be9413367Nicolas Geoffray static_cast<uint32_t>(DeoptimizationKind::kLast) + 1]; 10914e92c3ce7ef354620a785553bbada554fca83a67Nicolas Geoffray 10922ac67d526eb348019433138b04eb1473d45cb0f4Andreas Gampe std::unique_ptr<MemMap> protected_fault_page_; 10932ac67d526eb348019433138b04eb1473d45cb0f4Andreas Gampe 109461e019d291583029c01b61b93bea750f2b663c37Carl Shapiro DISALLOW_COPY_AND_ASSIGN(Runtime); 10957b21670581d13db32f1384a3b2692bcfc8f57320Carl Shapiro}; 10967b21670581d13db32f1384a3b2692bcfc8f57320Carl Shapiro 10976b6b5f0e67ce03f38223a525612955663bc1799bCarl Shapiro} // namespace art 10987b21670581d13db32f1384a3b2692bcfc8f57320Carl Shapiro 1099fc0e3219edc9a5bf81b166e82fd5db2796eb6a0dBrian Carlstrom#endif // ART_RUNTIME_RUNTIME_H_ 1100