runtime.h revision 13093d455b8266338fd713b04261c58e9dc2b164
11d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf/* 21d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf * Copyright (C) 2011 The Android Open Source Project 31d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf * 41d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf * Licensed under the Apache License, Version 2.0 (the "License"); 51d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf * you may not use this file except in compliance with the License. 61d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf * You may obtain a copy of the License at 71d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf * 81d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf * http://www.apache.org/licenses/LICENSE-2.0 91d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf * 101d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf * Unless required by applicable law or agreed to in writing, software 111d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf * distributed under the License is distributed on an "AS IS" BASIS, 121d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 131d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf * See the License for the specific language governing permissions and 141d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf * limitations under the License. 151d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf */ 161d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 171d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#ifndef ART_RUNTIME_RUNTIME_H_ 181d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#define ART_RUNTIME_RUNTIME_H_ 191d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 201d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include <jni.h> 211d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include <stdio.h> 221d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 231d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include <iosfwd> 241d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include <set> 251d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include <string> 261d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include <utility> 271d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include <vector> 281d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 291d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include "arch/instruction_set.h" 301d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include "base/macros.h" 311d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include "base/mutex.h" 321d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include "dex_file_types.h" 331d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include "experimental_flags.h" 341d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include "gc_root.h" 351d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include "instrumentation.h" 361d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include "jobject_comparator.h" 371d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include "method_reference.h" 381d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include "obj_ptr.h" 391d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include "object_callbacks.h" 401d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include "offsets.h" 411d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include "process_state.h" 421d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include "quick/quick_method_frame_info.h" 431d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include "runtime_callbacks.h" 441d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include "runtime_stats.h" 451d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf#include "safe_map.h" 461d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 471d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafnamespace art { 481d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 491d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafnamespace gc { 501d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf class AbstractSystemWeakHolder; 511d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf class Heap; 521d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf namespace collector { 531d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf class GarbageCollector; 541d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf } // namespace collector 551d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf} // namespace gc 561d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 571d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafnamespace jit { 581d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf class Jit; 591d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf class JitOptions; 601d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf} // namespace jit 611d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 621d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafnamespace mirror { 631d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf class Array; 641d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf class ClassLoader; 651d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf class DexCache; 661d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf template<class T> class ObjectArray; 671d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf template<class T> class PrimitiveArray; 681d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf typedef PrimitiveArray<int8_t> ByteArray; 691d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf class String; 701d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf class Throwable; 711d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf} // namespace mirror 721d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafnamespace ti { 731d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf class Agent; 741d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf} // namespace ti 751d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafnamespace verifier { 761d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf class MethodVerifier; 771d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf enum class VerifyMode : int8_t; 781d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf} // namespace verifier 791d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass ArenaPool; 801d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass ArtMethod; 811d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass ClassHierarchyAnalysis; 821d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass ClassLinker; 831d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass Closure; 841d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass CompilerCallbacks; 851d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass DexFile; 861d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass InternTable; 871d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass JavaVMExt; 881d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass LinearAlloc; 891d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass MonitorList; 901d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass MonitorPool; 911d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass NullPointerHandler; 921d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass OatFileManager; 931d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass Plugin; 941d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafstruct RuntimeArgumentMap; 951d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass SignalCatcher; 961d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass StackOverflowHandler; 971d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass SuspensionHandler; 981d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass ThreadList; 991d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass Trace; 1001d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafstruct TraceConfig; 1011d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass Transaction; 1021d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1031d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaftypedef std::vector<std::pair<std::string, const void*>> RuntimeOptions; 1041d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1051d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraafclass Runtime { 1061d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf public: 1071d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf // Parse raw runtime options. 1081d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf static bool ParseOptions(const RuntimeOptions& raw_options, 1091d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf bool ignore_unrecognized, 1101d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf RuntimeArgumentMap* runtime_options); 1111d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1121d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf // Creates and initializes a new runtime. 1131d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf static bool Create(RuntimeArgumentMap&& runtime_options) 1141d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf SHARED_TRYLOCK_FUNCTION(true, Locks::mutator_lock_); 1151d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1161d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf // Creates and initializes a new runtime. 1171d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf static bool Create(const RuntimeOptions& raw_options, bool ignore_unrecognized) 1181d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf SHARED_TRYLOCK_FUNCTION(true, Locks::mutator_lock_); 1191d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1201d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf // IsAotCompiler for compilers that don't have a running runtime. Only dex2oat currently. 1211d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf bool IsAotCompiler() const { 1221d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf return !UseJitCompilation() && IsCompiler(); 1231d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf } 1241d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1251d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf // IsCompiler is any runtime which has a running compiler, either dex2oat or JIT. 1261d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf bool IsCompiler() const { 1271d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf return compiler_callbacks_ != nullptr; 1281d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf } 1291d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1301d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf // If a compiler, are we compiling a boot image? 1311d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf bool IsCompilingBootImage() const; 1321d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1331d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf bool CanRelocate() const; 1341d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1351d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf bool ShouldRelocate() const { 1361d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf return must_relocate_ && CanRelocate(); 1371d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf } 1381d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1391d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf bool MustRelocateIfPossible() const { 1401d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf return must_relocate_; 1411d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf } 1421d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1431d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf bool IsDex2OatEnabled() const { 1441d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf return dex2oat_enabled_ && IsImageDex2OatEnabled(); 1451d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf } 1461d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1471d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf bool IsImageDex2OatEnabled() const { 1481d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf return image_dex2oat_enabled_; 1491d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf } 1501d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1511d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf CompilerCallbacks* GetCompilerCallbacks() { 1521d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf return compiler_callbacks_; 1531d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf } 1541d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1551d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf void SetCompilerCallbacks(CompilerCallbacks* callbacks) { 1561d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf CHECK(callbacks != nullptr); 1571d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf compiler_callbacks_ = callbacks; 1581d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf } 1591d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1601d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf bool IsZygote() const { 1611d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf return is_zygote_; 1621d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf } 1631d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1641d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf bool IsExplicitGcDisabled() const { 1651d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf return is_explicit_gc_disabled_; 1661d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf } 1671d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1681d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf std::string GetCompilerExecutable() const; 1691d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf std::string GetPatchoatExecutable() const; 1701d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1711d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf const std::vector<std::string>& GetCompilerOptions() const { 1721d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf return compiler_options_; 1731d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf } 1741d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1751d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf void AddCompilerOption(const std::string& option) { 1761d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf compiler_options_.push_back(option); 1771d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf } 1781d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1791d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf const std::vector<std::string>& GetImageCompilerOptions() const { 1801d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf return image_compiler_options_; 1811d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf } 1821d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1831d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf const std::string& GetImageLocation() const { 1841d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf return image_location_; 1851d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf } 1861d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf 1871d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf // Starts a runtime, which may cause threads to be started and code to run. 1881d0268c6b855531eedd297f1cb7e4ac5817c9103Brent DeGraaf bool Start() UNLOCK_FUNCTION(Locks::mutator_lock_); 189 190 bool IsShuttingDown(Thread* self); 191 bool IsShuttingDownLocked() const REQUIRES(Locks::runtime_shutdown_lock_) { 192 return shutting_down_; 193 } 194 195 size_t NumberOfThreadsBeingBorn() const REQUIRES(Locks::runtime_shutdown_lock_) { 196 return threads_being_born_; 197 } 198 199 void StartThreadBirth() REQUIRES(Locks::runtime_shutdown_lock_) { 200 threads_being_born_++; 201 } 202 203 void EndThreadBirth() REQUIRES(Locks::runtime_shutdown_lock_); 204 205 bool IsStarted() const { 206 return started_; 207 } 208 209 bool IsFinishedStarting() const { 210 return finished_starting_; 211 } 212 213 static Runtime* Current() { 214 return instance_; 215 } 216 217 // Aborts semi-cleanly. Used in the implementation of LOG(FATAL), which most 218 // callers should prefer. 219 NO_RETURN static void Abort(const char* msg) REQUIRES(!Locks::abort_lock_); 220 221 // Returns the "main" ThreadGroup, used when attaching user threads. 222 jobject GetMainThreadGroup() const; 223 224 // Returns the "system" ThreadGroup, used when attaching our internal threads. 225 jobject GetSystemThreadGroup() const; 226 227 // Returns the system ClassLoader which represents the CLASSPATH. 228 jobject GetSystemClassLoader() const; 229 230 // Attaches the calling native thread to the runtime. 231 bool AttachCurrentThread(const char* thread_name, bool as_daemon, jobject thread_group, 232 bool create_peer); 233 234 void CallExitHook(jint status); 235 236 // Detaches the current native thread from the runtime. 237 void DetachCurrentThread() REQUIRES(!Locks::mutator_lock_); 238 239 void DumpForSigQuit(std::ostream& os); 240 void DumpLockHolders(std::ostream& os); 241 242 ~Runtime(); 243 244 const std::string& GetBootClassPathString() const { 245 return boot_class_path_string_; 246 } 247 248 const std::string& GetClassPathString() const { 249 return class_path_string_; 250 } 251 252 ClassLinker* GetClassLinker() const { 253 return class_linker_; 254 } 255 256 size_t GetDefaultStackSize() const { 257 return default_stack_size_; 258 } 259 260 gc::Heap* GetHeap() const { 261 return heap_; 262 } 263 264 InternTable* GetInternTable() const { 265 DCHECK(intern_table_ != nullptr); 266 return intern_table_; 267 } 268 269 JavaVMExt* GetJavaVM() const { 270 return java_vm_.get(); 271 } 272 273 size_t GetMaxSpinsBeforeThinLockInflation() const { 274 return max_spins_before_thin_lock_inflation_; 275 } 276 277 MonitorList* GetMonitorList() const { 278 return monitor_list_; 279 } 280 281 MonitorPool* GetMonitorPool() const { 282 return monitor_pool_; 283 } 284 285 // Is the given object the special object used to mark a cleared JNI weak global? 286 bool IsClearedJniWeakGlobal(ObjPtr<mirror::Object> obj) REQUIRES_SHARED(Locks::mutator_lock_); 287 288 // Get the special object used to mark a cleared JNI weak global. 289 mirror::Object* GetClearedJniWeakGlobal() REQUIRES_SHARED(Locks::mutator_lock_); 290 291 mirror::Throwable* GetPreAllocatedOutOfMemoryError() REQUIRES_SHARED(Locks::mutator_lock_); 292 293 mirror::Throwable* GetPreAllocatedNoClassDefFoundError() 294 REQUIRES_SHARED(Locks::mutator_lock_); 295 296 const std::vector<std::string>& GetProperties() const { 297 return properties_; 298 } 299 300 ThreadList* GetThreadList() const { 301 return thread_list_; 302 } 303 304 static const char* GetVersion() { 305 return "2.1.0"; 306 } 307 308 bool IsMethodHandlesEnabled() const { 309 return true; 310 } 311 312 void DisallowNewSystemWeaks() REQUIRES_SHARED(Locks::mutator_lock_); 313 void AllowNewSystemWeaks() REQUIRES_SHARED(Locks::mutator_lock_); 314 // broadcast_for_checkpoint is true when we broadcast for making blocking threads to respond to 315 // checkpoint requests. It's false when we broadcast to unblock blocking threads after system weak 316 // access is reenabled. 317 void BroadcastForNewSystemWeaks(bool broadcast_for_checkpoint = false); 318 319 // Visit all the roots. If only_dirty is true then non-dirty roots won't be visited. If 320 // clean_dirty is true then dirty roots will be marked as non-dirty after visiting. 321 void VisitRoots(RootVisitor* visitor, VisitRootFlags flags = kVisitRootFlagAllRoots) 322 REQUIRES(!Locks::classlinker_classes_lock_, !Locks::trace_lock_) 323 REQUIRES_SHARED(Locks::mutator_lock_); 324 325 // Visit image roots, only used for hprof since the GC uses the image space mod union table 326 // instead. 327 void VisitImageRoots(RootVisitor* visitor) REQUIRES_SHARED(Locks::mutator_lock_); 328 329 // Visit all of the roots we can do safely do concurrently. 330 void VisitConcurrentRoots(RootVisitor* visitor, 331 VisitRootFlags flags = kVisitRootFlagAllRoots) 332 REQUIRES(!Locks::classlinker_classes_lock_, !Locks::trace_lock_) 333 REQUIRES_SHARED(Locks::mutator_lock_); 334 335 // Visit all of the non thread roots, we can do this with mutators unpaused. 336 void VisitNonThreadRoots(RootVisitor* visitor) 337 REQUIRES_SHARED(Locks::mutator_lock_); 338 339 void VisitTransactionRoots(RootVisitor* visitor) 340 REQUIRES_SHARED(Locks::mutator_lock_); 341 342 // Flip thread roots from from-space refs to to-space refs. 343 size_t FlipThreadRoots(Closure* thread_flip_visitor, Closure* flip_callback, 344 gc::collector::GarbageCollector* collector) 345 REQUIRES(!Locks::mutator_lock_); 346 347 // Sweep system weaks, the system weak is deleted if the visitor return null. Otherwise, the 348 // system weak is updated to be the visitor's returned value. 349 void SweepSystemWeaks(IsMarkedVisitor* visitor) 350 REQUIRES_SHARED(Locks::mutator_lock_); 351 352 // Returns a special method that calls into a trampoline for runtime method resolution 353 ArtMethod* GetResolutionMethod(); 354 355 bool HasResolutionMethod() const { 356 return resolution_method_ != nullptr; 357 } 358 359 void SetResolutionMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_); 360 361 ArtMethod* CreateResolutionMethod() REQUIRES_SHARED(Locks::mutator_lock_); 362 363 // Returns a special method that calls into a trampoline for runtime imt conflicts. 364 ArtMethod* GetImtConflictMethod(); 365 ArtMethod* GetImtUnimplementedMethod(); 366 367 bool HasImtConflictMethod() const { 368 return imt_conflict_method_ != nullptr; 369 } 370 371 void FixupConflictTables(); 372 void SetImtConflictMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_); 373 void SetImtUnimplementedMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_); 374 375 ArtMethod* CreateImtConflictMethod(LinearAlloc* linear_alloc) 376 REQUIRES_SHARED(Locks::mutator_lock_); 377 378 // Returns a special method that describes all callee saves being spilled to the stack. 379 enum CalleeSaveType { 380 kSaveAllCalleeSaves, // All callee-save registers. 381 kSaveRefsOnly, // Only those callee-save registers that can hold references. 382 kSaveRefsAndArgs, // References (see above) and arguments (usually caller-save registers). 383 kSaveEverything, // All registers, including both callee-save and caller-save. 384 kLastCalleeSaveType // Value used for iteration 385 }; 386 387 bool HasCalleeSaveMethod(CalleeSaveType type) const { 388 return callee_save_methods_[type] != 0u; 389 } 390 391 ArtMethod* GetCalleeSaveMethod(CalleeSaveType type) 392 REQUIRES_SHARED(Locks::mutator_lock_); 393 394 ArtMethod* GetCalleeSaveMethodUnchecked(CalleeSaveType type) 395 REQUIRES_SHARED(Locks::mutator_lock_); 396 397 QuickMethodFrameInfo GetCalleeSaveMethodFrameInfo(CalleeSaveType type) const { 398 return callee_save_method_frame_infos_[type]; 399 } 400 401 QuickMethodFrameInfo GetRuntimeMethodFrameInfo(ArtMethod* method) 402 REQUIRES_SHARED(Locks::mutator_lock_); 403 404 static size_t GetCalleeSaveMethodOffset(CalleeSaveType type) { 405 return OFFSETOF_MEMBER(Runtime, callee_save_methods_[type]); 406 } 407 408 InstructionSet GetInstructionSet() const { 409 return instruction_set_; 410 } 411 412 void SetInstructionSet(InstructionSet instruction_set); 413 414 void SetCalleeSaveMethod(ArtMethod* method, CalleeSaveType type); 415 416 ArtMethod* CreateCalleeSaveMethod() REQUIRES_SHARED(Locks::mutator_lock_); 417 418 int32_t GetStat(int kind); 419 420 RuntimeStats* GetStats() { 421 return &stats_; 422 } 423 424 bool HasStatsEnabled() const { 425 return stats_enabled_; 426 } 427 428 void ResetStats(int kinds); 429 430 void SetStatsEnabled(bool new_state) 431 REQUIRES(!Locks::instrument_entrypoints_lock_, !Locks::mutator_lock_); 432 433 enum class NativeBridgeAction { // private 434 kUnload, 435 kInitialize 436 }; 437 438 jit::Jit* GetJit() { 439 return jit_.get(); 440 } 441 442 // Returns true if JIT compilations are enabled. GetJit() will be not null in this case. 443 bool UseJitCompilation() const; 444 445 void PreZygoteFork(); 446 void InitNonZygoteOrPostFork( 447 JNIEnv* env, bool is_system_server, NativeBridgeAction action, const char* isa); 448 449 const instrumentation::Instrumentation* GetInstrumentation() const { 450 return &instrumentation_; 451 } 452 453 instrumentation::Instrumentation* GetInstrumentation() { 454 return &instrumentation_; 455 } 456 457 void RegisterAppInfo(const std::vector<std::string>& code_paths, 458 const std::string& profile_output_filename, 459 const std::string& foreign_dex_profile_path, 460 const std::string& app_dir); 461 void NotifyDexLoaded(const std::string& dex_location); 462 463 // Transaction support. 464 bool IsActiveTransaction() const { 465 return preinitialization_transaction_ != nullptr; 466 } 467 void EnterTransactionMode(Transaction* transaction); 468 void ExitTransactionMode(); 469 bool IsTransactionAborted() const; 470 471 void AbortTransactionAndThrowAbortError(Thread* self, const std::string& abort_message) 472 REQUIRES_SHARED(Locks::mutator_lock_); 473 void ThrowTransactionAbortError(Thread* self) 474 REQUIRES_SHARED(Locks::mutator_lock_); 475 476 void RecordWriteFieldBoolean(mirror::Object* obj, MemberOffset field_offset, uint8_t value, 477 bool is_volatile) const; 478 void RecordWriteFieldByte(mirror::Object* obj, MemberOffset field_offset, int8_t value, 479 bool is_volatile) const; 480 void RecordWriteFieldChar(mirror::Object* obj, MemberOffset field_offset, uint16_t value, 481 bool is_volatile) const; 482 void RecordWriteFieldShort(mirror::Object* obj, MemberOffset field_offset, int16_t value, 483 bool is_volatile) const; 484 void RecordWriteField32(mirror::Object* obj, MemberOffset field_offset, uint32_t value, 485 bool is_volatile) const; 486 void RecordWriteField64(mirror::Object* obj, MemberOffset field_offset, uint64_t value, 487 bool is_volatile) const; 488 void RecordWriteFieldReference(mirror::Object* obj, 489 MemberOffset field_offset, 490 ObjPtr<mirror::Object> value, 491 bool is_volatile) const 492 REQUIRES_SHARED(Locks::mutator_lock_); 493 void RecordWriteArray(mirror::Array* array, size_t index, uint64_t value) const 494 REQUIRES_SHARED(Locks::mutator_lock_); 495 void RecordStrongStringInsertion(ObjPtr<mirror::String> s) const 496 REQUIRES(Locks::intern_table_lock_); 497 void RecordWeakStringInsertion(ObjPtr<mirror::String> s) const 498 REQUIRES(Locks::intern_table_lock_); 499 void RecordStrongStringRemoval(ObjPtr<mirror::String> s) const 500 REQUIRES(Locks::intern_table_lock_); 501 void RecordWeakStringRemoval(ObjPtr<mirror::String> s) const 502 REQUIRES(Locks::intern_table_lock_); 503 void RecordResolveString(ObjPtr<mirror::DexCache> dex_cache, dex::StringIndex string_idx) const 504 REQUIRES_SHARED(Locks::mutator_lock_); 505 506 void SetFaultMessage(const std::string& message) REQUIRES(!fault_message_lock_); 507 // Only read by the signal handler, NO_THREAD_SAFETY_ANALYSIS to prevent lock order violations 508 // with the unexpected_signal_lock_. 509 const std::string& GetFaultMessage() NO_THREAD_SAFETY_ANALYSIS { 510 return fault_message_; 511 } 512 513 void AddCurrentRuntimeFeaturesAsDex2OatArguments(std::vector<std::string>* arg_vector) const; 514 515 bool ExplicitStackOverflowChecks() const { 516 return !implicit_so_checks_; 517 } 518 519 bool IsVerificationEnabled() const; 520 bool IsVerificationSoftFail() const; 521 522 bool IsDexFileFallbackEnabled() const { 523 return allow_dex_file_fallback_; 524 } 525 526 const std::vector<std::string>& GetCpuAbilist() const { 527 return cpu_abilist_; 528 } 529 530 bool IsRunningOnMemoryTool() const { 531 return is_running_on_memory_tool_; 532 } 533 534 void SetTargetSdkVersion(int32_t version) { 535 target_sdk_version_ = version; 536 } 537 538 int32_t GetTargetSdkVersion() const { 539 return target_sdk_version_; 540 } 541 542 uint32_t GetZygoteMaxFailedBoots() const { 543 return zygote_max_failed_boots_; 544 } 545 546 bool AreExperimentalFlagsEnabled(ExperimentalFlags flags) { 547 return (experimental_flags_ & flags) != ExperimentalFlags::kNone; 548 } 549 550 // Create the JIT and instrumentation and code cache. 551 void CreateJit(); 552 553 ArenaPool* GetArenaPool() { 554 return arena_pool_.get(); 555 } 556 ArenaPool* GetJitArenaPool() { 557 return jit_arena_pool_.get(); 558 } 559 const ArenaPool* GetArenaPool() const { 560 return arena_pool_.get(); 561 } 562 563 void ReclaimArenaPoolMemory(); 564 565 LinearAlloc* GetLinearAlloc() { 566 return linear_alloc_.get(); 567 } 568 569 jit::JitOptions* GetJITOptions() { 570 return jit_options_.get(); 571 } 572 573 bool IsDebuggable() const; 574 575 bool IsFullyDeoptable() const { 576 return is_fully_deoptable_; 577 } 578 579 void SetFullyDeoptable(bool value) { 580 is_fully_deoptable_ = value; 581 } 582 583 bool IsNativeDebuggable() const { 584 return is_native_debuggable_; 585 } 586 587 void SetNativeDebuggable(bool value) { 588 is_native_debuggable_ = value; 589 } 590 591 // Returns the build fingerprint, if set. Otherwise an empty string is returned. 592 std::string GetFingerprint() { 593 return fingerprint_; 594 } 595 596 // Called from class linker. 597 void SetSentinel(mirror::Object* sentinel) REQUIRES_SHARED(Locks::mutator_lock_); 598 599 // Create a normal LinearAlloc or low 4gb version if we are 64 bit AOT compiler. 600 LinearAlloc* CreateLinearAlloc(); 601 602 OatFileManager& GetOatFileManager() const { 603 DCHECK(oat_file_manager_ != nullptr); 604 return *oat_file_manager_; 605 } 606 607 double GetHashTableMinLoadFactor() const; 608 double GetHashTableMaxLoadFactor() const; 609 610 void SetSafeMode(bool mode) { 611 safe_mode_ = mode; 612 } 613 614 bool GetDumpNativeStackOnSigQuit() const { 615 return dump_native_stack_on_sig_quit_; 616 } 617 618 bool GetPrunedDalvikCache() const { 619 return pruned_dalvik_cache_; 620 } 621 622 void SetPrunedDalvikCache(bool pruned) { 623 pruned_dalvik_cache_ = pruned; 624 } 625 626 void UpdateProcessState(ProcessState process_state); 627 628 // Returns true if we currently care about long mutator pause. 629 bool InJankPerceptibleProcessState() const { 630 return process_state_ == kProcessStateJankPerceptible; 631 } 632 633 void RegisterSensitiveThread() const; 634 635 void SetZygoteNoThreadSection(bool val) { 636 zygote_no_threads_ = val; 637 } 638 639 bool IsZygoteNoThreadSection() const { 640 return zygote_no_threads_; 641 } 642 643 // Returns if the code can be deoptimized. Code may be compiled with some 644 // optimization that makes it impossible to deoptimize. 645 bool IsDeoptimizeable(uintptr_t code) const REQUIRES_SHARED(Locks::mutator_lock_); 646 647 // Returns a saved copy of the environment (getenv/setenv values). 648 // Used by Fork to protect against overwriting LD_LIBRARY_PATH, etc. 649 char** GetEnvSnapshot() const { 650 return env_snapshot_.GetSnapshot(); 651 } 652 653 void AddSystemWeakHolder(gc::AbstractSystemWeakHolder* holder); 654 void RemoveSystemWeakHolder(gc::AbstractSystemWeakHolder* holder); 655 656 ClassHierarchyAnalysis* GetClassHierarchyAnalysis() { 657 return cha_; 658 } 659 660 NO_RETURN 661 static void Aborter(const char* abort_message); 662 663 void AttachAgent(const std::string& agent_arg); 664 665 RuntimeCallbacks& GetRuntimeCallbacks() { 666 return callbacks_; 667 } 668 669 private: 670 static void InitPlatformSignalHandlers(); 671 672 Runtime(); 673 674 void BlockSignals(); 675 676 bool Init(RuntimeArgumentMap&& runtime_options) 677 SHARED_TRYLOCK_FUNCTION(true, Locks::mutator_lock_); 678 void InitNativeMethods() REQUIRES(!Locks::mutator_lock_); 679 void InitThreadGroups(Thread* self); 680 void RegisterRuntimeNativeMethods(JNIEnv* env); 681 682 void StartDaemonThreads(); 683 void StartSignalCatcher(); 684 685 void MaybeSaveJitProfilingInfo(); 686 687 // Visit all of the thread roots. 688 void VisitThreadRoots(RootVisitor* visitor, VisitRootFlags flags) 689 REQUIRES_SHARED(Locks::mutator_lock_); 690 691 // Visit all other roots which must be done with mutators suspended. 692 void VisitNonConcurrentRoots(RootVisitor* visitor, VisitRootFlags flags) 693 REQUIRES_SHARED(Locks::mutator_lock_); 694 695 // Constant roots are the roots which never change after the runtime is initialized, they only 696 // need to be visited once per GC cycle. 697 void VisitConstantRoots(RootVisitor* visitor) 698 REQUIRES_SHARED(Locks::mutator_lock_); 699 700 // A pointer to the active runtime or null. 701 static Runtime* instance_; 702 703 // NOTE: these must match the gc::ProcessState values as they come directly from the framework. 704 static constexpr int kProfileForground = 0; 705 static constexpr int kProfileBackground = 1; 706 707 // 64 bit so that we can share the same asm offsets for both 32 and 64 bits. 708 uint64_t callee_save_methods_[kLastCalleeSaveType]; 709 GcRoot<mirror::Throwable> pre_allocated_OutOfMemoryError_; 710 GcRoot<mirror::Throwable> pre_allocated_NoClassDefFoundError_; 711 ArtMethod* resolution_method_; 712 ArtMethod* imt_conflict_method_; 713 // Unresolved method has the same behavior as the conflict method, it is used by the class linker 714 // for differentiating between unfilled imt slots vs conflict slots in superclasses. 715 ArtMethod* imt_unimplemented_method_; 716 717 // Special sentinel object used to invalid conditions in JNI (cleared weak references) and 718 // JDWP (invalid references). 719 GcRoot<mirror::Object> sentinel_; 720 721 InstructionSet instruction_set_; 722 QuickMethodFrameInfo callee_save_method_frame_infos_[kLastCalleeSaveType]; 723 724 CompilerCallbacks* compiler_callbacks_; 725 bool is_zygote_; 726 bool must_relocate_; 727 bool is_concurrent_gc_enabled_; 728 bool is_explicit_gc_disabled_; 729 bool dex2oat_enabled_; 730 bool image_dex2oat_enabled_; 731 732 std::string compiler_executable_; 733 std::string patchoat_executable_; 734 std::vector<std::string> compiler_options_; 735 std::vector<std::string> image_compiler_options_; 736 std::string image_location_; 737 738 std::string boot_class_path_string_; 739 std::string class_path_string_; 740 std::vector<std::string> properties_; 741 742 std::vector<ti::Agent> agents_; 743 std::vector<Plugin> plugins_; 744 745 // The default stack size for managed threads created by the runtime. 746 size_t default_stack_size_; 747 748 gc::Heap* heap_; 749 750 std::unique_ptr<ArenaPool> jit_arena_pool_; 751 std::unique_ptr<ArenaPool> arena_pool_; 752 // Special low 4gb pool for compiler linear alloc. We need ArtFields to be in low 4gb if we are 753 // compiling using a 32 bit image on a 64 bit compiler in case we resolve things in the image 754 // since the field arrays are int arrays in this case. 755 std::unique_ptr<ArenaPool> low_4gb_arena_pool_; 756 757 // Shared linear alloc for now. 758 std::unique_ptr<LinearAlloc> linear_alloc_; 759 760 // The number of spins that are done before thread suspension is used to forcibly inflate. 761 size_t max_spins_before_thin_lock_inflation_; 762 MonitorList* monitor_list_; 763 MonitorPool* monitor_pool_; 764 765 ThreadList* thread_list_; 766 767 InternTable* intern_table_; 768 769 ClassLinker* class_linker_; 770 771 SignalCatcher* signal_catcher_; 772 std::string stack_trace_file_; 773 774 std::unique_ptr<JavaVMExt> java_vm_; 775 776 std::unique_ptr<jit::Jit> jit_; 777 std::unique_ptr<jit::JitOptions> jit_options_; 778 779 // Fault message, printed when we get a SIGSEGV. 780 Mutex fault_message_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; 781 std::string fault_message_ GUARDED_BY(fault_message_lock_); 782 783 // A non-zero value indicates that a thread has been created but not yet initialized. Guarded by 784 // the shutdown lock so that threads aren't born while we're shutting down. 785 size_t threads_being_born_ GUARDED_BY(Locks::runtime_shutdown_lock_); 786 787 // Waited upon until no threads are being born. 788 std::unique_ptr<ConditionVariable> shutdown_cond_ GUARDED_BY(Locks::runtime_shutdown_lock_); 789 790 // Set when runtime shutdown is past the point that new threads may attach. 791 bool shutting_down_ GUARDED_BY(Locks::runtime_shutdown_lock_); 792 793 // The runtime is starting to shutdown but is blocked waiting on shutdown_cond_. 794 bool shutting_down_started_ GUARDED_BY(Locks::runtime_shutdown_lock_); 795 796 bool started_; 797 798 // New flag added which tells us if the runtime has finished starting. If 799 // this flag is set then the Daemon threads are created and the class loader 800 // is created. This flag is needed for knowing if its safe to request CMS. 801 bool finished_starting_; 802 803 // Hooks supported by JNI_CreateJavaVM 804 jint (*vfprintf_)(FILE* stream, const char* format, va_list ap); 805 void (*exit_)(jint status); 806 void (*abort_)(); 807 808 bool stats_enabled_; 809 RuntimeStats stats_; 810 811 const bool is_running_on_memory_tool_; 812 813 std::unique_ptr<TraceConfig> trace_config_; 814 815 instrumentation::Instrumentation instrumentation_; 816 817 jobject main_thread_group_; 818 jobject system_thread_group_; 819 820 // As returned by ClassLoader.getSystemClassLoader(). 821 jobject system_class_loader_; 822 823 // If true, then we dump the GC cumulative timings on shutdown. 824 bool dump_gc_performance_on_shutdown_; 825 826 // Transaction used for pre-initializing classes at compilation time. 827 Transaction* preinitialization_transaction_; 828 829 // If kNone, verification is disabled. kEnable by default. 830 verifier::VerifyMode verify_; 831 832 // If true, the runtime may use dex files directly with the interpreter if an oat file is not 833 // available/usable. 834 bool allow_dex_file_fallback_; 835 836 // List of supported cpu abis. 837 std::vector<std::string> cpu_abilist_; 838 839 // Specifies target SDK version to allow workarounds for certain API levels. 840 int32_t target_sdk_version_; 841 842 // Implicit checks flags. 843 bool implicit_null_checks_; // NullPointer checks are implicit. 844 bool implicit_so_checks_; // StackOverflow checks are implicit. 845 bool implicit_suspend_checks_; // Thread suspension checks are implicit. 846 847 // Whether or not the sig chain (and implicitly the fault handler) should be 848 // disabled. Tools like dex2oat or patchoat don't need them. This enables 849 // building a statically link version of dex2oat. 850 bool no_sig_chain_; 851 852 // Force the use of native bridge even if the app ISA matches the runtime ISA. 853 bool force_native_bridge_; 854 855 // Whether or not a native bridge has been loaded. 856 // 857 // The native bridge allows running native code compiled for a foreign ISA. The way it works is, 858 // if standard dlopen fails to load native library associated with native activity, it calls to 859 // the native bridge to load it and then gets the trampoline for the entry to native activity. 860 // 861 // The option 'native_bridge_library_filename' specifies the name of the native bridge. 862 // When non-empty the native bridge will be loaded from the given file. An empty value means 863 // that there's no native bridge. 864 bool is_native_bridge_loaded_; 865 866 // Whether we are running under native debugger. 867 bool is_native_debuggable_; 868 869 // Whether we are expected to be deoptable at all points. 870 bool is_fully_deoptable_; 871 872 // The maximum number of failed boots we allow before pruning the dalvik cache 873 // and trying again. This option is only inspected when we're running as a 874 // zygote. 875 uint32_t zygote_max_failed_boots_; 876 877 // Enable experimental opcodes that aren't fully specified yet. The intent is to 878 // eventually publish them as public-usable opcodes, but they aren't ready yet. 879 // 880 // Experimental opcodes should not be used by other production code. 881 ExperimentalFlags experimental_flags_; 882 883 // Contains the build fingerprint, if given as a parameter. 884 std::string fingerprint_; 885 886 // Oat file manager, keeps track of what oat files are open. 887 OatFileManager* oat_file_manager_; 888 889 // Whether or not we are on a low RAM device. 890 bool is_low_memory_mode_; 891 892 // Whether the application should run in safe mode, that is, interpreter only. 893 bool safe_mode_; 894 895 // Whether threads should dump their native stack on SIGQUIT. 896 bool dump_native_stack_on_sig_quit_; 897 898 // Whether the dalvik cache was pruned when initializing the runtime. 899 bool pruned_dalvik_cache_; 900 901 // Whether or not we currently care about pause times. 902 ProcessState process_state_; 903 904 // Whether zygote code is in a section that should not start threads. 905 bool zygote_no_threads_; 906 907 // Saved environment. 908 class EnvSnapshot { 909 public: 910 EnvSnapshot() = default; 911 void TakeSnapshot(); 912 char** GetSnapshot() const; 913 914 private: 915 std::unique_ptr<char*[]> c_env_vector_; 916 std::vector<std::unique_ptr<std::string>> name_value_pairs_; 917 918 DISALLOW_COPY_AND_ASSIGN(EnvSnapshot); 919 } env_snapshot_; 920 921 // Generic system-weak holders. 922 std::vector<gc::AbstractSystemWeakHolder*> system_weak_holders_; 923 924 ClassHierarchyAnalysis* cha_; 925 926 RuntimeCallbacks callbacks_; 927 928 DISALLOW_COPY_AND_ASSIGN(Runtime); 929}; 930std::ostream& operator<<(std::ostream& os, const Runtime::CalleeSaveType& rhs); 931 932} // namespace art 933 934#endif // ART_RUNTIME_RUNTIME_H_ 935