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