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