runtime.h revision 015b137efb434528173779bc3ec8d72494456254
1/* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#ifndef ART_RUNTIME_RUNTIME_H_ 18#define ART_RUNTIME_RUNTIME_H_ 19 20#include <jni.h> 21#include <stdio.h> 22 23#include <iosfwd> 24#include <set> 25#include <string> 26#include <utility> 27#include <vector> 28 29#include "arch/instruction_set.h" 30#include "base/allocator.h" 31#include "compiler_callbacks.h" 32#include "gc_root.h" 33#include "instrumentation.h" 34#include "jobject_comparator.h" 35#include "object_callbacks.h" 36#include "offsets.h" 37#include "profiler_options.h" 38#include "quick/quick_method_frame_info.h" 39#include "runtime_stats.h" 40#include "safe_map.h" 41 42namespace art { 43 44namespace gc { 45 class Heap; 46} // namespace gc 47namespace mirror { 48 class ArtMethod; 49 class ClassLoader; 50 class Array; 51 template<class T> class ObjectArray; 52 template<class T> class PrimitiveArray; 53 typedef PrimitiveArray<int8_t> ByteArray; 54 class String; 55 class Throwable; 56} // namespace mirror 57namespace verifier { 58 class MethodVerifier; 59} // namespace verifier 60class ClassLinker; 61class DexFile; 62class InternTable; 63class JavaVMExt; 64class MonitorList; 65class MonitorPool; 66class NullPointerHandler; 67class SignalCatcher; 68class StackOverflowHandler; 69class SuspensionHandler; 70class ThreadList; 71class Trace; 72class Transaction; 73 74// 0 if not abort, non-zero if an abort is in progress. Used on fatal exit to prevents recursive 75// aborts. Global declaration allows us to disable some error checking to ensure fatal shutdown 76// makes forward progress. 77extern volatile unsigned int gAborting; 78 79typedef std::vector<std::pair<std::string, const void*>> RuntimeOptions; 80 81// Not all combinations of flags are valid. You may not visit all roots as well as the new roots 82// (no logical reason to do this). You also may not start logging new roots and stop logging new 83// roots (also no logical reason to do this). 84enum VisitRootFlags : uint8_t { 85 kVisitRootFlagAllRoots = 0x1, 86 kVisitRootFlagNewRoots = 0x2, 87 kVisitRootFlagStartLoggingNewRoots = 0x4, 88 kVisitRootFlagStopLoggingNewRoots = 0x8, 89 kVisitRootFlagClearRootLog = 0x10, 90}; 91 92class Runtime { 93 public: 94 // Creates and initializes a new runtime. 95 static bool Create(const RuntimeOptions& options, bool ignore_unrecognized) 96 SHARED_TRYLOCK_FUNCTION(true, Locks::mutator_lock_); 97 98 bool IsCompiler() const { 99 return compiler_callbacks_ != nullptr; 100 } 101 102 bool CanRelocate() const { 103 return !IsCompiler() || compiler_callbacks_->IsRelocationPossible(); 104 } 105 106 bool ShouldRelocate() const { 107 return must_relocate_ && CanRelocate(); 108 } 109 110 bool MustRelocateIfPossible() const { 111 return must_relocate_; 112 } 113 114 bool IsDex2OatEnabled() const { 115 return dex2oat_enabled_ && IsImageDex2OatEnabled(); 116 } 117 118 bool IsImageDex2OatEnabled() const { 119 return image_dex2oat_enabled_; 120 } 121 122 CompilerCallbacks* GetCompilerCallbacks() { 123 return compiler_callbacks_; 124 } 125 126 bool IsZygote() const { 127 return is_zygote_; 128 } 129 130 bool IsExplicitGcDisabled() const { 131 return is_explicit_gc_disabled_; 132 } 133 134 std::string GetCompilerExecutable() const; 135 std::string GetPatchoatExecutable() const; 136 137 const std::vector<std::string>& GetCompilerOptions() const { 138 return compiler_options_; 139 } 140 141 const std::vector<std::string>& GetImageCompilerOptions() const { 142 return image_compiler_options_; 143 } 144 145 const std::string& GetImageLocation() const { 146 return image_location_; 147 } 148 149 const ProfilerOptions& GetProfilerOptions() const { 150 return profiler_options_; 151 } 152 153 // Starts a runtime, which may cause threads to be started and code to run. 154 bool Start() UNLOCK_FUNCTION(Locks::mutator_lock_); 155 156 bool IsShuttingDown(Thread* self); 157 bool IsShuttingDownLocked() const EXCLUSIVE_LOCKS_REQUIRED(Locks::runtime_shutdown_lock_) { 158 return shutting_down_; 159 } 160 161 size_t NumberOfThreadsBeingBorn() const EXCLUSIVE_LOCKS_REQUIRED(Locks::runtime_shutdown_lock_) { 162 return threads_being_born_; 163 } 164 165 void StartThreadBirth() EXCLUSIVE_LOCKS_REQUIRED(Locks::runtime_shutdown_lock_) { 166 threads_being_born_++; 167 } 168 169 void EndThreadBirth() EXCLUSIVE_LOCKS_REQUIRED(Locks::runtime_shutdown_lock_); 170 171 bool IsStarted() const { 172 return started_; 173 } 174 175 bool IsFinishedStarting() const { 176 return finished_starting_; 177 } 178 179 static Runtime* Current() { 180 return instance_; 181 } 182 183 // Aborts semi-cleanly. Used in the implementation of LOG(FATAL), which most callers should 184 // prefer. Not [[noreturn]] due to returning early in the case of recursive aborts. 185 static void Abort() LOCKS_EXCLUDED(Locks::abort_lock_); 186 187 // Returns the "main" ThreadGroup, used when attaching user threads. 188 jobject GetMainThreadGroup() const; 189 190 // Returns the "system" ThreadGroup, used when attaching our internal threads. 191 jobject GetSystemThreadGroup() const; 192 193 // Returns the system ClassLoader which represents the CLASSPATH. 194 jobject GetSystemClassLoader() const; 195 196 // Attaches the calling native thread to the runtime. 197 bool AttachCurrentThread(const char* thread_name, bool as_daemon, jobject thread_group, 198 bool create_peer); 199 200 void CallExitHook(jint status); 201 202 // Detaches the current native thread from the runtime. 203 void DetachCurrentThread() LOCKS_EXCLUDED(Locks::mutator_lock_); 204 205 void DumpForSigQuit(std::ostream& os); 206 void DumpLockHolders(std::ostream& os); 207 208 ~Runtime(); 209 210 const std::string& GetBootClassPathString() const { 211 return boot_class_path_string_; 212 } 213 214 const std::string& GetClassPathString() const { 215 return class_path_string_; 216 } 217 218 ClassLinker* GetClassLinker() const { 219 return class_linker_; 220 } 221 222 size_t GetDefaultStackSize() const { 223 return default_stack_size_; 224 } 225 226 gc::Heap* GetHeap() const { 227 return heap_; 228 } 229 230 InternTable* GetInternTable() const { 231 DCHECK(intern_table_ != NULL); 232 return intern_table_; 233 } 234 235 JavaVMExt* GetJavaVM() const { 236 return java_vm_; 237 } 238 239 size_t GetMaxSpinsBeforeThinkLockInflation() const { 240 return max_spins_before_thin_lock_inflation_; 241 } 242 243 MonitorList* GetMonitorList() const { 244 return monitor_list_; 245 } 246 247 MonitorPool* GetMonitorPool() const { 248 return monitor_pool_; 249 } 250 251 // Is the given object the special object used to mark a cleared JNI weak global? 252 bool IsClearedJniWeakGlobal(mirror::Object* obj) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 253 254 // Get the special object used to mark a cleared JNI weak global. 255 mirror::Object* GetClearedJniWeakGlobal() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 256 257 mirror::Throwable* GetPreAllocatedOutOfMemoryError() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 258 259 mirror::Throwable* GetPreAllocatedNoClassDefFoundError() 260 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 261 262 const std::vector<std::string>& GetProperties() const { 263 return properties_; 264 } 265 266 ThreadList* GetThreadList() const { 267 return thread_list_; 268 } 269 270 static const char* GetVersion() { 271 return "2.1.0"; 272 } 273 274 void DisallowNewSystemWeaks() EXCLUSIVE_LOCKS_REQUIRED(Locks::mutator_lock_); 275 void AllowNewSystemWeaks() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 276 277 // Visit all the roots. If only_dirty is true then non-dirty roots won't be visited. If 278 // clean_dirty is true then dirty roots will be marked as non-dirty after visiting. 279 void VisitRoots(RootCallback* visitor, void* arg, VisitRootFlags flags = kVisitRootFlagAllRoots) 280 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 281 282 // Visit all of the roots we can do safely do concurrently. 283 void VisitConcurrentRoots(RootCallback* visitor, void* arg, 284 VisitRootFlags flags = kVisitRootFlagAllRoots) 285 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 286 287 // Visit all of the non thread roots, we can do this with mutators unpaused. 288 void VisitNonThreadRoots(RootCallback* visitor, void* arg) 289 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 290 291 // Visit all other roots which must be done with mutators suspended. 292 void VisitNonConcurrentRoots(RootCallback* visitor, void* arg) 293 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 294 295 // Sweep system weaks, the system weak is deleted if the visitor return nullptr. Otherwise, the 296 // system weak is updated to be the visitor's returned value. 297 void SweepSystemWeaks(IsMarkedCallback* visitor, void* arg) 298 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 299 300 // Constant roots are the roots which never change after the runtime is initialized, they only 301 // need to be visited once per GC cycle. 302 void VisitConstantRoots(RootCallback* callback, void* arg) 303 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 304 305 // Returns a special method that calls into a trampoline for runtime method resolution 306 mirror::ArtMethod* GetResolutionMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 307 308 bool HasResolutionMethod() const { 309 return !resolution_method_.IsNull(); 310 } 311 312 void SetResolutionMethod(mirror::ArtMethod* method) { 313 resolution_method_ = GcRoot<mirror::ArtMethod>(method); 314 } 315 316 mirror::ArtMethod* CreateResolutionMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 317 318 // Returns a special method that calls into a trampoline for runtime imt conflicts. 319 mirror::ArtMethod* GetImtConflictMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 320 mirror::ArtMethod* GetImtUnimplementedMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 321 322 bool HasImtConflictMethod() const { 323 return !imt_conflict_method_.IsNull(); 324 } 325 326 void SetImtConflictMethod(mirror::ArtMethod* method) { 327 imt_conflict_method_ = GcRoot<mirror::ArtMethod>(method); 328 } 329 void SetImtUnimplementedMethod(mirror::ArtMethod* method) { 330 imt_unimplemented_method_ = GcRoot<mirror::ArtMethod>(method); 331 } 332 333 mirror::ArtMethod* CreateImtConflictMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 334 335 // Returns an imt with every entry set to conflict, used as default imt for all classes. 336 mirror::ObjectArray<mirror::ArtMethod>* GetDefaultImt() 337 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 338 339 bool HasDefaultImt() const { 340 return !default_imt_.IsNull(); 341 } 342 343 void SetDefaultImt(mirror::ObjectArray<mirror::ArtMethod>* imt) { 344 default_imt_ = GcRoot<mirror::ObjectArray<mirror::ArtMethod>>(imt); 345 } 346 347 mirror::ObjectArray<mirror::ArtMethod>* CreateDefaultImt(ClassLinker* cl) 348 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 349 350 // Returns a special method that describes all callee saves being spilled to the stack. 351 enum CalleeSaveType { 352 kSaveAll, 353 kRefsOnly, 354 kRefsAndArgs, 355 kLastCalleeSaveType // Value used for iteration 356 }; 357 358 bool HasCalleeSaveMethod(CalleeSaveType type) const { 359 return !callee_save_methods_[type].IsNull(); 360 } 361 362 mirror::ArtMethod* GetCalleeSaveMethod(CalleeSaveType type) 363 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 364 365 mirror::ArtMethod* GetCalleeSaveMethodUnchecked(CalleeSaveType type) 366 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 367 368 QuickMethodFrameInfo GetCalleeSaveMethodFrameInfo(CalleeSaveType type) const { 369 return callee_save_method_frame_infos_[type]; 370 } 371 372 QuickMethodFrameInfo GetRuntimeMethodFrameInfo(mirror::ArtMethod* method) 373 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 374 375 static size_t GetCalleeSaveMethodOffset(CalleeSaveType type) { 376 return OFFSETOF_MEMBER(Runtime, callee_save_methods_[type]); 377 } 378 379 InstructionSet GetInstructionSet() const { 380 return instruction_set_; 381 } 382 383 void SetInstructionSet(InstructionSet instruction_set); 384 385 void SetCalleeSaveMethod(mirror::ArtMethod* method, CalleeSaveType type); 386 387 mirror::ArtMethod* CreateCalleeSaveMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 388 389 int32_t GetStat(int kind); 390 391 RuntimeStats* GetStats() { 392 return &stats_; 393 } 394 395 bool HasStatsEnabled() const { 396 return stats_enabled_; 397 } 398 399 void ResetStats(int kinds); 400 401 void SetStatsEnabled(bool new_state) LOCKS_EXCLUDED(Locks::instrument_entrypoints_lock_, 402 Locks::mutator_lock_); 403 404 enum class NativeBridgeAction { // private 405 kUnload, 406 kInitialize 407 }; 408 void PreZygoteFork(); 409 bool InitZygote(); 410 void DidForkFromZygote(JNIEnv* env, NativeBridgeAction action, const char* isa); 411 412 const instrumentation::Instrumentation* GetInstrumentation() const { 413 return &instrumentation_; 414 } 415 416 instrumentation::Instrumentation* GetInstrumentation() { 417 return &instrumentation_; 418 } 419 420 bool UseCompileTimeClassPath() const { 421 return use_compile_time_class_path_; 422 } 423 424 void AddMethodVerifier(verifier::MethodVerifier* verifier) LOCKS_EXCLUDED(method_verifier_lock_); 425 void RemoveMethodVerifier(verifier::MethodVerifier* verifier) 426 LOCKS_EXCLUDED(method_verifier_lock_); 427 428 const std::vector<const DexFile*>& GetCompileTimeClassPath(jobject class_loader); 429 void SetCompileTimeClassPath(jobject class_loader, std::vector<const DexFile*>& class_path); 430 431 void StartProfiler(const char* profile_output_filename); 432 void UpdateProfilerState(int state); 433 434 // Transaction support. 435 bool IsActiveTransaction() const { 436 return preinitialization_transaction_ != nullptr; 437 } 438 void EnterTransactionMode(Transaction* transaction); 439 void ExitTransactionMode(); 440 void RecordWriteFieldBoolean(mirror::Object* obj, MemberOffset field_offset, uint8_t value, 441 bool is_volatile) const; 442 void RecordWriteFieldByte(mirror::Object* obj, MemberOffset field_offset, int8_t value, 443 bool is_volatile) const; 444 void RecordWriteFieldChar(mirror::Object* obj, MemberOffset field_offset, uint16_t value, 445 bool is_volatile) const; 446 void RecordWriteFieldShort(mirror::Object* obj, MemberOffset field_offset, int16_t value, 447 bool is_volatile) const; 448 void RecordWriteField32(mirror::Object* obj, MemberOffset field_offset, uint32_t value, 449 bool is_volatile) const; 450 void RecordWriteField64(mirror::Object* obj, MemberOffset field_offset, uint64_t value, 451 bool is_volatile) const; 452 void RecordWriteFieldReference(mirror::Object* obj, MemberOffset field_offset, 453 mirror::Object* value, bool is_volatile) const; 454 void RecordWriteArray(mirror::Array* array, size_t index, uint64_t value) const 455 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 456 void RecordStrongStringInsertion(mirror::String* s) const 457 EXCLUSIVE_LOCKS_REQUIRED(Locks::intern_table_lock_); 458 void RecordWeakStringInsertion(mirror::String* s) const 459 EXCLUSIVE_LOCKS_REQUIRED(Locks::intern_table_lock_); 460 void RecordStrongStringRemoval(mirror::String* s) const 461 EXCLUSIVE_LOCKS_REQUIRED(Locks::intern_table_lock_); 462 void RecordWeakStringRemoval(mirror::String* s) const 463 EXCLUSIVE_LOCKS_REQUIRED(Locks::intern_table_lock_); 464 465 void SetFaultMessage(const std::string& message); 466 // Only read by the signal handler, NO_THREAD_SAFETY_ANALYSIS to prevent lock order violations 467 // with the unexpected_signal_lock_. 468 const std::string& GetFaultMessage() NO_THREAD_SAFETY_ANALYSIS { 469 return fault_message_; 470 } 471 472 void AddCurrentRuntimeFeaturesAsDex2OatArguments(std::vector<std::string>* arg_vector) const; 473 474 bool ExplicitStackOverflowChecks() const { 475 return !implicit_so_checks_; 476 } 477 478 bool IsVerificationEnabled() const { 479 return verify_; 480 } 481 482 bool RunningOnValgrind() const { 483 return running_on_valgrind_; 484 } 485 486 void SetTargetSdkVersion(int32_t version) { 487 target_sdk_version_ = version; 488 } 489 490 int32_t GetTargetSdkVersion() const { 491 return target_sdk_version_; 492 } 493 494 private: 495 static void InitPlatformSignalHandlers(); 496 497 Runtime(); 498 499 void BlockSignals(); 500 501 bool Init(const RuntimeOptions& options, bool ignore_unrecognized) 502 SHARED_TRYLOCK_FUNCTION(true, Locks::mutator_lock_); 503 void InitNativeMethods() LOCKS_EXCLUDED(Locks::mutator_lock_); 504 void InitThreadGroups(Thread* self); 505 void RegisterRuntimeNativeMethods(JNIEnv* env); 506 507 void StartDaemonThreads(); 508 void StartSignalCatcher(); 509 510 // A pointer to the active runtime or NULL. 511 static Runtime* instance_; 512 513 // NOTE: these must match the gc::ProcessState values as they come directly from the framework. 514 static constexpr int kProfileForground = 0; 515 static constexpr int kProfileBackgrouud = 1; 516 517 GcRoot<mirror::ArtMethod> callee_save_methods_[kLastCalleeSaveType]; 518 GcRoot<mirror::Throwable> pre_allocated_OutOfMemoryError_; 519 GcRoot<mirror::Throwable> pre_allocated_NoClassDefFoundError_; 520 GcRoot<mirror::ArtMethod> resolution_method_; 521 GcRoot<mirror::ArtMethod> imt_conflict_method_; 522 // Unresolved method has the same behavior as the conflict method, it is used by the class linker 523 // for differentiating between unfilled imt slots vs conflict slots in superclasses. 524 GcRoot<mirror::ArtMethod> imt_unimplemented_method_; 525 GcRoot<mirror::ObjectArray<mirror::ArtMethod>> default_imt_; 526 527 // Special sentinel object used to invalid conditions in JNI (cleared weak references) and 528 // JDWP (invalid references). 529 GcRoot<mirror::Object> sentinel_; 530 531 InstructionSet instruction_set_; 532 QuickMethodFrameInfo callee_save_method_frame_infos_[kLastCalleeSaveType]; 533 534 CompilerCallbacks* compiler_callbacks_; 535 bool is_zygote_; 536 bool must_relocate_; 537 bool is_concurrent_gc_enabled_; 538 bool is_explicit_gc_disabled_; 539 bool dex2oat_enabled_; 540 bool image_dex2oat_enabled_; 541 542 std::string compiler_executable_; 543 std::string patchoat_executable_; 544 std::vector<std::string> compiler_options_; 545 std::vector<std::string> image_compiler_options_; 546 std::string image_location_; 547 548 std::string boot_class_path_string_; 549 std::string class_path_string_; 550 std::vector<std::string> properties_; 551 552 // The default stack size for managed threads created by the runtime. 553 size_t default_stack_size_; 554 555 gc::Heap* heap_; 556 557 // The number of spins that are done before thread suspension is used to forcibly inflate. 558 size_t max_spins_before_thin_lock_inflation_; 559 MonitorList* monitor_list_; 560 MonitorPool* monitor_pool_; 561 562 ThreadList* thread_list_; 563 564 InternTable* intern_table_; 565 566 ClassLinker* class_linker_; 567 568 SignalCatcher* signal_catcher_; 569 std::string stack_trace_file_; 570 571 JavaVMExt* java_vm_; 572 573 // Fault message, printed when we get a SIGSEGV. 574 Mutex fault_message_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; 575 std::string fault_message_ GUARDED_BY(fault_message_lock_); 576 577 // Method verifier set, used so that we can update their GC roots. 578 Mutex method_verifier_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; 579 std::set<verifier::MethodVerifier*> method_verifiers_; 580 581 // A non-zero value indicates that a thread has been created but not yet initialized. Guarded by 582 // the shutdown lock so that threads aren't born while we're shutting down. 583 size_t threads_being_born_ GUARDED_BY(Locks::runtime_shutdown_lock_); 584 585 // Waited upon until no threads are being born. 586 std::unique_ptr<ConditionVariable> shutdown_cond_ GUARDED_BY(Locks::runtime_shutdown_lock_); 587 588 // Set when runtime shutdown is past the point that new threads may attach. 589 bool shutting_down_ GUARDED_BY(Locks::runtime_shutdown_lock_); 590 591 // The runtime is starting to shutdown but is blocked waiting on shutdown_cond_. 592 bool shutting_down_started_ GUARDED_BY(Locks::runtime_shutdown_lock_); 593 594 bool started_; 595 596 // New flag added which tells us if the runtime has finished starting. If 597 // this flag is set then the Daemon threads are created and the class loader 598 // is created. This flag is needed for knowing if its safe to request CMS. 599 bool finished_starting_; 600 601 // Hooks supported by JNI_CreateJavaVM 602 jint (*vfprintf_)(FILE* stream, const char* format, va_list ap); 603 void (*exit_)(jint status); 604 void (*abort_)(); 605 606 bool stats_enabled_; 607 RuntimeStats stats_; 608 609 const bool running_on_valgrind_; 610 611 std::string profile_output_filename_; 612 ProfilerOptions profiler_options_; 613 bool profiler_started_; 614 615 bool method_trace_; 616 std::string method_trace_file_; 617 size_t method_trace_file_size_; 618 instrumentation::Instrumentation instrumentation_; 619 620 typedef AllocationTrackingSafeMap<jobject, std::vector<const DexFile*>, 621 kAllocatorTagCompileTimeClassPath, JobjectComparator> 622 CompileTimeClassPaths; 623 CompileTimeClassPaths compile_time_class_paths_; 624 bool use_compile_time_class_path_; 625 626 jobject main_thread_group_; 627 jobject system_thread_group_; 628 629 // As returned by ClassLoader.getSystemClassLoader(). 630 jobject system_class_loader_; 631 632 // If true, then we dump the GC cumulative timings on shutdown. 633 bool dump_gc_performance_on_shutdown_; 634 635 // Transaction used for pre-initializing classes at compilation time. 636 Transaction* preinitialization_transaction_; 637 638 // If false, verification is disabled. True by default. 639 bool verify_; 640 641 // Specifies target SDK version to allow workarounds for certain API levels. 642 int32_t target_sdk_version_; 643 644 // Implicit checks flags. 645 bool implicit_null_checks_; // NullPointer checks are implicit. 646 bool implicit_so_checks_; // StackOverflow checks are implicit. 647 bool implicit_suspend_checks_; // Thread suspension checks are implicit. 648 649 // Whether or not a native bridge has been loaded. 650 // 651 // The native bridge allows running native code compiled for a foreign ISA. The way it works is, 652 // if standard dlopen fails to load native library associated with native activity, it calls to 653 // the native bridge to load it and then gets the trampoline for the entry to native activity. 654 // 655 // The option 'native_bridge_library_filename' specifies the name of the native bridge. 656 // When non-empty the native bridge will be loaded from the given file. An empty value means 657 // that there's no native bridge. 658 bool is_native_bridge_loaded_; 659 660 DISALLOW_COPY_AND_ASSIGN(Runtime); 661}; 662std::ostream& operator<<(std::ostream& os, const Runtime::CalleeSaveType& rhs); 663 664} // namespace art 665 666#endif // ART_RUNTIME_RUNTIME_H_ 667