namespace mirror { classClass; class ClassLoader; class Object;
} // namespace mirror
class ArtMethod; class ClassLoadCallback; class DexFile; class Thread; class MethodCallback; class Monitor; class ReaderWriterMutex; class ThreadLifecycleCallback; class ReflectiveValueVisitor;
// Note: RuntimeCallbacks uses the mutator lock to synchronize the callback lists. A thread must // hold the exclusive lock to add or remove a listener. A thread must hold the shared lock // to dispatch an event. This setup is chosen as some clients may want to suspend the // dispatching thread or all threads. // // To make this safe, the following restrictions apply: // * Only the owner of a listener may ever add or remove said listener. // * A listener must never add or remove itself or any other listener while running. // * It is the responsibility of the owner to not remove the listener while it is running // (and suspended). // * The owner should never deallocate a listener once it has been registered, even if it has // been removed. // // The simplest way to satisfy these restrictions is to never remove a listener, and to do // any state checking (is the listener enabled) in the listener itself. For an example, see // Dbg.
class DebuggerControlCallback { public: virtual ~DebuggerControlCallback() {}
// Begin running the debugger. virtualvoid StartDebugger() = 0; // The debugger should begin shutting down since the runtime is ending. This is just advisory virtualvoid StopDebugger() = 0;
// This allows the debugger to tell the runtime if it is configured. virtualbool IsDebuggerConfigured() = 0;
};
class RuntimeSigQuitCallback { public: virtual ~RuntimeSigQuitCallback() {}
class RuntimePhaseCallback { public: enum RuntimePhase {
kInitialAgents, // Initial agent loading is done.
kStart, // The runtime is started.
kInit, // The runtime is initialized (and will run user code soon).
kDeath, // The runtime just died.
};
class MonitorCallback { public: // Called just before the thread goes to sleep to wait for the monitor to become unlocked. virtualvoid MonitorContendedLocking(Monitor* mon) REQUIRES_SHARED(Locks::mutator_lock_) = 0; // Called just after the monitor has been successfully acquired when it was already locked. virtualvoid MonitorContendedLocked(Monitor* mon) REQUIRES_SHARED(Locks::mutator_lock_) = 0; // Called on entry to the Object#wait method regardless of whether or not the call is valid. virtualvoid ObjectWaitStart(Handle<mirror::Object> obj, int64_t millis_timeout)
REQUIRES_SHARED(Locks::mutator_lock_) = 0;
// Called just after the monitor has woken up from going to sleep for a wait(). At this point the // thread does not possess a lock on the monitor. This will only be called for threads wait calls // where the thread did (or at least could have) gone to sleep. virtualvoid MonitorWaitFinished(Monitor* m, bool timed_out)
REQUIRES_SHARED(Locks::mutator_lock_) = 0;
virtual ~MonitorCallback() {}
};
class ParkCallback { public: // Called on entry to the Unsafe.#park method virtualvoid ThreadParkStart(bool is_absolute, int64_t millis_timeout)
REQUIRES_SHARED(Locks::mutator_lock_) = 0;
// Called just after the thread has woken up from going to sleep for a park(). This will only be // called for Unsafe.park() calls where the thread did (or at least could have) gone to sleep. virtualvoid ThreadParkFinished(bool timed_out) REQUIRES_SHARED(Locks::mutator_lock_) = 0;
virtual ~ParkCallback() {}
};
// A callback to let parts of the runtime note that they are currently relying on a particular // method remaining in it's current state. Users should not rely on always being called. If multiple // callbacks are added the runtime will short-circuit when the first one returns 'true'. class MethodInspectionCallback { public: virtual ~MethodInspectionCallback() {}
// Returns true if any locals have changed. If any locals have changed we shouldn't OSR. virtualbool HaveLocalsChanged() REQUIRES_SHARED(Locks::mutator_lock_) = 0;
};
// Callback to let something request to be notified when reflective objects are being visited and // updated to update any bare ArtMethod/ArtField pointers it might have. class ReflectiveValueVisitCallback { public: virtual ~ReflectiveValueVisitCallback() {}
// Called when something visits all reflective values with the update visitor. virtualvoid VisitReflectiveTargets(ReflectiveValueVisitor* visitor)
REQUIRES(Locks::mutator_lock_) = 0;
};
class EXPORT RuntimeCallbacks { public:
RuntimeCallbacks();
void MonitorContendedLocking(Monitor* m) REQUIRES_SHARED(Locks::mutator_lock_); void MonitorContendedLocked(Monitor* m) REQUIRES_SHARED(Locks::mutator_lock_); void ObjectWaitStart(Handle<mirror::Object> m, int64_t timeout)
REQUIRES_SHARED(Locks::mutator_lock_); void MonitorWaitFinished(Monitor* m, bool timed_out)
REQUIRES_SHARED(Locks::mutator_lock_);
// Returns true if any locals have changed. This is used to prevent OSRing frames that have // some locals changed. bool HaveLocalsChanged() REQUIRES_SHARED(Locks::mutator_lock_);
void StartDebugger() REQUIRES_SHARED(Locks::mutator_lock_); // NO_THREAD_SAFETY_ANALYSIS since this is only called when we are in the middle of shutting down // and the mutator_lock_ is no longer acquirable. void StopDebugger() NO_THREAD_SAFETY_ANALYSIS; bool IsDebuggerConfigured() REQUIRES_SHARED(Locks::mutator_lock_);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.