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