runtime.h revision 97cbc9206e9adc473a90650ebdb5d620f517ff04
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>
276ea095ad30bf13cc00b4fee7afbbe4731a349c83Brian Carlstrom#include <vector>
28578bbdc684db8ed68e9fedbc678669d27fa68b6eBrian Carlstrom
29d582fa4ea62083a7598dded5b82dc2198b3daac7Ian Rogers#include "arch/instruction_set.h"
30794ad76e8d5b5b9132819d5b08a0570e27615644Andreas Gampe#include "base/macros.h"
31eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light#include "experimental_flags.h"
3294f7b49578b6aaa80de8ffed230648d601393905Hiroshi Yamauchi#include "gc_root.h"
3362d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers#include "instrumentation.h"
3400f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers#include "jobject_comparator.h"
35848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff Hao#include "method_reference.h"
3683c8ee000d525017ead8753fce6bc1020249b96aMathieu Chartier#include "object_callbacks.h"
37576ca0cd692c0b6ae70e776de91015b8ff000a08Ian Rogers#include "offsets.h"
38f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier#include "process_state.h"
39c1b643cc6ac45dbd0eabdcd7425c7e86006c27d6Calin Juravle#include "profiler_options.h"
407624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko#include "quick/quick_method_frame_info.h"
419d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes#include "runtime_stats.h"
42a0e180632411f7fe0edf454e571c42209ee7b540Elliott Hughes#include "safe_map.h"
43b557353b22c728eecbd1c68593b482622c7782a8Carl Shapiro
446b6b5f0e67ce03f38223a525612955663bc1799bCarl Shapironamespace art {
457b21670581d13db32f1384a3b2692bcfc8f57320Carl Shapiro
461d54e73444e017d3a65234e0f193846f3e27472bIan Rogersnamespace gc {
471d54e73444e017d3a65234e0f193846f3e27472bIan Rogers  class Heap;
482cd334ae2d4287216523882f0d298cf3901b7ab1Hiroshi Yamauchi  namespace collector {
492cd334ae2d4287216523882f0d298cf3901b7ab1Hiroshi Yamauchi    class GarbageCollector;
502cd334ae2d4287216523882f0d298cf3901b7ab1Hiroshi Yamauchi  }  // namespace collector
51576ca0cd692c0b6ae70e776de91015b8ff000a08Ian Rogers}  // namespace gc
52e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier
53e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartiernamespace jit {
54e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier  class Jit;
55e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier  class JitOptions;
56e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier}  // namespace jit
57e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier
58e2facc5b18cd756a8b5500fb3d90da69c9ee0fb7Igor Murashkinnamespace lambda {
59e2facc5b18cd756a8b5500fb3d90da69c9ee0fb7Igor Murashkin  class BoxTable;
60e2facc5b18cd756a8b5500fb3d90da69c9ee0fb7Igor Murashkin}  // namespace lambda
61e2facc5b18cd756a8b5500fb3d90da69c9ee0fb7Igor Murashkin
622dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogersnamespace mirror {
631d54e73444e017d3a65234e0f193846f3e27472bIan Rogers  class ClassLoader;
64d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertz  class Array;
6588474b416eb257078e590bf9bc7957cee604a186Jeff Hao  template<class T> class ObjectArray;
661d54e73444e017d3a65234e0f193846f3e27472bIan Rogers  template<class T> class PrimitiveArray;
671d54e73444e017d3a65234e0f193846f3e27472bIan Rogers  typedef PrimitiveArray<int8_t> ByteArray;
681d54e73444e017d3a65234e0f193846f3e27472bIan Rogers  class String;
691d54e73444e017d3a65234e0f193846f3e27472bIan Rogers  class Throwable;
702dd0e2cea360bc9206eb88ecc40d259e796c239dIan Rogers}  // namespace mirror
71c528dba35b5faece51ca658fc008b688f8b690adMathieu Chartiernamespace verifier {
726a3c1fcb4ba42ad4d5d142c17a3712a6ddd3866fIan Rogers  class MethodVerifier;
737617abdb402fd0419daa3eefb2ad059ccbb8b6dbIgor Murashkin  enum class VerifyMode : int8_t;
746a3c1fcb4ba42ad4d5d142c17a3712a6ddd3866fIan Rogers}  // namespace verifier
75e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartierclass ArenaPool;
76e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartierclass ArtMethod;
7761e019d291583029c01b61b93bea750f2b663c37Carl Shapiroclass ClassLinker;
782cd334ae2d4287216523882f0d298cf3901b7ab1Hiroshi Yamauchiclass Closure;
79e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartierclass CompilerCallbacks;
80fc322c72d7a89a6f7a05c8bdc232d780aecd9232Carl Shapiroclass DexFile;
81cf4c6c41b0084dc4567ff709fb8ce9ebd72b26acElliott Hughesclass InternTable;
82b48b9eb6d181a1f52e2e605cf26a21505f1d46edIan Rogersclass JavaVMExt;
83e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartierclass LinearAlloc;
84c33a32bccc4c66ed82ce3a580b16636399385cb4Elliott Hughesclass MonitorList;
85ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogersclass MonitorPool;
86576ca0cd692c0b6ae70e776de91015b8ff000a08Ian Rogersclass NullPointerHandler;
87f9c6fc610b27887f832e453a0da1789187293408Mathieu Chartierclass OatFileManager;
8888b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Markostruct RuntimeArgumentMap;
89e27955ca3ca960928d4dbd6cb79711fce06950b3Elliott Hughesclass SignalCatcher;
90576ca0cd692c0b6ae70e776de91015b8ff000a08Ian Rogersclass StackOverflowHandler;
91576ca0cd692c0b6ae70e776de91015b8ff000a08Ian Rogersclass SuspensionHandler;
9261e019d291583029c01b61b93bea750f2b663c37Carl Shapiroclass ThreadList;
932692b573a56cd63a3c8c8aa1636e3766b6d8c9c4jeffhaoclass Trace;
94f6a780abeaed4bf745720e8f836a3064d3ffbec4Andreas Gampestruct TraceConfig;
95d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertzclass Transaction;
9661e019d291583029c01b61b93bea750f2b663c37Carl Shapiro
97e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogerstypedef std::vector<std::pair<std::string, const void*>> RuntimeOptions;
98e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogers
99661974a5561e5ccdfbac8cb5d8df8b7e6f3483b8Mathieu Chartier// Not all combinations of flags are valid. You may not visit all roots as well as the new roots
100661974a5561e5ccdfbac8cb5d8df8b7e6f3483b8Mathieu Chartier// (no logical reason to do this). You also may not start logging new roots and stop logging new
101661974a5561e5ccdfbac8cb5d8df8b7e6f3483b8Mathieu Chartier// roots (also no logical reason to do this).
102893263b7d5bc2ca43a91ecb8071867f5134fc60aMathieu Chartierenum VisitRootFlags : uint8_t {
103893263b7d5bc2ca43a91ecb8071867f5134fc60aMathieu Chartier  kVisitRootFlagAllRoots = 0x1,
104893263b7d5bc2ca43a91ecb8071867f5134fc60aMathieu Chartier  kVisitRootFlagNewRoots = 0x2,
105893263b7d5bc2ca43a91ecb8071867f5134fc60aMathieu Chartier  kVisitRootFlagStartLoggingNewRoots = 0x4,
106893263b7d5bc2ca43a91ecb8071867f5134fc60aMathieu Chartier  kVisitRootFlagStopLoggingNewRoots = 0x8,
107893263b7d5bc2ca43a91ecb8071867f5134fc60aMathieu Chartier  kVisitRootFlagClearRootLog = 0x10,
1084edd8476339fd93ba8ff384ad107f1fc662e64a3Mathieu Chartier  // Non moving means we can have optimizations where we don't visit some roots if they are
1094edd8476339fd93ba8ff384ad107f1fc662e64a3Mathieu Chartier  // definitely reachable from another location. E.g. ArtMethod and ArtField roots.
1104edd8476339fd93ba8ff384ad107f1fc662e64a3Mathieu Chartier  kVisitRootFlagNonMoving = 0x20,
111893263b7d5bc2ca43a91ecb8071867f5134fc60aMathieu Chartier};
112893263b7d5bc2ca43a91ecb8071867f5134fc60aMathieu Chartier
1131fb8620309a4e94d11879aabc33364acfa733904Carl Shapiroclass Runtime {
1147b21670581d13db32f1384a3b2692bcfc8f57320Carl Shapiro public:
11588b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko  // Parse raw runtime options.
11688b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko  static bool ParseOptions(const RuntimeOptions& raw_options,
11788b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko                           bool ignore_unrecognized,
11888b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko                           RuntimeArgumentMap* runtime_options);
11988b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko
12088b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko  // Creates and initializes a new runtime.
12188b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko  static bool Create(RuntimeArgumentMap&& runtime_options)
12288b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko      SHARED_TRYLOCK_FUNCTION(true, Locks::mutator_lock_);
12388b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko
12461e019d291583029c01b61b93bea750f2b663c37Carl Shapiro  // Creates and initializes a new runtime.
12588b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko  static bool Create(const RuntimeOptions& raw_options, bool ignore_unrecognized)
126b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers      SHARED_TRYLOCK_FUNCTION(true, Locks::mutator_lock_);
12769b15fb098162f19a4c20e6dccdcead04d9c77f0Brian Carlstrom
128e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier  // IsAotCompiler for compilers that don't have a running runtime. Only dex2oat currently.
129e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier  bool IsAotCompiler() const {
130e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier    return !UseJit() && IsCompiler();
131e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier  }
132e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier
133e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier  // IsCompiler is any runtime which has a running compiler, either dex2oat or JIT.
134d9c67be7c116875d96b31e640ad47d587b205605Elliott Hughes  bool IsCompiler() const {
1352b5eaa2b49f7489bafdadc4b4463ae27e4261817Vladimir Marko    return compiler_callbacks_ != nullptr;
1362b5eaa2b49f7489bafdadc4b4463ae27e4261817Vladimir Marko  }
1372b5eaa2b49f7489bafdadc4b4463ae27e4261817Vladimir Marko
1384585f876eb5dfb936bd0d6cb6acd78a1f2182ba6Andreas Gampe  // If a compiler, are we compiling a boot image?
1394585f876eb5dfb936bd0d6cb6acd78a1f2182ba6Andreas Gampe  bool IsCompilingBootImage() const;
1404585f876eb5dfb936bd0d6cb6acd78a1f2182ba6Andreas Gampe
1414585f876eb5dfb936bd0d6cb6acd78a1f2182ba6Andreas Gampe  bool CanRelocate() const;
142a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light
143a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light  bool ShouldRelocate() const {
144a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light    return must_relocate_ && CanRelocate();
145a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light  }
146a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light
147a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light  bool MustRelocateIfPossible() const {
148a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light    return must_relocate_;
149a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light  }
150a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light
1514fcdc94d22a4608e355aa8df36240181149d10e8Nicolas Geoffray  bool IsDex2OatEnabled() const {
15264ad14dbe2225441fb7734bf6d89358d96692eeaAlex Light    return dex2oat_enabled_ && IsImageDex2OatEnabled();
15364ad14dbe2225441fb7734bf6d89358d96692eeaAlex Light  }
15464ad14dbe2225441fb7734bf6d89358d96692eeaAlex Light
15564ad14dbe2225441fb7734bf6d89358d96692eeaAlex Light  bool IsImageDex2OatEnabled() const {
15664ad14dbe2225441fb7734bf6d89358d96692eeaAlex Light    return image_dex2oat_enabled_;
1574fcdc94d22a4608e355aa8df36240181149d10e8Nicolas Geoffray  }
1584fcdc94d22a4608e355aa8df36240181149d10e8Nicolas Geoffray
1592b5eaa2b49f7489bafdadc4b4463ae27e4261817Vladimir Marko  CompilerCallbacks* GetCompilerCallbacks() {
1602b5eaa2b49f7489bafdadc4b4463ae27e4261817Vladimir Marko    return compiler_callbacks_;
161d9c67be7c116875d96b31e640ad47d587b205605Elliott Hughes  }
162d9c67be7c116875d96b31e640ad47d587b205605Elliott Hughes
16307ddb6f713f8c919e6da7c4b473cfb3bacb7cf10Mathieu Chartier  void SetCompilerCallbacks(CompilerCallbacks* callbacks) {
16407ddb6f713f8c919e6da7c4b473cfb3bacb7cf10Mathieu Chartier    CHECK(callbacks != nullptr);
16507ddb6f713f8c919e6da7c4b473cfb3bacb7cf10Mathieu Chartier    compiler_callbacks_ = callbacks;
16607ddb6f713f8c919e6da7c4b473cfb3bacb7cf10Mathieu Chartier  }
16707ddb6f713f8c919e6da7c4b473cfb3bacb7cf10Mathieu Chartier
168caabb1b77b4a55eb1bb45ebcd3071c9ea01dd3cfBrian Carlstrom  bool IsZygote() const {
169caabb1b77b4a55eb1bb45ebcd3071c9ea01dd3cfBrian Carlstrom    return is_zygote_;
170caabb1b77b4a55eb1bb45ebcd3071c9ea01dd3cfBrian Carlstrom  }
171caabb1b77b4a55eb1bb45ebcd3071c9ea01dd3cfBrian Carlstrom
1728718359763aa3dcd0033a2d2e67e0cb145fb9c53Anwar Ghuloum  bool IsExplicitGcDisabled() const {
1738718359763aa3dcd0033a2d2e67e0cb145fb9c53Anwar Ghuloum    return is_explicit_gc_disabled_;
1748718359763aa3dcd0033a2d2e67e0cb145fb9c53Anwar Ghuloum  }
1758718359763aa3dcd0033a2d2e67e0cb145fb9c53Anwar Ghuloum
17612e6d7446384a7a5fbec25fe116bbb271c62842eTsu Chiang Chuang  std::string GetCompilerExecutable() const;
177a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light  std::string GetPatchoatExecutable() const;
17812e6d7446384a7a5fbec25fe116bbb271c62842eTsu Chiang Chuang
1796449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom  const std::vector<std::string>& GetCompilerOptions() const {
1806449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom    return compiler_options_;
181a024a0686c3b0fea13f362bff70d65981e5febc5buzbee  }
182a024a0686c3b0fea13f362bff70d65981e5febc5buzbee
183d2abbc9829ea0f657557c247a7c48c825dacfccdAndreas Gampe  void AddCompilerOption(std::string option) {
184d2abbc9829ea0f657557c247a7c48c825dacfccdAndreas Gampe    compiler_options_.push_back(option);
185d2abbc9829ea0f657557c247a7c48c825dacfccdAndreas Gampe  }
186d2abbc9829ea0f657557c247a7c48c825dacfccdAndreas Gampe
1876449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom  const std::vector<std::string>& GetImageCompilerOptions() const {
1886449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom    return image_compiler_options_;
1898447d84d847d4562d7a7bce62768c27e7d20a9aaAnwar Ghuloum  }
1908447d84d847d4562d7a7bce62768c27e7d20a9aaAnwar Ghuloum
19131d8f5295c24730a57cb36cbc41197f0b7e8397cBrian Carlstrom  const std::string& GetImageLocation() const {
19231d8f5295c24730a57cb36cbc41197f0b7e8397cBrian Carlstrom    return image_location_;
19331d8f5295c24730a57cb36cbc41197f0b7e8397cBrian Carlstrom  }
19431d8f5295c24730a57cb36cbc41197f0b7e8397cBrian Carlstrom
195c1b643cc6ac45dbd0eabdcd7425c7e86006c27d6Calin Juravle  const ProfilerOptions& GetProfilerOptions() const {
196c1b643cc6ac45dbd0eabdcd7425c7e86006c27d6Calin Juravle    return profiler_options_;
197c1b643cc6ac45dbd0eabdcd7425c7e86006c27d6Calin Juravle  }
198c1b643cc6ac45dbd0eabdcd7425c7e86006c27d6Calin Juravle
19969b15fb098162f19a4c20e6dccdcead04d9c77f0Brian Carlstrom  // Starts a runtime, which may cause threads to be started and code to run.
200bd86bccf1b47f1151842152ee52cf5d46d6b34abBrian Carlstrom  bool Start() UNLOCK_FUNCTION(Locks::mutator_lock_);
2012ed144c2b49ae1da6c464d7a1be0062870530802Carl Shapiro
202590fee9e8972f872301c2d16a575d579ee564beeMathieu Chartier  bool IsShuttingDown(Thread* self);
20390443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  bool IsShuttingDownLocked() const REQUIRES(Locks::runtime_shutdown_lock_) {
2049af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers    return shutting_down_;
2059af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers  }
2069af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers
20790443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  size_t NumberOfThreadsBeingBorn() const REQUIRES(Locks::runtime_shutdown_lock_) {
208120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers    return threads_being_born_;
209120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers  }
210120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers
21190443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  void StartThreadBirth() REQUIRES(Locks::runtime_shutdown_lock_) {
212120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers    threads_being_born_++;
213120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers  }
214120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers
21590443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  void EndThreadBirth() REQUIRES(Locks::runtime_shutdown_lock_);
216120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers
2179af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers  bool IsStarted() const {
2189af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers    return started_;
2199af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers  }
220dcc247493fd8fb243e335c3ec08e5e625896a47cElliott Hughes
2217664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier  bool IsFinishedStarting() const {
2227664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier    return finished_starting_;
2237664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier  }
2247664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier
2252ed144c2b49ae1da6c464d7a1be0062870530802Carl Shapiro  static Runtime* Current() {
2262ed144c2b49ae1da6c464d7a1be0062870530802Carl Shapiro    return instance_;
2272ed144c2b49ae1da6c464d7a1be0062870530802Carl Shapiro  }
22861e019d291583029c01b61b93bea750f2b663c37Carl Shapiro
229db978719dbcb73fc6acfd193561445c4462786b8Nicolas Geoffray  // Aborts semi-cleanly. Used in the implementation of LOG(FATAL), which most
230db978719dbcb73fc6acfd193561445c4462786b8Nicolas Geoffray  // callers should prefer.
23190443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  NO_RETURN static void Abort() REQUIRES(!Locks::abort_lock_);
232ffe6736397d17457188727510f0a2953f69a383aElliott Hughes
233365c10235438607541fa2259a5fec48061b90bd8Ian Rogers  // Returns the "main" ThreadGroup, used when attaching user threads.
234034f76b91225bea769d6185d7dad5e243af4ffa0Brian Carlstrom  jobject GetMainThreadGroup() const;
235365c10235438607541fa2259a5fec48061b90bd8Ian Rogers
236365c10235438607541fa2259a5fec48061b90bd8Ian Rogers  // Returns the "system" ThreadGroup, used when attaching our internal threads.
237034f76b91225bea769d6185d7dad5e243af4ffa0Brian Carlstrom  jobject GetSystemThreadGroup() const;
238365c10235438607541fa2259a5fec48061b90bd8Ian Rogers
239ce88853ab316c70ef7b598978a3609611db60552Brian Carlstrom  // Returns the system ClassLoader which represents the CLASSPATH.
240ce88853ab316c70ef7b598978a3609611db60552Brian Carlstrom  jobject GetSystemClassLoader() const;
241ce88853ab316c70ef7b598978a3609611db60552Brian Carlstrom
242462c94449720e0dc6b93d7138d835d345ccf67aeElliott Hughes  // Attaches the calling native thread to the runtime.
243b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin  bool AttachCurrentThread(const char* thread_name, bool as_daemon, jobject thread_group,
244664bebf92eb2151b9b570ccd42ac4b6056c3ea9cMathieu Chartier                           bool create_peer);
245b557353b22c728eecbd1c68593b482622c7782a8Carl Shapiro
246bf86d0438e9ef9c145ebcf16a2e74c4efaa2686aElliott Hughes  void CallExitHook(jint status);
247bf86d0438e9ef9c145ebcf16a2e74c4efaa2686aElliott Hughes
24861e019d291583029c01b61b93bea750f2b663c37Carl Shapiro  // Detaches the current native thread from the runtime.
24990443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  void DetachCurrentThread() REQUIRES(!Locks::mutator_lock_);
25061e019d291583029c01b61b93bea750f2b663c37Carl Shapiro
2517b078e8c04f3e1451dbdd18543c8b9692b5b067eIan Rogers  void DumpForSigQuit(std::ostream& os);
25221a5bf2dc8c9cb3fbe5a30a88d1149c328e3aacaElliott Hughes  void DumpLockHolders(std::ostream& os);
253e27955ca3ca960928d4dbd6cb79711fce06950b3Elliott Hughes
25461e019d291583029c01b61b93bea750f2b663c37Carl Shapiro  ~Runtime();
255b557353b22c728eecbd1c68593b482622c7782a8Carl Shapiro
256a004aa933a58428489e42d77f707c2b063b73747Brian Carlstrom  const std::string& GetBootClassPathString() const {
257a004aa933a58428489e42d77f707c2b063b73747Brian Carlstrom    return boot_class_path_string_;
258b765be0d656c3073402693aeaf64e95a0e49f218Brian Carlstrom  }
259b765be0d656c3073402693aeaf64e95a0e49f218Brian Carlstrom
260a004aa933a58428489e42d77f707c2b063b73747Brian Carlstrom  const std::string& GetClassPathString() const {
261a004aa933a58428489e42d77f707c2b063b73747Brian Carlstrom    return class_path_string_;
2627a90959d4ef7a69f3bcb7b8763f646e12d9267d3Carl Shapiro  }
2637a90959d4ef7a69f3bcb7b8763f646e12d9267d3Carl Shapiro
264a004aa933a58428489e42d77f707c2b063b73747Brian Carlstrom  ClassLinker* GetClassLinker() const {
265a004aa933a58428489e42d77f707c2b063b73747Brian Carlstrom    return class_linker_;
2667ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes  }
2677ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes
2687ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes  size_t GetDefaultStackSize() const {
2697ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes    return default_stack_size_;
2707ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes  }
2717ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes
2721d54e73444e017d3a65234e0f193846f3e27472bIan Rogers  gc::Heap* GetHeap() const {
273b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    return heap_;
274b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  }
275b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes
276cf4c6c41b0084dc4567ff709fb8ce9ebd72b26acElliott Hughes  InternTable* GetInternTable() const {
2772cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier    DCHECK(intern_table_ != nullptr);
278cf4c6c41b0084dc4567ff709fb8ce9ebd72b26acElliott Hughes    return intern_table_;
279cf4c6c41b0084dc4567ff709fb8ce9ebd72b26acElliott Hughes  }
280cf4c6c41b0084dc4567ff709fb8ce9ebd72b26acElliott Hughes
2810af5543f8ea20c3e655b2d748a1b7dcf283792feElliott Hughes  JavaVMExt* GetJavaVM() const {
282c5f7c91ab89055cffb573fff7e06dbdd860bccedElliott Hughes    return java_vm_;
283f2682d5a6ce0f7de58da8fd4ec8aec200c43b92eElliott Hughes  }
284f2682d5a6ce0f7de58da8fd4ec8aec200c43b92eElliott Hughes
285d9c4fc94fa618617f94e1de9af5f034549100753Ian Rogers  size_t GetMaxSpinsBeforeThinkLockInflation() const {
286d9c4fc94fa618617f94e1de9af5f034549100753Ian Rogers    return max_spins_before_thin_lock_inflation_;
287d9c4fc94fa618617f94e1de9af5f034549100753Ian Rogers  }
288d9c4fc94fa618617f94e1de9af5f034549100753Ian Rogers
289c33a32bccc4c66ed82ce3a580b16636399385cb4Elliott Hughes  MonitorList* GetMonitorList() const {
290c33a32bccc4c66ed82ce3a580b16636399385cb4Elliott Hughes    return monitor_list_;
291c33a32bccc4c66ed82ce3a580b16636399385cb4Elliott Hughes  }
292c33a32bccc4c66ed82ce3a580b16636399385cb4Elliott Hughes
293ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers  MonitorPool* GetMonitorPool() const {
294ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers    return monitor_pool_;
295ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers  }
296ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers
297c0542af3e2170143ba40d89136e284997e16bf64Ian Rogers  // Is the given object the special object used to mark a cleared JNI weak global?
29890443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  bool IsClearedJniWeakGlobal(mirror::Object* obj) SHARED_REQUIRES(Locks::mutator_lock_);
299c0542af3e2170143ba40d89136e284997e16bf64Ian Rogers
300c0542af3e2170143ba40d89136e284997e16bf64Ian Rogers  // Get the special object used to mark a cleared JNI weak global.
30190443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  mirror::Object* GetClearedJniWeakGlobal() SHARED_REQUIRES(Locks::mutator_lock_);
302c0542af3e2170143ba40d89136e284997e16bf64Ian Rogers
30390443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  mirror::Throwable* GetPreAllocatedOutOfMemoryError() SHARED_REQUIRES(Locks::mutator_lock_);
304225f5a1df25241babd16cdba54056b9e2cd166a2Elliott Hughes
305b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin  mirror::Throwable* GetPreAllocatedNoClassDefFoundError()
306b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin      SHARED_REQUIRES(Locks::mutator_lock_);
30763557459a4098294a9ff44d035241de2966047c0Ian Rogers
308225f5a1df25241babd16cdba54056b9e2cd166a2Elliott Hughes  const std::vector<std::string>& GetProperties() const {
309225f5a1df25241babd16cdba54056b9e2cd166a2Elliott Hughes    return properties_;
310225f5a1df25241babd16cdba54056b9e2cd166a2Elliott Hughes  }
311225f5a1df25241babd16cdba54056b9e2cd166a2Elliott Hughes
312d92bec457dc6c506c80e9da6b8e0c958266b5cdcElliott Hughes  ThreadList* GetThreadList() const {
313d92bec457dc6c506c80e9da6b8e0c958266b5cdcElliott Hughes    return thread_list_;
314d92bec457dc6c506c80e9da6b8e0c958266b5cdcElliott Hughes  }
315d92bec457dc6c506c80e9da6b8e0c958266b5cdcElliott Hughes
316491ca9e75fad381468dd7f5fdbff56d1a9738dd7Brian Carlstrom  static const char* GetVersion() {
3172153f93df36b59a61fed15bef8e7304010be04b5Andreas Gampe    return "2.1.0";
3187ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes  }
3197ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes
32090443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  void DisallowNewSystemWeaks() SHARED_REQUIRES(Locks::mutator_lock_);
32190443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  void AllowNewSystemWeaks() SHARED_REQUIRES(Locks::mutator_lock_);
32290443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  void BroadcastForNewSystemWeaks() SHARED_REQUIRES(Locks::mutator_lock_);
323c11d9b8870de5f860b13c84003ade7b3f3125a52Mathieu Chartier
3241d54e73444e017d3a65234e0f193846f3e27472bIan Rogers  // Visit all the roots. If only_dirty is true then non-dirty roots won't be visited. If
3251d54e73444e017d3a65234e0f193846f3e27472bIan Rogers  // clean_dirty is true then dirty roots will be marked as non-dirty after visiting.
326bb87e0f1a52de656bc77cb01cb887e51a0e5198bMathieu Chartier  void VisitRoots(RootVisitor* visitor, VisitRootFlags flags = kVisitRootFlagAllRoots)
32790443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      SHARED_REQUIRES(Locks::mutator_lock_);
3281f87008b165d26541d832ff805250afdc89c253dBrian Carlstrom
329461687d898dfd91253f242072849a9fe43e5f523Mathieu Chartier  // Visit image roots, only used for hprof since the GC uses the image space mod union table
330461687d898dfd91253f242072849a9fe43e5f523Mathieu Chartier  // instead.
33190443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  void VisitImageRoots(RootVisitor* visitor) SHARED_REQUIRES(Locks::mutator_lock_);
332461687d898dfd91253f242072849a9fe43e5f523Mathieu Chartier
3339ebae1f30b84dfd8dab4144f80eebec4f8fc8851Mathieu Chartier  // Visit all of the roots we can do safely do concurrently.
334b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin  void VisitConcurrentRoots(RootVisitor* visitor,
335b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin                            VisitRootFlags flags = kVisitRootFlagAllRoots)
33690443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      SHARED_REQUIRES(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)
34090443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      SHARED_REQUIRES(Locks::mutator_lock_);
341858f1c5fd5e528d0b16040ced74d4636046a42d8Mathieu Chartier
342bb87e0f1a52de656bc77cb01cb887e51a0e5198bMathieu Chartier  void VisitTransactionRoots(RootVisitor* visitor)
34390443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      SHARED_REQUIRES(Locks::mutator_lock_);
3442cd334ae2d4287216523882f0d298cf3901b7ab1Hiroshi Yamauchi
3452cd334ae2d4287216523882f0d298cf3901b7ab1Hiroshi Yamauchi  // Visit all of the thread roots.
34690443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  void VisitThreadRoots(RootVisitor* visitor) SHARED_REQUIRES(Locks::mutator_lock_);
3472cd334ae2d4287216523882f0d298cf3901b7ab1Hiroshi Yamauchi
3482cd334ae2d4287216523882f0d298cf3901b7ab1Hiroshi Yamauchi  // Flip thread roots from from-space refs to to-space refs.
349b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin  size_t FlipThreadRoots(Closure* thread_flip_visitor, Closure* flip_callback,
3502cd334ae2d4287216523882f0d298cf3901b7ab1Hiroshi Yamauchi                         gc::collector::GarbageCollector* collector)
35190443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      REQUIRES(!Locks::mutator_lock_);
3522cd334ae2d4287216523882f0d298cf3901b7ab1Hiroshi Yamauchi
3539ebae1f30b84dfd8dab4144f80eebec4f8fc8851Mathieu Chartier  // Visit all other roots which must be done with mutators suspended.
354bb87e0f1a52de656bc77cb01cb887e51a0e5198bMathieu Chartier  void VisitNonConcurrentRoots(RootVisitor* visitor)
35590443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      SHARED_REQUIRES(Locks::mutator_lock_);
3569ebae1f30b84dfd8dab4144f80eebec4f8fc8851Mathieu Chartier
3572cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier  // Sweep system weaks, the system weak is deleted if the visitor return null. Otherwise, the
3586aa3df965395566ed6a4fec4af37c2b7577992e9Mathieu Chartier  // system weak is updated to be the visitor's returned value.
35997509954404d031594b2ecbda607314d169d512eMathieu Chartier  void SweepSystemWeaks(IsMarkedVisitor* visitor)
36090443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      SHARED_REQUIRES(Locks::mutator_lock_);
3616aa3df965395566ed6a4fec4af37c2b7577992e9Mathieu Chartier
362893263b7d5bc2ca43a91ecb8071867f5134fc60aMathieu Chartier  // Constant roots are the roots which never change after the runtime is initialized, they only
363893263b7d5bc2ca43a91ecb8071867f5134fc60aMathieu Chartier  // need to be visited once per GC cycle.
364bb87e0f1a52de656bc77cb01cb887e51a0e5198bMathieu Chartier  void VisitConstantRoots(RootVisitor* visitor)
36590443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      SHARED_REQUIRES(Locks::mutator_lock_);
366893263b7d5bc2ca43a91ecb8071867f5134fc60aMathieu Chartier
3679af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers  // Returns a special method that calls into a trampoline for runtime method resolution
368fbc31087932a65e036a153afab3049dc5298656aMathieu Chartier  ArtMethod* GetResolutionMethod();
3699af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers
3709af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers  bool HasResolutionMethod() const {
371e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier    return resolution_method_ != nullptr;
3729af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers  }
3739af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers
37490443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  void SetResolutionMethod(ArtMethod* method) SHARED_REQUIRES(Locks::mutator_lock_);
3759af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers
37690443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  ArtMethod* CreateResolutionMethod() SHARED_REQUIRES(Locks::mutator_lock_);
3771984651929744dd603fd082e23eacd877b9bc177Ian Rogers
378e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogers  // Returns a special method that calls into a trampoline for runtime imt conflicts.
379fbc31087932a65e036a153afab3049dc5298656aMathieu Chartier  ArtMethod* GetImtConflictMethod();
380fbc31087932a65e036a153afab3049dc5298656aMathieu Chartier  ArtMethod* GetImtUnimplementedMethod();
38188474b416eb257078e590bf9bc7957cee604a186Jeff Hao
38288474b416eb257078e590bf9bc7957cee604a186Jeff Hao  bool HasImtConflictMethod() const {
383e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier    return imt_conflict_method_ != nullptr;
38488474b416eb257078e590bf9bc7957cee604a186Jeff Hao  }
38588474b416eb257078e590bf9bc7957cee604a186Jeff Hao
386e42888f9df4163303244070c65d5229d3e201742Mathieu Chartier  void FixupConflictTables();
38790443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  void SetImtConflictMethod(ArtMethod* method) SHARED_REQUIRES(Locks::mutator_lock_);
38890443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  void SetImtUnimplementedMethod(ArtMethod* method) SHARED_REQUIRES(Locks::mutator_lock_);
38988474b416eb257078e590bf9bc7957cee604a186Jeff Hao
390796d63050a18f263b93ea34951a61deaecab3422Nicolas Geoffray  ArtMethod* CreateImtConflictMethod(LinearAlloc* linear_alloc)
391796d63050a18f263b93ea34951a61deaecab3422Nicolas Geoffray      SHARED_REQUIRES(Locks::mutator_lock_);
39288474b416eb257078e590bf9bc7957cee604a186Jeff Hao
393ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers  // Returns a special method that describes all callee saves being spilled to the stack.
3944f0d07c783afef89703dce32c94440fc8621a29bIan Rogers  enum CalleeSaveType {
3954f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    kSaveAll,
3964f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    kRefsOnly,
3974f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    kRefsAndArgs,
3984f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    kLastCalleeSaveType  // Value used for iteration
3994f0d07c783afef89703dce32c94440fc8621a29bIan Rogers  };
4009af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers
4019af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers  bool HasCalleeSaveMethod(CalleeSaveType type) const {
402e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier    return callee_save_methods_[type] != 0u;
4039af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers  }
4049af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers
405e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier  ArtMethod* GetCalleeSaveMethod(CalleeSaveType type)
40690443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      SHARED_REQUIRES(Locks::mutator_lock_);
407ab088118d33caafb00815ab72ac0fd7374169f64Hiroshi Yamauchi
408e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier  ArtMethod* GetCalleeSaveMethodUnchecked(CalleeSaveType type)
40990443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      SHARED_REQUIRES(Locks::mutator_lock_);
4109af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers
4117624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko  QuickMethodFrameInfo GetCalleeSaveMethodFrameInfo(CalleeSaveType type) const {
4127624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko    return callee_save_method_frame_infos_[type];
4137624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko  }
4147624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko
415e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier  QuickMethodFrameInfo GetRuntimeMethodFrameInfo(ArtMethod* method)
41690443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      SHARED_REQUIRES(Locks::mutator_lock_);
4177624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko
418936b37f3a7f224d990a36b2ec66782a4462180d6Ian Rogers  static size_t GetCalleeSaveMethodOffset(CalleeSaveType type) {
419936b37f3a7f224d990a36b2ec66782a4462180d6Ian Rogers    return OFFSETOF_MEMBER(Runtime, callee_save_methods_[type]);
420936b37f3a7f224d990a36b2ec66782a4462180d6Ian Rogers  }
421936b37f3a7f224d990a36b2ec66782a4462180d6Ian Rogers
4227624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko  InstructionSet GetInstructionSet() const {
4237624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko    return instruction_set_;
4247624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko  }
4254f0d07c783afef89703dce32c94440fc8621a29bIan Rogers
4267624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko  void SetInstructionSet(InstructionSet instruction_set);
4279af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers
428e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier  void SetCalleeSaveMethod(ArtMethod* method, CalleeSaveType type);
42900f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abacIan Rogers
43090443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  ArtMethod* CreateCalleeSaveMethod() SHARED_REQUIRES(Locks::mutator_lock_);
431ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers
4329d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes  int32_t GetStat(int kind);
4339d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes
4349af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers  RuntimeStats* GetStats() {
4359af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers    return &stats_;
4369af209c9dcc6763fae2976981570a90aa41fd86bIan Rogers  }
4379d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes
4389d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes  bool HasStatsEnabled() const {
4399d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes    return stats_enabled_;
4409d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes  }
4419d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes
4429d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes  void ResetStats(int kinds);
4439d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes
44490443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  void SetStatsEnabled(bool new_state)
44590443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      REQUIRES(!Locks::instrument_entrypoints_lock_, !Locks::mutator_lock_);
4469d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes
4476be67eeedbe60afce42300ae3e7f0e7180a96efaAndreas Gampe  enum class NativeBridgeAction {  // private
4486be67eeedbe60afce42300ae3e7f0e7180a96efaAndreas Gampe    kUnload,
4496be67eeedbe60afce42300ae3e7f0e7180a96efaAndreas Gampe    kInitialize
4506be67eeedbe60afce42300ae3e7f0e7180a96efaAndreas Gampe  };
451e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier
452e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier  jit::Jit* GetJit() {
453e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier    return jit_.get();
454e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier  }
455e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier  bool UseJit() const {
456e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier    return jit_.get() != nullptr;
457e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier  }
458e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier
4593de95a7b0a2d30cde6dc92b72c35df3a61002124Narayan Kamath  void PreZygoteFork();
460bd86bccf1b47f1151842152ee52cf5d46d6b34abBrian Carlstrom  bool InitZygote();
461d66c8621610dc18d324132c8e5b081520f719777Nicolas Geoffray  void InitNonZygoteOrPostFork(
462d66c8621610dc18d324132c8e5b081520f719777Nicolas Geoffray      JNIEnv* env, bool is_system_server, NativeBridgeAction action, const char* isa);
463caabb1b77b4a55eb1bb45ebcd3071c9ea01dd3cfBrian Carlstrom
4649bc54406ba3377980cfce44901dc2be246178ba9Ian Rogers  const instrumentation::Instrumentation* GetInstrumentation() const {
4659bc54406ba3377980cfce44901dc2be246178ba9Ian Rogers    return &instrumentation_;
4669bc54406ba3377980cfce44901dc2be246178ba9Ian Rogers  }
4679bc54406ba3377980cfce44901dc2be246178ba9Ian Rogers
46862d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers  instrumentation::Instrumentation* GetInstrumentation() {
46962d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    return &instrumentation_;
47062d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers  }
4712692b573a56cd63a3c8c8aa1636e3766b6d8c9c4jeffhao
47266f55237679db90cb0a0a265043a787932b466f8Calin Juravle  void RegisterAppInfo(const std::vector<std::string>& code_paths,
473c90bc92bc577020ff4d3caced4cee1cdf41fa5deCalin Juravle                       const std::string& profile_output_filename,
474c90bc92bc577020ff4d3caced4cee1cdf41fa5deCalin Juravle                       const std::string& foreign_dex_profile_path,
475c90bc92bc577020ff4d3caced4cee1cdf41fa5deCalin Juravle                       const std::string& app_dir);
476c90bc92bc577020ff4d3caced4cee1cdf41fa5deCalin Juravle  void NotifyDexLoaded(const std::string& dex_location);
4770aded089f565008ba5908e395e5914ca4f91f2deDave Allison
478d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertz  // Transaction support.
479ee1d79a603c77c0667b27c075a983579d5c51f7eSebastien Hertz  bool IsActiveTransaction() const {
480ee1d79a603c77c0667b27c075a983579d5c51f7eSebastien Hertz    return preinitialization_transaction_ != nullptr;
481ee1d79a603c77c0667b27c075a983579d5c51f7eSebastien Hertz  }
482d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertz  void EnterTransactionMode(Transaction* transaction);
483d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertz  void ExitTransactionMode();
4841c80becf5406cd6d95dc24bf47a0c5a3809ea281Sebastien Hertz  bool IsTransactionAborted() const;
4851c80becf5406cd6d95dc24bf47a0c5a3809ea281Sebastien Hertz
4862fd7e69505195cda4caaa3161aaf37315552a698Sebastien Hertz  void AbortTransactionAndThrowAbortError(Thread* self, const std::string& abort_message)
48790443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      SHARED_REQUIRES(Locks::mutator_lock_);
4882fd7e69505195cda4caaa3161aaf37315552a698Sebastien Hertz  void ThrowTransactionAbortError(Thread* self)
48990443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      SHARED_REQUIRES(Locks::mutator_lock_);
4901c80becf5406cd6d95dc24bf47a0c5a3809ea281Sebastien Hertz
491b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin  void RecordWriteFieldBoolean(mirror::Object* obj, MemberOffset field_offset, uint8_t value,
49237f05ef45e0393de812d51261dc293240c17294dFred Shih                               bool is_volatile) const;
493b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin  void RecordWriteFieldByte(mirror::Object* obj, MemberOffset field_offset, int8_t value,
49437f05ef45e0393de812d51261dc293240c17294dFred Shih                            bool is_volatile) const;
495b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin  void RecordWriteFieldChar(mirror::Object* obj, MemberOffset field_offset, uint16_t value,
49637f05ef45e0393de812d51261dc293240c17294dFred Shih                            bool is_volatile) const;
497b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin  void RecordWriteFieldShort(mirror::Object* obj, MemberOffset field_offset, int16_t value,
49837f05ef45e0393de812d51261dc293240c17294dFred Shih                          bool is_volatile) const;
499b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin  void RecordWriteField32(mirror::Object* obj, MemberOffset field_offset, uint32_t value,
500d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertz                          bool is_volatile) const;
501b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin  void RecordWriteField64(mirror::Object* obj, MemberOffset field_offset, uint64_t value,
502d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertz                          bool is_volatile) const;
503b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin  void RecordWriteFieldReference(mirror::Object* obj, MemberOffset field_offset,
504b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin                                 mirror::Object* value, bool is_volatile) const;
505d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertz  void RecordWriteArray(mirror::Array* array, size_t index, uint64_t value) const
50690443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      SHARED_REQUIRES(Locks::mutator_lock_);
507cdfd39f579574a75b98e7ad48c69826b00361b27Mathieu Chartier  void RecordStrongStringInsertion(mirror::String* s) const
50890443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      REQUIRES(Locks::intern_table_lock_);
509cdfd39f579574a75b98e7ad48c69826b00361b27Mathieu Chartier  void RecordWeakStringInsertion(mirror::String* s) const
51090443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      REQUIRES(Locks::intern_table_lock_);
511cdfd39f579574a75b98e7ad48c69826b00361b27Mathieu Chartier  void RecordStrongStringRemoval(mirror::String* s) const
51290443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      REQUIRES(Locks::intern_table_lock_);
513cdfd39f579574a75b98e7ad48c69826b00361b27Mathieu Chartier  void RecordWeakStringRemoval(mirror::String* s) const
51490443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier      REQUIRES(Locks::intern_table_lock_);
515d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertz
51690443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  void SetFaultMessage(const std::string& message) REQUIRES(!fault_message_lock_);
51715d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier  // Only read by the signal handler, NO_THREAD_SAFETY_ANALYSIS to prevent lock order violations
51815d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier  // with the unexpected_signal_lock_.
51915d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier  const std::string& GetFaultMessage() NO_THREAD_SAFETY_ANALYSIS {
52015d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier    return fault_message_;
52115d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier  }
52215d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier
523b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7Igor Murashkin  void AddCurrentRuntimeFeaturesAsDex2OatArguments(std::vector<std::string>* arg_vector) const;
5248afeb85d3def12b559b7565fb6d3956f81b55132Ian Rogers
525b373e091eac39b1a79c11f2dcbd610af01e9e8a9Dave Allison  bool ExplicitStackOverflowChecks() const {
526928f72bd75c385ba2708c58521171a77264d4486Andreas Gampe    return !implicit_so_checks_;
527b373e091eac39b1a79c11f2dcbd610af01e9e8a9Dave Allison  }
528b373e091eac39b1a79c11f2dcbd610af01e9e8a9Dave Allison
5297617abdb402fd0419daa3eefb2ad059ccbb8b6dbIgor Murashkin  bool IsVerificationEnabled() const;
5307617abdb402fd0419daa3eefb2ad059ccbb8b6dbIgor Murashkin  bool IsVerificationSoftFail() const;
5314a200f56b7075309316b04d550c9cc50f8314eddJeff Hao
53224e04aa68c575d349eac0d9d09aab9bd3106ef94Jean Christophe Beyler  bool IsDexFileFallbackEnabled() const {
53324e04aa68c575d349eac0d9d09aab9bd3106ef94Jean Christophe Beyler    return allow_dex_file_fallback_;
53424e04aa68c575d349eac0d9d09aab9bd3106ef94Jean Christophe Beyler  }
53524e04aa68c575d349eac0d9d09aab9bd3106ef94Jean Christophe Beyler
536785049f8083e56e88dfeab5ff74fb3817f9854e3Dmitriy Ivanov  const std::vector<std::string>& GetCpuAbilist() const {
537785049f8083e56e88dfeab5ff74fb3817f9854e3Dmitriy Ivanov    return cpu_abilist_;
538785049f8083e56e88dfeab5ff74fb3817f9854e3Dmitriy Ivanov  }
539785049f8083e56e88dfeab5ff74fb3817f9854e3Dmitriy Ivanov
5401e13374baf7dfaf442ffbf9809c37c131d681eafEvgenii Stepanov  bool IsRunningOnMemoryTool() const {
5411e13374baf7dfaf442ffbf9809c37c131d681eafEvgenii Stepanov    return is_running_on_memory_tool_;
542da44d773dedf8aae6153e3423012f236cba3bfcdMathieu Chartier  }
543da44d773dedf8aae6153e3423012f236cba3bfcdMathieu Chartier
544f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao  void SetTargetSdkVersion(int32_t version) {
545f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao    target_sdk_version_ = version;
546f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao  }
547f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao
548f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao  int32_t GetTargetSdkVersion() const {
549f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao    return target_sdk_version_;
550f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao  }
551f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao
5525a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath  uint32_t GetZygoteMaxFailedBoots() const {
5535a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath    return zygote_max_failed_boots_;
5545a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath  }
5555a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath
556eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light  bool AreExperimentalFlagsEnabled(ExperimentalFlags flags) {
557eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light    return (experimental_flags_ & flags) != ExperimentalFlags::kNone;
558158f35c98e2ec0d40d2c032b8cdce5fb60944a7fIgor Murashkin  }
559158f35c98e2ec0d40d2c032b8cdce5fb60944a7fIgor Murashkin
560e2facc5b18cd756a8b5500fb3d90da69c9ee0fb7Igor Murashkin  lambda::BoxTable* GetLambdaBoxTable() const {
561e2facc5b18cd756a8b5500fb3d90da69c9ee0fb7Igor Murashkin    return lambda_box_table_.get();
562e2facc5b18cd756a8b5500fb3d90da69c9ee0fb7Igor Murashkin  }
563e2facc5b18cd756a8b5500fb3d90da69c9ee0fb7Igor Murashkin
564455f67c4cf0b4f04e117db3024fd189fa1c7dab9Mathieu Chartier  // Create the JIT and instrumentation and code cache.
565e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier  void CreateJit();
566e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier
5679b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier  ArenaPool* GetArenaPool() {
5689b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier    return arena_pool_.get();
5699b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier  }
57025e0456b6ea13eba290b63ea88b6b7120ed89413Nicolas Geoffray  ArenaPool* GetJitArenaPool() {
57125e0456b6ea13eba290b63ea88b6b7120ed89413Nicolas Geoffray    return jit_arena_pool_.get();
57225e0456b6ea13eba290b63ea88b6b7120ed89413Nicolas Geoffray  }
5739b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier  const ArenaPool* GetArenaPool() const {
5749b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier    return arena_pool_.get();
5759b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier  }
576ca76a1a0c1737b3e04961ba382c113102fdc00bfJean-Philippe Halimi
577ca76a1a0c1737b3e04961ba382c113102fdc00bfJean-Philippe Halimi  void ReclaimArenaPoolMemory();
578ca76a1a0c1737b3e04961ba382c113102fdc00bfJean-Philippe Halimi
579c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier  LinearAlloc* GetLinearAlloc() {
580c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier    return linear_alloc_.get();
581c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier  }
5829b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier
583455f67c4cf0b4f04e117db3024fd189fa1c7dab9Mathieu Chartier  jit::JitOptions* GetJITOptions() {
584455f67c4cf0b4f04e117db3024fd189fa1c7dab9Mathieu Chartier    return jit_options_.get();
585455f67c4cf0b4f04e117db3024fd189fa1c7dab9Mathieu Chartier  }
586455f67c4cf0b4f04e117db3024fd189fa1c7dab9Mathieu Chartier
5877a4d0157eb690266928902a67922f346e290f4c6Nicolas Geoffray  bool IsDebuggable() const;
5887a4d0157eb690266928902a67922f346e290f4c6Nicolas Geoffray
589f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky  bool IsNativeDebuggable() const {
590f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky    return is_native_debuggable_;
591f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky  }
592f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky
593f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky  void SetNativeDebuggable(bool value) {
594f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky    is_native_debuggable_ = value;
595f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky  }
596f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky
597dd6712578b6aa8a292bc6249295b6d2a7b182717Andreas Gampe  // Returns the build fingerprint, if set. Otherwise an empty string is returned.
598dd6712578b6aa8a292bc6249295b6d2a7b182717Andreas Gampe  std::string GetFingerprint() {
599dd6712578b6aa8a292bc6249295b6d2a7b182717Andreas Gampe    return fingerprint_;
600dd6712578b6aa8a292bc6249295b6d2a7b182717Andreas Gampe  }
601dd6712578b6aa8a292bc6249295b6d2a7b182717Andreas Gampe
602673ed3d8aedc5462a47ded827c99f35d46525457Mathieu Chartier  // Called from class linker.
603673ed3d8aedc5462a47ded827c99f35d46525457Mathieu Chartier  void SetSentinel(mirror::Object* sentinel) SHARED_REQUIRES(Locks::mutator_lock_);
604673ed3d8aedc5462a47ded827c99f35d46525457Mathieu Chartier
605951ec2c93c79c5539cbcc669566f0808d4460338Mathieu Chartier  // Create a normal LinearAlloc or low 4gb version if we are 64 bit AOT compiler.
606951ec2c93c79c5539cbcc669566f0808d4460338Mathieu Chartier  LinearAlloc* CreateLinearAlloc();
607951ec2c93c79c5539cbcc669566f0808d4460338Mathieu Chartier
608f9c6fc610b27887f832e453a0da1789187293408Mathieu Chartier  OatFileManager& GetOatFileManager() const {
609f9c6fc610b27887f832e453a0da1789187293408Mathieu Chartier    DCHECK(oat_file_manager_ != nullptr);
610e58991b3b2282b5761f1a6023a16c803e1c4eb45Mathieu Chartier    return *oat_file_manager_;
611f9c6fc610b27887f832e453a0da1789187293408Mathieu Chartier  }
612f9c6fc610b27887f832e453a0da1789187293408Mathieu Chartier
61332cc9ee0cdffecb0ec8d80a7fd55d7dccae3a7eeMathieu Chartier  double GetHashTableMinLoadFactor() const;
61432cc9ee0cdffecb0ec8d80a7fd55d7dccae3a7eeMathieu Chartier  double GetHashTableMaxLoadFactor() const;
61532cc9ee0cdffecb0ec8d80a7fd55d7dccae3a7eeMathieu Chartier
616787ae8eb018d46b4b464e3a7c8de37d9262deb61Nicolas Geoffray  void SetSafeMode(bool mode) {
617787ae8eb018d46b4b464e3a7c8de37d9262deb61Nicolas Geoffray    safe_mode_ = mode;
618787ae8eb018d46b4b464e3a7c8de37d9262deb61Nicolas Geoffray  }
619787ae8eb018d46b4b464e3a7c8de37d9262deb61Nicolas Geoffray
620a73280df8cac1279b6dea0424722f42ef0048613Nicolas Geoffray  bool GetDumpNativeStackOnSigQuit() const {
621a73280df8cac1279b6dea0424722f42ef0048613Nicolas Geoffray    return dump_native_stack_on_sig_quit_;
622a73280df8cac1279b6dea0424722f42ef0048613Nicolas Geoffray  }
623a73280df8cac1279b6dea0424722f42ef0048613Nicolas Geoffray
624a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe  bool GetPrunedDalvikCache() const {
625a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe    return pruned_dalvik_cache_;
626a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe  }
627a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe
628a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe  void SetPrunedDalvikCache(bool pruned) {
629a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe    pruned_dalvik_cache_ = pruned;
630a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe  }
631a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe
632f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier  void UpdateProcessState(ProcessState process_state);
633f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier
634f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier  // Returns true if we currently care about long mutator pause.
635f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier  bool InJankPerceptibleProcessState() const {
636f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier    return process_state_ == kProcessStateJankPerceptible;
637f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier  }
638f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier
63997cbc9206e9adc473a90650ebdb5d620f517ff04Calin Juravle  void RegisterSensitiveThread() const;
64097cbc9206e9adc473a90650ebdb5d620f517ff04Calin Juravle
641f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe  void SetZygoteNoThreadSection(bool val) {
642f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe    zygote_no_threads_ = val;
643f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe  }
644f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe
645f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe  bool IsZygoteNoThreadSection() const {
646f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe    return zygote_no_threads_;
647f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe  }
648f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe
649b557353b22c728eecbd1c68593b482622c7782a8Carl Shapiro private:
650457005c557b8762475db3220ce5a747d629f975bElliott Hughes  static void InitPlatformSignalHandlers();
651ffe6736397d17457188727510f0a2953f69a383aElliott Hughes
652dcc247493fd8fb243e335c3ec08e5e625896a47cElliott Hughes  Runtime();
65361e019d291583029c01b61b93bea750f2b663c37Carl Shapiro
654c1674ed06662420213441ff2b818f2f71f9098dcElliott Hughes  void BlockSignals();
655c1674ed06662420213441ff2b818f2f71f9098dcElliott Hughes
65688b2b80aed15bb1f931cddd40e44ca525ef10018Vladimir Marko  bool Init(RuntimeArgumentMap&& runtime_options)
657b726dcb581bf72da46527378ccb6889020f0e6e9Ian Rogers      SHARED_TRYLOCK_FUNCTION(true, Locks::mutator_lock_);
65890443477f9a0061581c420775ce3b7eeae7468bcMathieu Chartier  void InitNativeMethods() REQUIRES(!Locks::mutator_lock_);
659365c10235438607541fa2259a5fec48061b90bd8Ian Rogers  void InitThreadGroups(Thread* self);
660ff17f1fd3ff32f93e45588eb2b158832d73f9afaElliott Hughes  void RegisterRuntimeNativeMethods(JNIEnv* env);
661d1cc8363d4f4bbac7568b1d02a5ca481cd10830fElliott Hughes
66285d1545e985ac689db4bad7849880e843707c862Elliott Hughes  void StartDaemonThreads();
663d1cc8363d4f4bbac7568b1d02a5ca481cd10830fElliott Hughes  void StartSignalCatcher();
66461e019d291583029c01b61b93bea750f2b663c37Carl Shapiro
66531f2c155975c5794d481df03eb0947cb48d2c6b5Calin Juravle  void MaybeSaveJitProfilingInfo();
66631f2c155975c5794d481df03eb0947cb48d2c6b5Calin Juravle
6672cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier  // A pointer to the active runtime or null.
668b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  static Runtime* instance_;
669b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes
6708afeb85d3def12b559b7565fb6d3956f81b55132Ian Rogers  // NOTE: these must match the gc::ProcessState values as they come directly from the framework.
6718afeb85d3def12b559b7565fb6d3956f81b55132Ian Rogers  static constexpr int kProfileForground = 0;
67231f2c155975c5794d481df03eb0947cb48d2c6b5Calin Juravle  static constexpr int kProfileBackground = 1;
6738afeb85d3def12b559b7565fb6d3956f81b55132Ian Rogers
674e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier  // 64 bit so that we can share the same asm offsets for both 32 and 64 bits.
675e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier  uint64_t callee_save_methods_[kLastCalleeSaveType];
67694f7b49578b6aaa80de8ffed230648d601393905Hiroshi Yamauchi  GcRoot<mirror::Throwable> pre_allocated_OutOfMemoryError_;
67763557459a4098294a9ff44d035241de2966047c0Ian Rogers  GcRoot<mirror::Throwable> pre_allocated_NoClassDefFoundError_;
678e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier  ArtMethod* resolution_method_;
679e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier  ArtMethod* imt_conflict_method_;
6802d2621a1463d2f3f03fa73503fa42e43657cdcfcMathieu Chartier  // Unresolved method has the same behavior as the conflict method, it is used by the class linker
6812d2621a1463d2f3f03fa73503fa42e43657cdcfcMathieu Chartier  // for differentiating between unfilled imt slots vs conflict slots in superclasses.
682e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier  ArtMethod* imt_unimplemented_method_;
6836ed19fd1b08abbc438781ae3e6fea111c1f92315Ian Rogers
684c0542af3e2170143ba40d89136e284997e16bf64Ian Rogers  // Special sentinel object used to invalid conditions in JNI (cleared weak references) and
685c0542af3e2170143ba40d89136e284997e16bf64Ian Rogers  // JDWP (invalid references).
686c0542af3e2170143ba40d89136e284997e16bf64Ian Rogers  GcRoot<mirror::Object> sentinel_;
687c0542af3e2170143ba40d89136e284997e16bf64Ian Rogers
6887624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko  InstructionSet instruction_set_;
6897624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko  QuickMethodFrameInfo callee_save_method_frame_infos_[kLastCalleeSaveType];
6907624d25dad2d1ba25969ae704fccf68649103ae5Vladimir Marko
6912b5eaa2b49f7489bafdadc4b4463ae27e4261817Vladimir Marko  CompilerCallbacks* compiler_callbacks_;
6929ca7a1fdd0daa546b790adb6a24dbc13c22df76aElliott Hughes  bool is_zygote_;
693a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light  bool must_relocate_;
694069387a60cb2b72e116cc38b32e14403f092df8fMathieu Chartier  bool is_concurrent_gc_enabled_;
6958718359763aa3dcd0033a2d2e67e0cb145fb9c53Anwar Ghuloum  bool is_explicit_gc_disabled_;
6964fcdc94d22a4608e355aa8df36240181149d10e8Nicolas Geoffray  bool dex2oat_enabled_;
69764ad14dbe2225441fb7734bf6d89358d96692eeaAlex Light  bool image_dex2oat_enabled_;
6980a5b14de5115f51e0ed2dd6c3fcc5b84bbce690eBrian Carlstrom
69912e6d7446384a7a5fbec25fe116bbb271c62842eTsu Chiang Chuang  std::string compiler_executable_;
700a59dd80f9f48cb750d329d4d4af2d99d72b484d1Alex Light  std::string patchoat_executable_;
7016449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom  std::vector<std::string> compiler_options_;
7026449c62e40ef3a9bb75f664f922555affb532ee4Brian Carlstrom  std::vector<std::string> image_compiler_options_;
70331d8f5295c24730a57cb36cbc41197f0b7e8397cBrian Carlstrom  std::string image_location_;
7047467ee05012e1fd9834df74663c1ebda46f5636bDragos Sbirlea
705a004aa933a58428489e42d77f707c2b063b73747Brian Carlstrom  std::string boot_class_path_string_;
706a004aa933a58428489e42d77f707c2b063b73747Brian Carlstrom  std::string class_path_string_;
7077ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes  std::vector<std::string> properties_;
7087ede61eceed2f8da14a4fff05c57c748c160d57fElliott Hughes
709b765be0d656c3073402693aeaf64e95a0e49f218Brian Carlstrom  // The default stack size for managed threads created by the runtime.
710be759c63c6bb58b76ac71cad2c5a736bd31f374dElliott Hughes  size_t default_stack_size_;
711b765be0d656c3073402693aeaf64e95a0e49f218Brian Carlstrom
7121d54e73444e017d3a65234e0f193846f3e27472bIan Rogers  gc::Heap* heap_;
713b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes
71425e0456b6ea13eba290b63ea88b6b7120ed89413Nicolas Geoffray  std::unique_ptr<ArenaPool> jit_arena_pool_;
7159b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier  std::unique_ptr<ArenaPool> arena_pool_;
716c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier  // Special low 4gb pool for compiler linear alloc. We need ArtFields to be in low 4gb if we are
717c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier  // compiling using a 32 bit image on a 64 bit compiler in case we resolve things in the image
718c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier  // since the field arrays are int arrays in this case.
719c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier  std::unique_ptr<ArenaPool> low_4gb_arena_pool_;
720c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier
721c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier  // Shared linear alloc for now.
722c785344b87221f5e4e6473e5b762e4e61fe65dcfMathieu Chartier  std::unique_ptr<LinearAlloc> linear_alloc_;
7239b34b244ecddd8a35c922ed87bc3df0ca4db0282Mathieu Chartier
724d9c4fc94fa618617f94e1de9af5f034549100753Ian Rogers  // The number of spins that are done before thread suspension is used to forcibly inflate.
725d9c4fc94fa618617f94e1de9af5f034549100753Ian Rogers  size_t max_spins_before_thin_lock_inflation_;
726c33a32bccc4c66ed82ce3a580b16636399385cb4Elliott Hughes  MonitorList* monitor_list_;
727ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers  MonitorPool* monitor_pool_;
728c33a32bccc4c66ed82ce3a580b16636399385cb4Elliott Hughes
729b557353b22c728eecbd1c68593b482622c7782a8Carl Shapiro  ThreadList* thread_list_;
73061e019d291583029c01b61b93bea750f2b663c37Carl Shapiro
731cf4c6c41b0084dc4567ff709fb8ce9ebd72b26acElliott Hughes  InternTable* intern_table_;
732cf4c6c41b0084dc4567ff709fb8ce9ebd72b26acElliott Hughes
733b0460eaa2cb131f1dbdd5a7217bd36b9a9f1b995Brian Carlstrom  ClassLinker* class_linker_;
734b0460eaa2cb131f1dbdd5a7217bd36b9a9f1b995Brian Carlstrom
735e27955ca3ca960928d4dbd6cb79711fce06950b3Elliott Hughes  SignalCatcher* signal_catcher_;
73694ce37a3919a0bdb8855a3d3264a50df1dbc41beElliott Hughes  std::string stack_trace_file_;
737e27955ca3ca960928d4dbd6cb79711fce06950b3Elliott Hughes
738c5f7c91ab89055cffb573fff7e06dbdd860bccedElliott Hughes  JavaVMExt* java_vm_;
739f2682d5a6ce0f7de58da8fd4ec8aec200c43b92eElliott Hughes
740e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier  std::unique_ptr<jit::Jit> jit_;
741e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier  std::unique_ptr<jit::JitOptions> jit_options_;
742e5f13e57ff8fa36342beb33830b3ec5942a61ccaMathieu Chartier
743e2facc5b18cd756a8b5500fb3d90da69c9ee0fb7Igor Murashkin  std::unique_ptr<lambda::BoxTable> lambda_box_table_;
744e2facc5b18cd756a8b5500fb3d90da69c9ee0fb7Igor Murashkin
74515d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier  // Fault message, printed when we get a SIGSEGV.
74615d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier  Mutex fault_message_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
74715d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier  std::string fault_message_ GUARDED_BY(fault_message_lock_);
74815d3402bbf8265eb1165694da2e4117eb128f3bcMathieu Chartier
749120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers  // A non-zero value indicates that a thread has been created but not yet initialized. Guarded by
750120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers  // the shutdown lock so that threads aren't born while we're shutting down.
751120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers  size_t threads_being_born_ GUARDED_BY(Locks::runtime_shutdown_lock_);
752120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers
753120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers  // Waited upon until no threads are being born.
754700a402244a1a423da4f3ba8032459f4b65fa18fIan Rogers  std::unique_ptr<ConditionVariable> shutdown_cond_ GUARDED_BY(Locks::runtime_shutdown_lock_);
755120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers
756120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers  // Set when runtime shutdown is past the point that new threads may attach.
757120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers  bool shutting_down_ GUARDED_BY(Locks::runtime_shutdown_lock_);
758120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers
759120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers  // The runtime is starting to shutdown but is blocked waiting on shutdown_cond_.
760120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers  bool shutting_down_started_ GUARDED_BY(Locks::runtime_shutdown_lock_);
761120f1c74a9768e958377b6c97897511b27ae58c8Ian Rogers
762dcc247493fd8fb243e335c3ec08e5e625896a47cElliott Hughes  bool started_;
763dcc247493fd8fb243e335c3ec08e5e625896a47cElliott Hughes
7647664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier  // New flag added which tells us if the runtime has finished starting. If
7657664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier  // this flag is set then the Daemon threads are created and the class loader
7667664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier  // is created. This flag is needed for knowing if its safe to request CMS.
7677664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier  bool finished_starting_;
7687664f5cd118b355a5fe0c7536cb48ac991ed2b62Mathieu Chartier
7696ea095ad30bf13cc00b4fee7afbbe4731a349c83Brian Carlstrom  // Hooks supported by JNI_CreateJavaVM
7706ea095ad30bf13cc00b4fee7afbbe4731a349c83Brian Carlstrom  jint (*vfprintf_)(FILE* stream, const char* format, va_list ap);
7716ea095ad30bf13cc00b4fee7afbbe4731a349c83Brian Carlstrom  void (*exit_)(jint status);
7726ea095ad30bf13cc00b4fee7afbbe4731a349c83Brian Carlstrom  void (*abort_)();
7736ea095ad30bf13cc00b4fee7afbbe4731a349c83Brian Carlstrom
7749d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes  bool stats_enabled_;
7759d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes  RuntimeStats stats_;
7769d5ccec86d60c9ddd811836b9a2bc28d0b3d11feElliott Hughes
7771e13374baf7dfaf442ffbf9809c37c131d681eafEvgenii Stepanov  const bool is_running_on_memory_tool_;
778da44d773dedf8aae6153e3423012f236cba3bfcdMathieu Chartier
7790aded089f565008ba5908e395e5914ca4f91f2deDave Allison  std::string profile_output_filename_;
780c1b643cc6ac45dbd0eabdcd7425c7e86006c27d6Calin Juravle  ProfilerOptions profiler_options_;
7810aded089f565008ba5908e395e5914ca4f91f2deDave Allison
782f6a780abeaed4bf745720e8f836a3064d3ffbec4Andreas Gampe  std::unique_ptr<TraceConfig> trace_config_;
783f6a780abeaed4bf745720e8f836a3064d3ffbec4Andreas Gampe
78462d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers  instrumentation::Instrumentation instrumentation_;
785131aef8c94292cc530da2fd91ee98d1432352959Elliott Hughes
786365c10235438607541fa2259a5fec48061b90bd8Ian Rogers  jobject main_thread_group_;
787365c10235438607541fa2259a5fec48061b90bd8Ian Rogers  jobject system_thread_group_;
788365c10235438607541fa2259a5fec48061b90bd8Ian Rogers
789ce88853ab316c70ef7b598978a3609611db60552Brian Carlstrom  // As returned by ClassLoader.getSystemClassLoader().
790ce88853ab316c70ef7b598978a3609611db60552Brian Carlstrom  jobject system_class_loader_;
791ce88853ab316c70ef7b598978a3609611db60552Brian Carlstrom
7922e899a92439dc6bdaaa67b8230933006284aa600Hiroshi Yamauchi  // If true, then we dump the GC cumulative timings on shutdown.
7932e899a92439dc6bdaaa67b8230933006284aa600Hiroshi Yamauchi  bool dump_gc_performance_on_shutdown_;
7942e899a92439dc6bdaaa67b8230933006284aa600Hiroshi Yamauchi
795d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertz  // Transaction used for pre-initializing classes at compilation time.
796ee1d79a603c77c0667b27c075a983579d5c51f7eSebastien Hertz  Transaction* preinitialization_transaction_;
797d2fe10a3a34af171bf1631219cd2d6ff6b7778b5Sebastien Hertz
7987617abdb402fd0419daa3eefb2ad059ccbb8b6dbIgor Murashkin  // If kNone, verification is disabled. kEnable by default.
7997617abdb402fd0419daa3eefb2ad059ccbb8b6dbIgor Murashkin  verifier::VerifyMode verify_;
8004a200f56b7075309316b04d550c9cc50f8314eddJeff Hao
80124e04aa68c575d349eac0d9d09aab9bd3106ef94Jean Christophe Beyler  // If true, the runtime may use dex files directly with the interpreter if an oat file is not
80224e04aa68c575d349eac0d9d09aab9bd3106ef94Jean Christophe Beyler  // available/usable.
80324e04aa68c575d349eac0d9d09aab9bd3106ef94Jean Christophe Beyler  bool allow_dex_file_fallback_;
80424e04aa68c575d349eac0d9d09aab9bd3106ef94Jean Christophe Beyler
805785049f8083e56e88dfeab5ff74fb3817f9854e3Dmitriy Ivanov  // List of supported cpu abis.
806785049f8083e56e88dfeab5ff74fb3817f9854e3Dmitriy Ivanov  std::vector<std::string> cpu_abilist_;
807785049f8083e56e88dfeab5ff74fb3817f9854e3Dmitriy Ivanov
808f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao  // Specifies target SDK version to allow workarounds for certain API levels.
809f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao  int32_t target_sdk_version_;
810f00571c4e1ae202b3b4acb6b47cbe23a65178f7fJeff Hao
81169dfe51b684dd9d510dbcb63295fe180f998efdeDave Allison  // Implicit checks flags.
81269dfe51b684dd9d510dbcb63295fe180f998efdeDave Allison  bool implicit_null_checks_;       // NullPointer checks are implicit.
81369dfe51b684dd9d510dbcb63295fe180f998efdeDave Allison  bool implicit_so_checks_;         // StackOverflow checks are implicit.
81469dfe51b684dd9d510dbcb63295fe180f998efdeDave Allison  bool implicit_suspend_checks_;    // Thread suspension checks are implicit.
81569dfe51b684dd9d510dbcb63295fe180f998efdeDave Allison
81601aaf6ef3e3e35cc8e41cf3fe899a7bf337042f4Calin Juravle  // Whether or not the sig chain (and implicitly the fault handler) should be
81701aaf6ef3e3e35cc8e41cf3fe899a7bf337042f4Calin Juravle  // disabled. Tools like dex2oat or patchoat don't need them. This enables
81801aaf6ef3e3e35cc8e41cf3fe899a7bf337042f4Calin Juravle  // building a statically link version of dex2oat.
81901aaf6ef3e3e35cc8e41cf3fe899a7bf337042f4Calin Juravle  bool no_sig_chain_;
82001aaf6ef3e3e35cc8e41cf3fe899a7bf337042f4Calin Juravle
821d3e7c6c76f564b58e66010c30b62bb56ef046f2cCalin Juravle  // Force the use of native bridge even if the app ISA matches the runtime ISA.
822d3e7c6c76f564b58e66010c30b62bb56ef046f2cCalin Juravle  bool force_native_bridge_;
823d3e7c6c76f564b58e66010c30b62bb56ef046f2cCalin Juravle
82407d83c7a25022064ac0a8dac4fe2a7a38681fa4bCalin Juravle  // Whether or not a native bridge has been loaded.
825c8423521c1d1136c70b153479b7df3bf4fd7fc2aCalin Juravle  //
826c8423521c1d1136c70b153479b7df3bf4fd7fc2aCalin Juravle  // The native bridge allows running native code compiled for a foreign ISA. The way it works is,
827c8423521c1d1136c70b153479b7df3bf4fd7fc2aCalin Juravle  // if standard dlopen fails to load native library associated with native activity, it calls to
828c8423521c1d1136c70b153479b7df3bf4fd7fc2aCalin Juravle  // the native bridge to load it and then gets the trampoline for the entry to native activity.
82907d83c7a25022064ac0a8dac4fe2a7a38681fa4bCalin Juravle  //
83007d83c7a25022064ac0a8dac4fe2a7a38681fa4bCalin Juravle  // The option 'native_bridge_library_filename' specifies the name of the native bridge.
83107d83c7a25022064ac0a8dac4fe2a7a38681fa4bCalin Juravle  // When non-empty the native bridge will be loaded from the given file. An empty value means
83207d83c7a25022064ac0a8dac4fe2a7a38681fa4bCalin Juravle  // that there's no native bridge.
83307d83c7a25022064ac0a8dac4fe2a7a38681fa4bCalin Juravle  bool is_native_bridge_loaded_;
834c8423521c1d1136c70b153479b7df3bf4fd7fc2aCalin Juravle
835f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky  // Whether we are running under native debugger.
836f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky  bool is_native_debuggable_;
837f448016e70fa91269d3750384aab1ac98d7896fdDavid Srbecky
8385a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath  // The maximum number of failed boots we allow before pruning the dalvik cache
8395a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath  // and trying again. This option is only inspected when we're running as a
8405a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath  // zygote.
8415a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath  uint32_t zygote_max_failed_boots_;
8425a2be3f40125af8b25fbbd9d55dc968168c76ed7Narayan Kamath
843158f35c98e2ec0d40d2c032b8cdce5fb60944a7fIgor Murashkin  // Enable experimental opcodes that aren't fully specified yet. The intent is to
844158f35c98e2ec0d40d2c032b8cdce5fb60944a7fIgor Murashkin  // eventually publish them as public-usable opcodes, but they aren't ready yet.
845158f35c98e2ec0d40d2c032b8cdce5fb60944a7fIgor Murashkin  //
846158f35c98e2ec0d40d2c032b8cdce5fb60944a7fIgor Murashkin  // Experimental opcodes should not be used by other production code.
847eb7c144a6aff7da673ba53d501c46f00311d4d7fAlex Light  ExperimentalFlags experimental_flags_;
848158f35c98e2ec0d40d2c032b8cdce5fb60944a7fIgor Murashkin
849dd6712578b6aa8a292bc6249295b6d2a7b182717Andreas Gampe  // Contains the build fingerprint, if given as a parameter.
850dd6712578b6aa8a292bc6249295b6d2a7b182717Andreas Gampe  std::string fingerprint_;
851dd6712578b6aa8a292bc6249295b6d2a7b182717Andreas Gampe
852f9c6fc610b27887f832e453a0da1789187293408Mathieu Chartier  // Oat file manager, keeps track of what oat files are open.
853e58991b3b2282b5761f1a6023a16c803e1c4eb45Mathieu Chartier  OatFileManager* oat_file_manager_;
854f9c6fc610b27887f832e453a0da1789187293408Mathieu Chartier
85532cc9ee0cdffecb0ec8d80a7fd55d7dccae3a7eeMathieu Chartier  // Whether or not we are on a low RAM device.
85632cc9ee0cdffecb0ec8d80a7fd55d7dccae3a7eeMathieu Chartier  bool is_low_memory_mode_;
85732cc9ee0cdffecb0ec8d80a7fd55d7dccae3a7eeMathieu Chartier
858787ae8eb018d46b4b464e3a7c8de37d9262deb61Nicolas Geoffray  // Whether the application should run in safe mode, that is, interpreter only.
859787ae8eb018d46b4b464e3a7c8de37d9262deb61Nicolas Geoffray  bool safe_mode_;
860787ae8eb018d46b4b464e3a7c8de37d9262deb61Nicolas Geoffray
861a73280df8cac1279b6dea0424722f42ef0048613Nicolas Geoffray  // Whether threads should dump their native stack on SIGQUIT.
862a73280df8cac1279b6dea0424722f42ef0048613Nicolas Geoffray  bool dump_native_stack_on_sig_quit_;
863a73280df8cac1279b6dea0424722f42ef0048613Nicolas Geoffray
864a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe  // Whether the dalvik cache was pruned when initializing the runtime.
865a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe  bool pruned_dalvik_cache_;
866a1425a1c9c98ae3fc772834933a5d55566fb5699Andreas Gampe
867f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier  // Whether or not we currently care about pause times.
868f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier  ProcessState process_state_;
869f8cb1781a4e4be5df1f845206f7b37ed89092b64Mathieu Chartier
870f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe  // Whether zygote code is in a section that should not start threads.
871f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe  bool zygote_no_threads_;
872f38a6618b453b76a3370bbf6b351971687099388Andreas Gampe
87361e019d291583029c01b61b93bea750f2b663c37Carl Shapiro  DISALLOW_COPY_AND_ASSIGN(Runtime);
8747b21670581d13db32f1384a3b2692bcfc8f57320Carl Shapiro};
8756a3c1fcb4ba42ad4d5d142c17a3712a6ddd3866fIan Rogersstd::ostream& operator<<(std::ostream& os, const Runtime::CalleeSaveType& rhs);
8767b21670581d13db32f1384a3b2692bcfc8f57320Carl Shapiro
8776b6b5f0e67ce03f38223a525612955663bc1799bCarl Shapiro}  // namespace art
8787b21670581d13db32f1384a3b2692bcfc8f57320Carl Shapiro
879fc0e3219edc9a5bf81b166e82fd5db2796eb6a0dBrian Carlstrom#endif  // ART_RUNTIME_RUNTIME_H_
880