pub struct VmCapabilitiesNew {
pub can_redefine_classes: bool,
pub can_add_method: bool,
pub can_unrestrictedly_redefine_classes: bool,
pub can_pop_frames: bool,
pub can_use_instance_filters: bool,
pub can_get_instance_info: bool,
pub can_request_monitor_events: bool,
pub can_get_monitor_frame_info: bool,
}Expand description
The capabilities VirtualMachine.CapabilitiesNew (command 17) adds on top of VmCapabilities.
The reply repeats the original seven booleans and then adds twenty-five more, of which the last
eleven are reserved. Only the ones a feature here turns on are named: decoding a bit nothing
consults would be the same uncalled-command mistake IDSizes was deleted for (CLEAN-1, #27).
Asked before hot reload rather than after a failure, per the rule VmCapabilities states: a JVM
without canRedefineClasses answers NOT_IMPLEMENTED (99) to the command, and “this JVM cannot
HotSwap” is a far more useful report than a bare error code.
Fields§
§can_redefine_classes: boolWhether redefine_classes will work at all. Every HotSpot
this project has met says yes; a JVM in the field may not.
can_add_method: boolWhether a redefinition may add a method. HotSpot says no, which is most of why a swap gets
refused: method bodies are all it will accept.
can_unrestrictedly_redefine_classes: boolWhether the JVM lifts the method-bodies-only restriction entirely. HotSpot says no.
can_pop_frames: boolWhether pop_frames will work — the other half of a useful swap,
since a frame already on the stack keeps running the code it entered with.
can_use_instance_filters: boolWhether a request may carry an InstanceOnly modifier (modKind 11) — position 12.
Decoded in the same change that consults it (FILT-9, #101), per this struct’s rule. It matters
more than most bits here because of how the JVM refuses a modifier it cannot honour: not with
NOT_IMPLEMENTED, but with INTERNAL (113), which says nothing about which modifier was the
problem. Reading the bit first turns that into a sentence.
Measured true on Temurin 17.0.20 — docs/heap-query-measurements.md has the full vector.
can_get_instance_info: boolWhether instances and
instance_counts will work — position 16, four bits past
where this decoder used to stop.
Decoded in the same change that consults it (DISC-10, #84). Positions 13-15
(canGetSourceDebugExtension, canRequestVMDeathEvent, canSetDefaultStratum) are read past
rather than named, for the reason this struct’s documentation gives: a bit nothing reads is the
mistake IDSizes was deleted for. Position 12 joined the named ones with FILT-9 (#101).
can_request_monitor_events: boolWhether set_monitor_request will work — position 17,
the very next bit after 16, so DISC-10’s decoder needed no positions skipped to reach it.
Decoded in the same change that consults it (DUMP-7, #96), per this struct’s rule, and consulted at
arming time rather than after the fact: a JVM without it answers NOT_IMPLEMENTED (99), and “this
JVM cannot report lock contention as it happens, so a lock diagnosis here still needs a suspending
debug.thread_dump” is a far more useful report — it names the fallback as well as the refusal.
can_get_monitor_frame_info: boolWhether the JVM can say at which stack depth a thread acquired each monitor it owns
(ThreadReference.OwnedMonitorsStackDepthInfo) — position 18.
Named although no command here issues that request, which is a deliberate exception to this struct’s rule and needs its justification stated rather than assumed. What consults it is the arming reply for a monitor stop point: a snapshot names the lock, the thread and the location that blocked, and the obvious next question — where in this thread’s stack was the lock taken — is answerable on a JVM with this bit and not on one without. Reporting which of the two a caller is on costs one already-issued command, where leaving it out invites the reading that the tool simply does not report frame depth on any JVM.
That is a consulted bit rather than an implied capability, which is the line IDSizes crossed
(CLEAN-1, #27): nothing here claims the frame-depth query exists. If it is ever built, this is the
bit it gates on.
Trait Implementations§
Source§impl Clone for VmCapabilitiesNew
impl Clone for VmCapabilitiesNew
Source§fn clone(&self) -> VmCapabilitiesNew
fn clone(&self) -> VmCapabilitiesNew
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more