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