# HG changeset patch # User bobv # Date 1496414225 14400 # Node ID e64b1cb48d6e7703928a9d1da106fc27f8cb65fd # Parent e271f2b09a3927b12c375226f64f24baa1ad3635# Parent e5192b08213ce27ebeab09f0ef6e6c8ada26037f Merge diff -r e271f2b09a39 -r e64b1cb48d6e .hgtags --- a/.hgtags Fri Jun 02 10:35:44 2017 -0400 +++ b/.hgtags Fri Jun 02 10:37:05 2017 -0400 @@ -574,3 +574,4 @@ 16d692be099c5c38eb48cc9aca78b0c900910d5b jdk-9+169 38a240fd58a287acb1963920b92ed4d9c2fd39e3 jdk-9+170 d53171650a2cc6c6f699c966c533b914ca9c0602 jdk-9+171 +1ae9e84f68b359420d2d153ecfe5ee2903e33a2e jdk-9+172 diff -r e271f2b09a39 -r e64b1cb48d6e src/share/vm/opto/arraycopynode.cpp --- a/src/share/vm/opto/arraycopynode.cpp Fri Jun 02 10:35:44 2017 -0400 +++ b/src/share/vm/opto/arraycopynode.cpp Fri Jun 02 10:37:05 2017 -0400 @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "opto/arraycopynode.hpp" #include "opto/graphKit.hpp" +#include "runtime/sharedRuntime.hpp" ArrayCopyNode::ArrayCopyNode(Compile* C, bool alloc_tightly_coupled, bool has_negative_length_guard) : CallNode(arraycopy_type(), NULL, TypeRawPtr::BOTTOM), @@ -631,42 +632,76 @@ return CallNode::may_modify_arraycopy_helper(dest_t, t_oop, phase); } -bool ArrayCopyNode::may_modify_helper(const TypeOopPtr *t_oop, Node* n, PhaseTransform *phase, ArrayCopyNode*& ac) { - if (n->Opcode() == Op_StoreCM || - n->Opcode() == Op_StoreB) { - // Ignore card mark stores - n = n->in(MemNode::Memory); - } - - if (n->is_Proj()) { - n = n->in(0); - if (n->is_Call() && n->as_Call()->may_modify(t_oop, phase)) { - if (n->isa_ArrayCopy() != NULL) { - ac = n->as_ArrayCopy(); - } - return true; - } +bool ArrayCopyNode::may_modify_helper(const TypeOopPtr *t_oop, Node* n, PhaseTransform *phase, CallNode*& call) { + if (n != NULL && + n->is_Call() && + n->as_Call()->may_modify(t_oop, phase) && + (n->as_Call()->is_ArrayCopy() || n->as_Call()->is_call_to_arraycopystub())) { + call = n->as_Call(); + return true; } return false; } -bool ArrayCopyNode::may_modify(const TypeOopPtr *t_oop, MemBarNode* mb, PhaseTransform *phase, ArrayCopyNode*& ac) { - Node* mem = mb->in(TypeFunc::Memory); - - if (mem->is_MergeMem()) { - Node* n = mem->as_MergeMem()->memory_at(Compile::AliasIdxRaw); - if (may_modify_helper(t_oop, n, phase, ac)) { - return true; - } else if (n->is_Phi()) { - for (uint i = 1; i < n->req(); i++) { - if (n->in(i) != NULL) { - if (may_modify_helper(t_oop, n->in(i), phase, ac)) { - return true; +static Node* step_over_gc_barrier(Node* c) { + if (UseG1GC && !GraphKit::use_ReduceInitialCardMarks() && + c != NULL && c->is_Region() && c->req() == 3) { + for (uint i = 1; i < c->req(); i++) { + if (c->in(i) != NULL && c->in(i)->is_Region() && + c->in(i)->req() == 3) { + Node* r = c->in(i); + for (uint j = 1; j < r->req(); j++) { + if (r->in(j) != NULL && r->in(j)->is_Proj() && + r->in(j)->in(0) != NULL && + r->in(j)->in(0)->Opcode() == Op_CallLeaf && + r->in(j)->in(0)->as_Call()->entry_point() == CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post)) { + Node* call = r->in(j)->in(0); + c = c->in(i == 1 ? 2 : 1); + if (c != NULL) { + c = c->in(0); + if (c != NULL) { + c = c->in(0); + assert(call->in(0) == NULL || + call->in(0)->in(0) == NULL || + call->in(0)->in(0)->in(0) == NULL || + call->in(0)->in(0)->in(0)->in(0) == NULL || + call->in(0)->in(0)->in(0)->in(0)->in(0) == NULL || + c == call->in(0)->in(0)->in(0)->in(0)->in(0), "bad barrier shape"); + return c; + } + } } } } } } + return c; +} + +bool ArrayCopyNode::may_modify(const TypeOopPtr *t_oop, MemBarNode* mb, PhaseTransform *phase, ArrayCopyNode*& ac) { + + Node* c = mb->in(0); + + // step over g1 gc barrier if we're at a clone with ReduceInitialCardMarks off + c = step_over_gc_barrier(c); + + CallNode* call = NULL; + if (c != NULL && c->is_Region()) { + for (uint i = 1; i < c->req(); i++) { + if (c->in(i) != NULL) { + Node* n = c->in(i)->in(0); + if (may_modify_helper(t_oop, n, phase, call)) { + ac = call->isa_ArrayCopy(); + assert(c == mb->in(0), "only for clone"); + return true; + } + } + } + } else if (may_modify_helper(t_oop, c->in(0), phase, call)) { + ac = call->isa_ArrayCopy(); + assert(c == mb->in(0) || (ac != NULL && ac->is_clonebasic() && !GraphKit::use_ReduceInitialCardMarks()), "only for clone"); + return true; + } return false; } @@ -677,37 +712,77 @@ // between offset_lo and offset_hi // if must_modify is true, return true if the copy is guaranteed to // write between offset_lo and offset_hi -bool ArrayCopyNode::modifies(intptr_t offset_lo, intptr_t offset_hi, PhaseTransform* phase, bool must_modify) { +bool ArrayCopyNode::modifies(intptr_t offset_lo, intptr_t offset_hi, PhaseTransform* phase, bool must_modify) const { assert(_kind == ArrayCopy || _kind == CopyOf || _kind == CopyOfRange, "only for real array copies"); - Node* dest = in(ArrayCopyNode::Dest); - Node* src_pos = in(ArrayCopyNode::SrcPos); - Node* dest_pos = in(ArrayCopyNode::DestPos); - Node* len = in(ArrayCopyNode::Length); + Node* dest = in(Dest); + Node* dest_pos = in(DestPos); + Node* len = in(Length); const TypeInt *dest_pos_t = phase->type(dest_pos)->isa_int(); const TypeInt *len_t = phase->type(len)->isa_int(); const TypeAryPtr* ary_t = phase->type(dest)->isa_aryptr(); - if (dest_pos_t != NULL && len_t != NULL && ary_t != NULL) { - BasicType ary_elem = ary_t->klass()->as_array_klass()->element_type()->basic_type(); - uint header = arrayOopDesc::base_offset_in_bytes(ary_elem); - uint elemsize = type2aelembytes(ary_elem); + if (dest_pos_t == NULL || len_t == NULL || ary_t == NULL) { + return !must_modify; + } + + BasicType ary_elem = ary_t->klass()->as_array_klass()->element_type()->basic_type(); + uint header = arrayOopDesc::base_offset_in_bytes(ary_elem); + uint elemsize = type2aelembytes(ary_elem); - jlong dest_pos_plus_len_lo = (((jlong)dest_pos_t->_lo) + len_t->_lo) * elemsize + header; - jlong dest_pos_plus_len_hi = (((jlong)dest_pos_t->_hi) + len_t->_hi) * elemsize + header; - jlong dest_pos_lo = ((jlong)dest_pos_t->_lo) * elemsize + header; - jlong dest_pos_hi = ((jlong)dest_pos_t->_hi) * elemsize + header; + jlong dest_pos_plus_len_lo = (((jlong)dest_pos_t->_lo) + len_t->_lo) * elemsize + header; + jlong dest_pos_plus_len_hi = (((jlong)dest_pos_t->_hi) + len_t->_hi) * elemsize + header; + jlong dest_pos_lo = ((jlong)dest_pos_t->_lo) * elemsize + header; + jlong dest_pos_hi = ((jlong)dest_pos_t->_hi) * elemsize + header; - if (must_modify) { - if (offset_lo >= dest_pos_hi && offset_hi < dest_pos_plus_len_lo) { - return true; - } - } else { - if (offset_hi >= dest_pos_lo && offset_lo < dest_pos_plus_len_hi) { - return true; - } + if (must_modify) { + if (offset_lo >= dest_pos_hi && offset_hi < dest_pos_plus_len_lo) { + return true; + } + } else { + if (offset_hi >= dest_pos_lo && offset_lo < dest_pos_plus_len_hi) { + return true; } } return false; } + +// We try to replace a load from the destination of an arraycopy with +// a load from the source so the arraycopy has a chance to be +// eliminated. It's only valid if the arraycopy doesn't change the +// element that would be loaded from the source array. +bool ArrayCopyNode::can_replace_dest_load_with_src_load(intptr_t offset_lo, intptr_t offset_hi, PhaseTransform* phase) const { + assert(_kind == ArrayCopy || _kind == CopyOf || _kind == CopyOfRange, "only for real array copies"); + + Node* src = in(Src); + Node* dest = in(Dest); + + // Check whether, assuming source and destination are the same + // array, the arraycopy modifies the element from the source we + // would load. + if ((src != dest && in(SrcPos) == in(DestPos)) || !modifies(offset_lo, offset_hi, phase, false)) { + // if not the transformation is legal + return true; + } + + AllocateNode* src_alloc = AllocateNode::Ideal_allocation(src, phase); + AllocateNode* dest_alloc = AllocateNode::Ideal_allocation(dest, phase); + + // Check whether source and destination can be proved to be + // different arrays + const TypeOopPtr* t_src = phase->type(src)->isa_oopptr(); + const TypeOopPtr* t_dest = phase->type(dest)->isa_oopptr(); + + if (t_src != NULL && t_dest != NULL && + (t_src->is_known_instance() || t_dest->is_known_instance()) && + t_src->instance_id() != t_dest->instance_id()) { + return true; + } + + if (MemNode::detect_ptr_independence(src->uncast(), src_alloc, dest->uncast(), dest_alloc, phase)) { + return true; + } + + return false; +} diff -r e271f2b09a39 -r e64b1cb48d6e src/share/vm/opto/arraycopynode.hpp --- a/src/share/vm/opto/arraycopynode.hpp Fri Jun 02 10:35:44 2017 -0400 +++ b/src/share/vm/opto/arraycopynode.hpp Fri Jun 02 10:37:05 2017 -0400 @@ -108,7 +108,7 @@ BasicType copy_type, const Type* value_type, int count); bool finish_transform(PhaseGVN *phase, bool can_reshape, Node* ctl, Node *mem); - static bool may_modify_helper(const TypeOopPtr *t_oop, Node* n, PhaseTransform *phase, ArrayCopyNode*& ac); + static bool may_modify_helper(const TypeOopPtr *t_oop, Node* n, PhaseTransform *phase, CallNode*& call); public: @@ -167,7 +167,8 @@ bool has_negative_length_guard() const { return _has_negative_length_guard; } static bool may_modify(const TypeOopPtr *t_oop, MemBarNode* mb, PhaseTransform *phase, ArrayCopyNode*& ac); - bool modifies(intptr_t offset_lo, intptr_t offset_hi, PhaseTransform* phase, bool must_modify); + bool modifies(intptr_t offset_lo, intptr_t offset_hi, PhaseTransform* phase, bool must_modify) const; + bool can_replace_dest_load_with_src_load(intptr_t offset_lo, intptr_t offset_hi, PhaseTransform* phase) const; #ifndef PRODUCT virtual void dump_spec(outputStream *st) const; diff -r e271f2b09a39 -r e64b1cb48d6e src/share/vm/opto/macro.cpp --- a/src/share/vm/opto/macro.cpp Fri Jun 02 10:35:44 2017 -0400 +++ b/src/share/vm/opto/macro.cpp Fri Jun 02 10:37:05 2017 -0400 @@ -1047,7 +1047,9 @@ // opportunities for allocation elimination Node* src = ac->in(ArrayCopyNode::Src); ac->replace_edge(src, top()); - if (src->outcnt() == 0) { + // src can be top at this point if src and dest of the + // arraycopy were the same + if (src->outcnt() == 0 && !src->is_top()) { _igvn.remove_dead_node(src); } diff -r e271f2b09a39 -r e64b1cb48d6e src/share/vm/opto/macroArrayCopy.cpp --- a/src/share/vm/opto/macroArrayCopy.cpp Fri Jun 02 10:35:44 2017 -0400 +++ b/src/share/vm/opto/macroArrayCopy.cpp Fri Jun 02 10:37:05 2017 -0400 @@ -718,6 +718,15 @@ _igvn.replace_node(_ioproj_fallthrough, *io); _igvn.replace_node(_fallthroughcatchproj, *ctrl); +#ifdef ASSERT + const TypeOopPtr* dest_t = _igvn.type(dest)->is_oopptr(); + if (dest_t->is_known_instance()) { + ArrayCopyNode* ac = NULL; + assert(ArrayCopyNode::may_modify(dest_t, (*ctrl)->in(0)->as_MemBar(), &_igvn, ac), "dependency on arraycopy lost"); + assert(ac == NULL, "no arraycopy anymore"); + } +#endif + return out_mem; } @@ -1139,8 +1148,25 @@ const TypeAryPtr* top_src = src_type->isa_aryptr(); const TypeAryPtr* top_dest = dest_type->isa_aryptr(); - if (top_src == NULL || top_src->klass() == NULL || - top_dest == NULL || top_dest->klass() == NULL) { + BasicType src_elem = T_CONFLICT; + BasicType dest_elem = T_CONFLICT; + + if (top_dest != NULL && top_dest->klass() != NULL) { + dest_elem = top_dest->klass()->as_array_klass()->element_type()->basic_type(); + } + if (top_src != NULL && top_src->klass() != NULL) { + src_elem = top_src->klass()->as_array_klass()->element_type()->basic_type(); + } + if (src_elem == T_ARRAY) src_elem = T_OBJECT; + if (dest_elem == T_ARRAY) dest_elem = T_OBJECT; + + if (ac->is_arraycopy_validated() && + dest_elem != T_CONFLICT && + src_elem == T_CONFLICT) { + src_elem = dest_elem; + } + + if (src_elem == T_CONFLICT || dest_elem == T_CONFLICT) { // Conservatively insert a memory barrier on all memory slices. // Do not let writes into the source float below the arraycopy. { @@ -1169,13 +1195,11 @@ } return; } + + assert(!ac->is_arraycopy_validated() || (src_elem == dest_elem && dest_elem != T_VOID), "validated but different basic types"); + // (2) src and dest arrays must have elements of the same BasicType // Figure out the size and type of the elements we will be copying. - BasicType src_elem = top_src->klass()->as_array_klass()->element_type()->basic_type(); - BasicType dest_elem = top_dest->klass()->as_array_klass()->element_type()->basic_type(); - if (src_elem == T_ARRAY) src_elem = T_OBJECT; - if (dest_elem == T_ARRAY) dest_elem = T_OBJECT; - if (src_elem != dest_elem || dest_elem == T_VOID) { // The component types are not the same or are not recognized. Punt. // (But, avoid the native method wrapper to JVM_ArrayCopy.) diff -r e271f2b09a39 -r e64b1cb48d6e src/share/vm/opto/memnode.cpp --- a/src/share/vm/opto/memnode.cpp Fri Jun 02 10:35:44 2017 -0400 +++ b/src/share/vm/opto/memnode.cpp Fri Jun 02 10:37:05 2017 -0400 @@ -908,10 +908,11 @@ ld->set_req(0, ld_alloc->in(0)); } } else { + Node* src = ac->in(ArrayCopyNode::Src); Node* addp = in(MemNode::Address)->clone(); assert(addp->in(AddPNode::Base) == addp->in(AddPNode::Address), "should be"); - addp->set_req(AddPNode::Base, ac->in(ArrayCopyNode::Src)); - addp->set_req(AddPNode::Address, ac->in(ArrayCopyNode::Src)); + addp->set_req(AddPNode::Base, src); + addp->set_req(AddPNode::Address, src); const TypeAryPtr* ary_t = phase->type(in(MemNode::Address))->isa_aryptr(); BasicType ary_elem = ary_t->klass()->as_array_klass()->element_type()->basic_type(); @@ -928,6 +929,12 @@ addp->set_req(AddPNode::Offset, offset); ld->set_req(MemNode::Address, phase->transform(addp)); + const TypeX *ld_offs_t = phase->type(offset)->isa_intptr_t(); + + if (!ac->as_ArrayCopy()->can_replace_dest_load_with_src_load(ld_offs_t->_lo, ld_offs_t->_hi, phase)) { + return NULL; + } + if (in(0) != NULL) { assert(ac->in(0) != NULL, "alloc must have control"); ld->set_req(0, ac->in(0)); diff -r e271f2b09a39 -r e64b1cb48d6e src/share/vm/prims/jvmti.xml --- a/src/share/vm/prims/jvmti.xml Fri Jun 02 10:35:44 2017 -0400 +++ b/src/share/vm/prims/jvmti.xml Fri Jun 02 10:37:05 2017 -0400 @@ -24,11 +24,11 @@ --> - @@ -41,13 +41,13 @@ - @@ -107,7 +107,7 @@ @@ -292,16 +292,16 @@ - + - + - + - + JVM Tool Interface - + - The JVM Tool Interface () - is a programming interface used by development and monitoring tools. - It provides both a way to inspect the state and + The JVM Tool Interface () + is a programming interface used by development and monitoring tools. + It provides both a way to inspect the state and to control the execution of applications running in the Java virtual machine (VM).

@@ -376,21 +376,21 @@ may not be available in all implementations of the Java virtual machine.

- is a two-way interface. + is a two-way interface. A client of , hereafter called an agent, can be notified of - interesting occurrences through events. + interesting occurrences through events. - can query and control the application through many - functions, - either in response to events or + can query and control the application through many + functions, + either in response to events or independent of them.

- Agents run in the same process with and communicate directly with + Agents run in the same process with and communicate directly with the virtual machine executing the application being examined. This communication is through a native interface (). The native in-process interface allows - maximal control with minimal intrusion on the part of a tool. + maximal control with minimal intrusion on the part of a tool. Typically, agents are relatively compact. They can be controlled by a separate process which implements the bulk of a tool's function without interfering with the target application's normal execution. @@ -400,12 +400,12 @@ Tools can be written directly to or indirectly through higher level interfaces. The Java Platform Debugger Architecture includes , but also - contains higher-level, out-of-process debugger interfaces. The higher-level - interfaces are more appropriate than for many tools. - For more information on the Java Platform Debugger Architecture, - see the - Java - Platform Debugger Architecture website. + contains higher-level, out-of-process debugger interfaces. The higher-level + interfaces are more appropriate than for many tools. + For more information on the Java Platform Debugger Architecture, + see the + Java + Platform Debugger Architecture website. @@ -424,16 +424,16 @@ - An agent is deployed in a platform specific manner but is typically the - platform equivalent of a dynamic library. On the Windows operating - system, for example, an agent library is a "Dynamic Linked Library" (DLL). + An agent is deployed in a platform specific manner but is typically the + platform equivalent of a dynamic library. On the Windows operating + system, for example, an agent library is a "Dynamic Linked Library" (DLL). On the Solaris Operating Environment, an agent library is a shared object (.so file).

An agent may be started at VM startup by specifying the agent library name using a command line option. - Some implementations may support a mechanism to + Some implementations may support a mechanism to start agents in the live phase. The details of how this is initiated are implementation specific. @@ -460,7 +460,7 @@ a function is exported, at the same point during VM execution as it would have called the dynamic entry point Agent_OnUnLoad. A statically loaded agent cannot be unloaded. The Agent_OnUnload_L function will still be - called to do any other agent shutdown related tasks. + called to do any other agent shutdown related tasks. If a statically linked agent L exports a function called Agent_OnUnLoad_L and a function called Agent_OnUnLoad, the Agent_OnUnLoad function will be ignored. @@ -472,19 +472,19 @@ Agent_OnAttach_L and a function called Agent_OnAttach, the Agent_OnAttach function will be ignored. - + The term "command-line option" is used below to mean options supplied in the JavaVMInitArgs argument to the JNI_CreateJavaVM function of the JNI Invocation API.

- One of the two following - command-line options is used on VM startup to + One of the two following + command-line options is used on VM startup to properly load and run agents. - These arguments identify the library containing + These arguments identify the library containing the agent as well as an options - string to be passed in at startup. + string to be passed in at startup.

-agentlib:<agent-lib-name>=<options>
@@ -494,10 +494,10 @@ Typically, the <agent-lib-name> is expanded to an operating system specific file name. The <options> will be passed to the agent on start-up. - For example, if the option - -agentlib:foo=opt1,opt2 is specified, the VM will attempt to + For example, if the option + -agentlib:foo=opt1,opt2 is specified, the VM will attempt to load the shared library foo.dll from the system PATH - under Windows or libfoo.so from the + under Windows or libfoo.so from the LD_LIBRARY_PATH under the Solaris operating environment. If the agent library is statically linked into the executable @@ -510,8 +510,8 @@ to load the library. No library name expansion will occur. The <options> will be passed to the agent on start-up. - For example, if the option - -agentpath:c:\myLibs\foo.dll=opt1,opt2 is specified, the VM will attempt to + For example, if the option + -agentpath:c:\myLibs\foo.dll=opt1,opt2 is specified, the VM will attempt to load the shared library c:\myLibs\foo.dll. If the agent library is statically linked into the executable then no actual loading takes place. @@ -523,13 +523,13 @@ in the library will be invoked. If the agent library is statically linked into the executable then the system will attempt to invoke the Agent_OnLoad_<agent-lib-name> entry point where - <agent-lib-name> is the basename of the + <agent-lib-name> is the basename of the agent. In the above example -agentpath:c:\myLibs\foo.dll=opt1,opt2, the system will attempt to find and call the Agent_OnLoad_foo start-up routine.

Libraries loaded with -agentlib: or -agentpath: will be searched for JNI native method implementations to facilitate the - use of Java programming language code in tools, as is needed for + use of Java programming language code in tools, as is needed for bytecode instrumentation.

The agent libraries will be searched after all other libraries have been @@ -537,11 +537,11 @@ implementations of non-agent methods can use the NativeMethodBind event).

- These switches do the above and nothing more - they do not change the - state of the VM or . No command line options are needed - to enable + These switches do the above and nothing more - they do not change the + state of the VM or . No command line options are needed + to enable or aspects of , this is handled programmatically - by the use of + by the use of capabilities. @@ -557,29 +557,29 @@ Agent_OnAttach or Agent_OnAttach_L for statically linked agents will be invoked. - Exactly one call to a start-up function is made per agent. + Exactly one call to a start-up function is made per agent. If an agent is started during the OnLoad phase then its agent library must export a start-up function with the following prototype: -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) Or for a statically linked agent named 'L': -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved) - The VM will start the agent by calling this function. + The VM will start the agent by calling this function. It will be called early enough in VM initialization that:

  • system properties may be set before they have been used in the start-up of the VM
  • -
  • the full set of +
  • the full set of capabilities is still available (note that capabilities that configure the VM - may only be available at this time--see the + may only be available at this time--see the Capability function section)
  • no bytecodes have executed
  • no classes have been loaded
  • @@ -588,13 +588,13 @@

    The VM will call the Agent_OnLoad or Agent_OnLoad_<agent-lib-name> function with - <options> as the second argument - + <options> as the second argument - that is, using the command-line option examples, - "opt1,opt2" will be passed to the char *options + "opt1,opt2" will be passed to the char *options argument of Agent_OnLoad. The options argument is encoded as a modified UTF-8 string. - If =<options> is not specified, + If =<options> is not specified, a zero length string is passed to options. The lifespan of the options string is the Agent_OnLoad or Agent_OnLoad_<agent-lib-name> @@ -602,26 +602,26 @@ be copied. The period between when Agent_OnLoad is called and when it returns is called the OnLoad phase. - Since the VM is not initialized during the OnLoad + Since the VM is not initialized during the OnLoad phase, - the set of allowed operations + the set of allowed operations inside Agent_OnLoad is restricted (see the function descriptions for the - functionality available at this time). - The agent can safely process the options and set - event callbacks with . Once - the VM initialization event is received - (that is, the VMInit + functionality available at this time). + The agent can safely process the options and set + event callbacks with . Once + the VM initialization event is received + (that is, the VMInit callback is invoked), the agent can complete its initialization. Early startup is required so that agents can set the desired capabilities, many of which must be set before the VM is initialized. - In JVMDI, the -Xdebug command-line option provided - very coarse-grain control of capabilities. + In JVMDI, the -Xdebug command-line option provided + very coarse-grain control of capabilities. JVMPI implementations use various tricks to provide a single "JVMPI on" switch. - No reasonable command-line + No reasonable command-line option could provide the fine-grain of control required to balance needed capabilities vs - performance impact. + performance impact. Early startup is also needed so that agents can control the execution environment - modifying the file system and system properties to install their functionality. @@ -631,75 +631,75 @@ Agent_OnLoad_<agent-lib-name> is used to indicate an error. Any value other than zero indicates an error and causes termination of the VM. - + - A VM may support a mechanism that allows agents to be started in the VM during the live + A VM may support a mechanism that allows agents to be started in the VM during the live phase. The details of how this is supported, - are implementation specific. For example, a tool may use some platform specific mechanism, + are implementation specific. For example, a tool may use some platform specific mechanism, or implementation specific API, to attach to the running VM, and request it start a given agent.

    If an agent is started during the live phase then its agent library - must export a start-up function + must export a start-up function with the following prototype: -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM* vm, char *options, void *reserved) Or for a statically linked agent named 'L': -JNIEXPORT jint JNICALL +JNIEXPORT jint JNICALL Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved) -

    - The VM will start the agent by calling this function. +

    + The VM will start the agent by calling this function. It will be called in the context of a thread that is attached to the VM. The first argument <vm> is the Java VM. The <options> argument is the startup options provided to the agent. <options> is encoded as a modified UTF-8 string. - If startup options were not provided, a zero length string is passed to - options. The lifespan of the options string is the + If startup options were not provided, a zero length string is passed to + options. The lifespan of the options string is the Agent_OnAttach or Agent_OnAttach_<agent-lib-name> call. If needed beyond this time the string or parts of the string must be copied.

    - Note that some capabilities + Note that some capabilities may not be available in the live phase.

    The Agent_OnAttach or Agent_OnAttach_<agent-lib-name > function initializes the agent and returns a value - to the VM to indicate if an error occurred. Any value other than zero indicates an error. - An error does not cause the VM to terminate. Instead the VM ignores the error, or takes - some implementation specific action -- for example it might print an error to standard error, + to the VM to indicate if an error occurred. Any value other than zero indicates an error. + An error does not cause the VM to terminate. Instead the VM ignores the error, or takes + some implementation specific action -- for example it might print an error to standard error, or record the error in a system log. - The library may optionally export a + The library may optionally export a shutdown function with the following prototype: -JNIEXPORT void JNICALL +JNIEXPORT void JNICALL Agent_OnUnload(JavaVM *vm) Or for a statically linked agent named 'L': -JNIEXPORT void JNICALL +JNIEXPORT void JNICALL Agent_OnUnload_L(JavaVM *vm) This function will be called by the VM when the library is about to be unloaded. The library will be unloaded (unless it is statically linked into the - executable) and this function will be called if some platform specific + executable) and this function will be called if some platform specific mechanism causes the unload (an unload mechanism is not specified in this document) - or the library is (in effect) unloaded by the termination of the VM whether through + or the library is (in effect) unloaded by the termination of the VM whether through normal termination or VM failure, including start-up failure. Uncontrolled shutdown is, of couse, an exception to this rule. - Note the distinction between this function and the + Note the distinction between this function and the VM Death event: for the VM Death event - to be sent, the VM must have run at least to the point of initialization and a valid + to be sent, the VM must have run at least to the point of initialization and a valid environment must exist which has set a callback for VMDeath and enabled the event. None of these are required for Agent_OnUnload or Agent_OnUnload_<agent-lib-name> and this function is also called if the library is unloaded for other reasons. - In the case that a VM Death event is sent, it will be sent before this + In the case that a VM Death event is sent, it will be sent before this function is called (assuming this function is called due to VM termination). This function can be used to clean-up resources allocated by the agent. @@ -709,17 +709,17 @@ or simply VMs launched deep within scripts, a JAVA_TOOL_OPTIONS variable is provided so that agents may be launched in these cases.

    - Platforms which support environment variables or other named strings, may support the - JAVA_TOOL_OPTIONS variable. This variable will be broken into options at white-space - boundaries. White-space characters include space, tab, carriage-return, new-line, - vertical-tab, and form-feed. Sequences of white-space characters are considered - equivalent to a single white-space character. No white-space is included in the options + Platforms which support environment variables or other named strings, may support the + JAVA_TOOL_OPTIONS variable. This variable will be broken into options at white-space + boundaries. White-space characters include space, tab, carriage-return, new-line, + vertical-tab, and form-feed. Sequences of white-space characters are considered + equivalent to a single white-space character. No white-space is included in the options unless quoted. Quoting is as follows:

      -
    • All characters enclosed between a pair of single quote marks (''), except a single +
    • All characters enclosed between a pair of single quote marks (''), except a single quote, are quoted.
    • Double quote characters have no special meaning inside a pair of single quote marks.
    • -
    • All characters enclosed between a pair of double quote marks (""), except a double +
    • All characters enclosed between a pair of double quote marks (""), except a double quote, are quoted.
    • Single quote characters have no special meaning inside a pair of double quote marks.
    • A quoted part can start or end anywhere in the variable.
    • @@ -727,24 +727,24 @@ the option like any other character and do not mark white-space boundaries.
    • The pair of quote marks is not included in the option.
    - JNI_CreateJavaVM (in the JNI Invocation API) will prepend these options to the options supplied - in its JavaVMInitArgs argument. Platforms may disable this feature in cases where security is - a concern; for example, the Reference Implementation disables this feature on Unix systems when - the effective user or group ID differs from the real ID. - This feature is intended to support the initialization of tools -- specifically including the - launching of native or Java programming language agents. Multiple tools may wish to use this - feature, so the variable should not be overwritten, instead, options should be appended to - the variable. Note that since the variable is processed at the time of the JNI Invocation + JNI_CreateJavaVM (in the JNI Invocation API) will prepend these options to the options supplied + in its JavaVMInitArgs argument. Platforms may disable this feature in cases where security is + a concern; for example, the Reference Implementation disables this feature on Unix systems when + the effective user or group ID differs from the real ID. + This feature is intended to support the initialization of tools -- specifically including the + launching of native or Java programming language agents. Multiple tools may wish to use this + feature, so the variable should not be overwritten, instead, options should be appended to + the variable. Note that since the variable is processed at the time of the JNI Invocation API create VM call, options processed by a launcher (e.g., VM selection options) will not be handled. The specification supports the use of multiple simultaneous agents. - Each agent has its own environment. + Each agent has its own environment. That is, the state is separate for each agent - changes to one environment do not affect the - others. The state of a + others. The state of a environment includes:
    • the event callbacks
    • @@ -752,7 +752,7 @@
    • the capabilities
    • the memory allocation/deallocation hooks
    - Although their state + Although their state is separate, agents inspect and modify the shared state of the VM, they also share the native environment in which they execute. As such, an agent can perturb the results of other agents or cause them @@ -761,30 +761,30 @@ of preventing destructive interactions between agents. Techniques to reduce the likelihood of these occurrences are beyond the scope of this document.

    - An agent creates a environment - by passing a version - as the interface ID to the JNI Invocation API function - + An agent creates a environment + by passing a version + as the interface ID to the JNI Invocation API function + GetEnv. See Accessing Functions - for more details on the creation and use of + for more details on the creation and use of environments. - Typically, environments are created by calling GetEnv from + Typically, environments are created by calling GetEnv from Agent_OnLoad. This interface does not include some events that one might expect in an interface with profiling support. Some examples include object allocation events and full speed - method enter and exit events. The interface instead provides support for + method enter and exit events. The interface instead provides support for bytecode instrumentation, the ability to alter the Java virtual machine bytecode instructions which comprise the target program. Typically, these alterations are to add "events" to the code of a method - for example, to add, at the beginning of a method, - a call to MyProfiler.methodEntered(). + a call to MyProfiler.methodEntered(). Since the changes are purely additive, they do not modify application state or behavior. Because the inserted agent code is standard bytecodes, the VM can run at full speed, - optimizing not only the target program but also the instrumentation. If the + optimizing not only the target program but also the instrumentation. If the instrumentation does not involve switching from bytecode execution, no expensive state transitions are needed. The result is high performance events. This approach also provides complete control to the agent: instrumentation can be @@ -792,14 +792,14 @@ can be conditional. Instrumentation can run entirely in Java programming language code or can call into the native agent. Instrumentation can simply maintain counters or can statistically sample events. -

    +

    Instrumentation can be inserted in one of three ways:

    • Static Instrumentation: The class file is instrumented before it is loaded into the VM - for example, by creating a duplicate directory of *.class files which have been modified to add the instrumentation. - This method is extremely awkward and, in general, an agent cannot know + This method is extremely awkward and, in general, an agent cannot know the origin of the class files which will be loaded.
    • @@ -817,21 +817,21 @@ function. Classes can be modified multiple times and can be returned to their original state. - The mechanism allows instrumentation which changes during the + The mechanism allows instrumentation which changes during the course of execution.
    -

    +

    The class modification functionality provided in this interface is intended to provide a mechanism for instrumentation (the event and the function) and, during development, for fix-and-continue debugging (the function). -

    - Care must be taken to avoid perturbing dependencies, especially when +

    + Care must be taken to avoid perturbing dependencies, especially when instrumenting core classes. For example, an approach to getting notification - of every object allocation is to instrument the constructor on + of every object allocation is to instrument the constructor on Object. Assuming that the constructor is initially empty, the constructor could be changed to: @@ -839,15 +839,15 @@ MyProfiler.allocationTracker(this); } - However, if this change was made using the + However, if this change was made using the - event then this might impact a typical VM as follows: + event then this might impact a typical VM as follows: the first created object will call the constructor causing a class load of MyProfiler; which will then cause object creation, and since MyProfiler isn't loaded yet, infinite recursion; resulting in a stack overflow. A refinement of this would be to delay invoking the tracking method until a safe time. For - example, trackAllocations could be set in the + example, trackAllocations could be set in the handler for the VMInit event. static boolean trackAllocations = false; @@ -881,17 +881,17 @@ uses modified UTF-8 to encode character strings. This is the same encoding used by JNI. - Modified UTF-8 differs - from standard UTF-8 in the representation of supplementary characters + Modified UTF-8 differs + from standard UTF-8 in the representation of supplementary characters and of the null character. See the - + Modified UTF-8 Strings section of the JNI specification for details. Since this interface provides access to the state of applications running in the - Java virtual machine; + Java virtual machine; terminology refers to the Java platform and not the native platform (unless stated otherwise). For example:

      @@ -903,20 +903,20 @@

    Sun, Sun Microsystems, the Sun logo, Java, and JVM - are trademarks or registered trademarks of Oracle + are trademarks or registered trademarks of Oracle and/or its affiliates, in the U.S. and other countries. - Native code accesses features - by calling functions. + Native code accesses features + by calling functions. Access to functions is by use of an interface pointer - in the same manner as - Java + in the same manner as + Java Native Interface (JNI) functions are accessed. - The interface pointer is called the + The interface pointer is called the environment pointer.

    An environment pointer is a pointer to an environment and has @@ -924,8 +924,8 @@ An environment has information about its connection. The first value in the environment is a pointer to the function table. The function table is an array of pointers to functions. - Every function pointer is at a predefined offset inside the - array. + Every function pointer is at a predefined offset inside the + array.

    When used from the C language: double indirection is used to access the functions; @@ -945,7 +945,7 @@ ... jvmtiError err = jvmti->GetLoadedClasses(&class_count, &classes); - Unless otherwise stated, all examples and declarations in this + Unless otherwise stated, all examples and declarations in this specification use the C language.

    A environment can be obtained through the JNI Invocation API @@ -955,24 +955,24 @@ ... (*jvm)->GetEnv(jvm, &jvmti, JVMTI_VERSION_1_0); - Each call to GetEnv + Each call to GetEnv creates a new connection and thus - a new environment. + a new environment. The version argument of GetEnv must be a version. The returned environment may have a different version than the requested version but the returned environment must be compatible. - GetEnv will return JNI_EVERSION if a + GetEnv will return JNI_EVERSION if a compatible version is not available, if is not supported or is not supported in the current VM configuration. Other interfaces may be added for creating environments in specific contexts. Each environment has its own state (for example, - desired events, - event handling functions, and - capabilities). - An environment is released with - . + desired events, + event handling functions, and + capabilities). + An environment is released with + . Thus, unlike JNI which has one environment per thread, environments work across threads and are created dynamically. @@ -980,12 +980,12 @@ functions always return an error code via the - function return value. + function return value. Some functions can return additional - values through pointers provided by the calling function. + values through pointers provided by the calling function. In some cases, functions allocate memory that your program must explicitly deallocate. This is indicated in the individual - function descriptions. Empty lists, arrays, sequences, etc are + function descriptions. Empty lists, arrays, sequences, etc are returned as NULL.

    In the event that the function encounters @@ -996,26 +996,26 @@ - functions identify objects with JNI references + functions identify objects with JNI references ( and ) and their derivatives ( and ). - References passed to - functions can be either global or local, but they must be - strong references. All references returned by functions are - local references--these local references are created + References passed to + functions can be either global or local, but they must be + strong references. All references returned by functions are + local references--these local references are created during the call. - Local references are a resource that must be managed (see the - - JNI Documentation). + Local references are a resource that must be managed (see the + + JNI Documentation). When threads return from native code all local references are freed. Note that some threads, including typical agent threads, will never return from native code. - A thread is ensured the ability to create sixteen local + A thread is ensured the ability to create sixteen local references without the need for any explicit management. For threads executing a limited number of calls before returning from native code - (for example, threads processing events), + (for example, threads processing events), it may be determined that no explicit management is needed. However, long running agent threads will need explicit @@ -1023,7 +1023,7 @@ PushLocalFrame and PopLocalFrame. Conversely, to preserve references beyond the return from native code, they must be converted to global references. - These rules do not apply to and + These rules do not apply to and as they are not s. @@ -1035,21 +1035,21 @@ - functions never throw exceptions; error conditions are - communicated via the + functions never throw exceptions; error conditions are + communicated via the function return value. - Any existing exception state is preserved across a call to a + Any existing exception state is preserved across a call to a function. See the - Java Exceptions section of the JNI specification for information on handling exceptions. - These functions provide for the allocation and deallocation of + These functions provide for the allocation and deallocation of memory used by functionality and can be used to provide working memory for agents. Memory managed by is not compatible with other memory @@ -1059,7 +1059,7 @@ Allocate - Allocate an area of memory through the allocator. + Allocate an area of memory through the allocator. The allocated memory should be freed with . @@ -1097,9 +1097,9 @@ Deallocate - Deallocate mem using the allocator. + Deallocate mem using the allocator. This function should - be used to deallocate any memory allocated and returned + be used to deallocate any memory allocated and returned by a function (including memory allocated with ). All allocated memory must be deallocated @@ -1143,60 +1143,60 @@

  • Why not alive?
    • New.
    • -
    • Terminated (Terminated (JVMTI_THREAD_STATE_TERMINATED)
-
  • Alive (Alive (JVMTI_THREAD_STATE_ALIVE)
    • Suspended?
        -
      • Suspended (Suspended (JVMTI_THREAD_STATE_SUSPENDED)
      • Not suspended
    • Interrupted?
        -
      • Interrupted (Interrupted (JVMTI_THREAD_STATE_INTERRUPTED)
      • Not interrupted.
    • In native?
        -
      • In native code (In native code (JVMTI_THREAD_STATE_IN_NATIVE)
      • In Java programming language code
    • What alive state?
        -
      • Runnable (Runnable (JVMTI_THREAD_STATE_RUNNABLE)
      • -
      • Blocked (Blocked (JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER)
      • -
      • Waiting (Waiting (JVMTI_THREAD_STATE_WAITING)
        • Timed wait?
            -
          • Indefinite (Indefinite (JVMTI_THREAD_STATE_WAITING_INDEFINITELY
          • -
          • Timed (Timed (JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT)
        • Why waiting?
            -
          • Object.wait (Object.wait (JVMTI_THREAD_STATE_IN_OBJECT_WAIT)
          • -
          • LockSupport.park (LockSupport.park (JVMTI_THREAD_STATE_PARKED)
          • -
          • Sleeping (Sleeping (JVMTI_THREAD_STATE_SLEEPING)
        • @@ -1210,7 +1210,7 @@

        - The answers are represented by the following bit vector. + The answers are represented by the following bit vector. Thread is alive. Zero if thread is new (not started) or terminated. @@ -1223,7 +1223,7 @@ Thread is waiting to enter a synchronization block/method or, - after an Object.wait(), waiting to re-enter a + after an Object.wait(), waiting to re-enter a synchronization block/method. @@ -1250,8 +1250,8 @@ Thread suspended. java.lang.Thread.suspend() - or a suspend function - (such as ) + or a suspend function + (such as ) has been called on the thread. If this bit is set, the other bits refer to the thread state before suspension. @@ -1313,7 +1313,7 @@ Rules

        There can be no more than one answer to a question, although there can be no - answer (because the answer is unknown, does not apply, or none of the answers is + answer (because the answer is unknown, does not apply, or none of the answers is correct). An answer is set only when the enclosing answers match. That is, no more than one of

          @@ -1322,32 +1322,32 @@
        • JVMTI_THREAD_STATE_WAITING
        can be set (a J2SE compliant implementation will always set - one of these if JVMTI_THREAD_STATE_ALIVE is set). - And if any of these are set, the enclosing answer - JVMTI_THREAD_STATE_ALIVE is set. + one of these if JVMTI_THREAD_STATE_ALIVE is set). + And if any of these are set, the enclosing answer + JVMTI_THREAD_STATE_ALIVE is set. No more than one of
        • JVMTI_THREAD_STATE_WAITING_INDEFINITELY
        • JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT
        can be set (a J2SE compliant implementation will always set - one of these if JVMTI_THREAD_STATE_WAITING is set). - And if either is set, the enclosing answers - JVMTI_THREAD_STATE_ALIVE and - JVMTI_THREAD_STATE_WAITING are set. + one of these if JVMTI_THREAD_STATE_WAITING is set). + And if either is set, the enclosing answers + JVMTI_THREAD_STATE_ALIVE and + JVMTI_THREAD_STATE_WAITING are set. No more than one of
        • JVMTI_THREAD_STATE_IN_OBJECT_WAIT
        • JVMTI_THREAD_STATE_PARKED
        • JVMTI_THREAD_STATE_SLEEPING
        - can be set. And if any of these is set, the enclosing answers - JVMTI_THREAD_STATE_ALIVE and - JVMTI_THREAD_STATE_WAITING are set. + can be set. And if any of these is set, the enclosing answers + JVMTI_THREAD_STATE_ALIVE and + JVMTI_THREAD_STATE_WAITING are set. Also, if JVMTI_THREAD_STATE_SLEEPING is set, then JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT is set. - If a state A is implemented using the mechanism of - state B then it is state A which + If a state A is implemented using the mechanism of + state B then it is state A which is returned by this function. For example, if Thread.sleep(long) is implemented using Object.wait(long) @@ -1364,16 +1364,16 @@

        And finally, JVMTI_THREAD_STATE_TERMINATED cannot be set unless - JVMTI_THREAD_STATE_ALIVE is not set. + JVMTI_THREAD_STATE_ALIVE is not set.

        The thread state representation is designed for extension in future versions of the specification; thread state values should be used accordingly, that is - they should not be used as ordinals. + they should not be used as ordinals. Most queries can be made by testing a single bit, if use in a switch statement is desired, the state bits should be masked with the interesting bits. - All bits not defined above are reserved for future use. + All bits not defined above are reserved for future use. A VM, compliant to the current specification, must set reserved bits to zero. - An agent should ignore reserved bits -- + An agent should ignore reserved bits -- they should not be assumed to be zero and thus should not be included in comparisons.

        Examples @@ -1390,8 +1390,8 @@ The state of a thread at a Object.wait(3000) would be: - JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING + - JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + + JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING + + JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + JVMTI_THREAD_STATE_MONITOR_WAITING The state of a thread suspended while runnable would be: @@ -1423,7 +1423,7 @@ To distinguish timed from untimed Object.wait: - if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) { + if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) { if (state & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) { printf("in Object.wait(long timeout)\n"); } else { @@ -1436,7 +1436,7 @@

        The thread state represented by java.lang.Thread.State returned from java.lang.Thread.getState() is a subset of the - information returned from this function. + information returned from this function. The corresponding java.lang.Thread.State can be determined by using the provided conversion masks. For example, this returns the name of the java.lang.Thread.State thread state: @@ -1466,7 +1466,7 @@ - The thread to query. + The thread to query. @@ -1484,15 +1484,15 @@ Get Current Thread - Get the current thread. + Get the current thread. The current thread is the Java programming language thread which has called the function. The function may return NULL in the start phase if the can_generate_early_vmstart capability is enabled and the java.lang.Thread class has not been initialized yet.

        - Note that most functions that take a thread - as an argument will accept NULL to mean + Note that most functions that take a thread + as an argument will accept NULL to mean the current thread. new @@ -1516,12 +1516,12 @@ Get all live threads. The threads are Java programming language threads; that is, threads that are attached to the VM. - A thread is live if java.lang.Thread.isAlive() + A thread is live if java.lang.Thread.isAlive() would return true, that is, the thread has been started and has not yet died. The universe of threads is determined by the context of the environment, which typically is all threads attached to the VM. - Note that this includes agent threads + Note that this includes agent threads (see ). jvmdi @@ -1549,8 +1549,8 @@ Suspend Thread - Suspend the specified thread. If the calling thread is specified, - this function will not return until some other thread calls + Suspend the specified thread. If the calling thread is specified, + this function will not return until some other thread calls . If the thread is currently suspended, this function does nothing and returns an error. @@ -1563,7 +1563,7 @@ - The thread to suspend. + The thread to suspend. @@ -1592,22 +1592,22 @@ The threads are Java programming language threads; native threads which are not attached to the VM are not Java programming language threads. - A thread is live if java.lang.Thread.isAlive() + A thread is live if java.lang.Thread.isAlive() would return true, that is, the thread has been started and has not yet died. - The universe of threads is determined + The universe of threads is determined by the context of the environment, which, typically, is all threads attached to the VM, - except critical VM internal threads and agent threads + except critical VM internal threads and agent threads (see ).

        - If the calling thread is specified, + If the calling thread is specified, all other threads are suspended first then the caller thread is suspended - - this function will not return until some other thread calls + this function will not return until some other thread calls .

        The list of actually - suspended threads is returned in + suspended threads is returned in . Suspension is as defined in . @@ -1662,13 +1662,13 @@ Suspend Thread List - Suspend the - threads specified in the - array. + Suspend the + threads specified in the + array. Threads may be resumed with or . - If the calling thread is specified in the + If the calling thread is specified in the array, this function will not return until some other thread resumes it. Errors encountered in the suspension of a thread @@ -1696,11 +1696,11 @@ jvmtiError - An agent supplied array of + An agent supplied array of elements. On return, filled with the error code for the suspend of the corresponding thread. - The error code will be + The error code will be if the thread was suspended by this call. Possible error codes are those specified @@ -1715,12 +1715,12 @@ Resume Thread - Resume a suspended thread. + Resume a suspended thread. Any threads currently suspended through a suspend function (eg. - ) + ) or java.lang.Thread.suspend() - will resume execution; + will resume execution; all other threads are unaffected. jvmdi @@ -1740,7 +1740,7 @@ Thread was not suspended. - The state of the thread has been modified, and is now inconsistent. + The state of the thread has been modified, and is now inconsistent. @@ -1748,12 +1748,12 @@ Resume Thread List - Resume the - threads specified in the - array. + Resume the + threads specified in the + array. Any thread suspended through a suspend function (eg. - ) + ) or java.lang.Thread.suspend() will resume execution. @@ -1777,11 +1777,11 @@ jvmtiError - An agent supplied array of + An agent supplied array of elements. On return, filled with the error code for the resume of the corresponding thread. - The error code will be + The error code will be if the thread was suspended by this call. Possible error codes are those specified @@ -1796,9 +1796,9 @@ Stop Thread - Send the specified asynchronous exception to the specified thread + Send the specified asynchronous exception to the specified thread (similar to java.lang.Thread.stop). - Normally, this function is used to kill the specified thread with an + Normally, this function is used to kill the specified thread with an instance of the exception ThreadDeath. jvmdi @@ -1883,7 +1883,7 @@ - Get thread information. The fields of the structure + Get thread information. The fields of the structure are filled in with details of the specified thread. jvmdi @@ -1910,8 +1910,8 @@ Get Owned Monitor Info - Get information about the monitors owned by the - specified thread. + Get information about the monitors owned by the + specified thread. jvmdiClone @@ -1943,7 +1943,7 @@ Get Owned Monitor Stack Depth Info - @@ -1954,18 +1954,18 @@ - The stack depth. Corresponds to the stack depth used in the + The stack depth. Corresponds to the stack depth used in the Stack Frame functions. That is, zero is the current frame, one is the frame which - called the current frame. And it is negative one if the - implementation cannot determine the stack depth (e.g., for + called the current frame. And it is negative one if the + implementation cannot determine the stack depth (e.g., for monitors acquired by JNI MonitorEnter). - Get information about the monitors owned by the - specified thread and the depth of the stack frame which locked them. + Get information about the monitors owned by the + specified thread and the depth of the stack frame which locked them. new @@ -2000,7 +2000,7 @@ Get Current Contended Monitor - Get the object, if any, whose monitor the specified thread is waiting to + Get the object, if any, whose monitor the specified thread is waiting to enter or waiting to regain through java.lang.Object.wait. jvmdi @@ -2057,7 +2057,7 @@ - The arg parameter passed to + The arg parameter passed to . @@ -2071,13 +2071,13 @@ The parameter is forwarded on to the start function (specified with ) as its single argument. - This function allows the creation of agent threads - for handling communication with another process or for handling events - without the need to load a special subclass of java.lang.Thread or - implementer of java.lang.Runnable. + This function allows the creation of agent threads + for handling communication with another process or for handling events + without the need to load a special subclass of java.lang.Thread or + implementer of java.lang.Runnable. Instead, the created thread can run entirely in native code. However, the created thread does require a newly created instance - of java.lang.Thread (referenced by the argument thread) to + of java.lang.Thread (referenced by the argument thread) to which it will be associated. The thread object can be created with JNI calls.

        @@ -2105,14 +2105,14 @@ added to the thread group and the thread is not seen on queries of the thread group at either the Java programming language or levels.

        - The thread is not visible to Java programming language queries but is - included in queries (for example, + The thread is not visible to Java programming language queries but is + included in queries (for example, and ).

        Upon execution of proc, the new thread will be attached to the - VM -- see the JNI documentation on - Attaching to the VM. jvmdiClone @@ -2152,8 +2152,8 @@ - - is less than + + is less than or greater than @@ -2169,7 +2169,7 @@ This value is NULL unless set with this function. Agents can allocate memory in which they store thread specific information. By setting thread-local storage it can then be - accessed with + accessed with .

        This function is called by the agent to set the value of the @@ -2188,10 +2188,10 @@ - - - value is set to NULL - + + + value is set to NULL + The value to be entered into the thread-local storage. @@ -2205,7 +2205,7 @@ Get Thread Local Storage Called by the agent to get the value of the thread-local - storage. + storage. jvmpi @@ -2220,10 +2220,10 @@ - Pointer through which the value of the thread local + Pointer through which the value of the thread local storage is returned. If thread-local storage has not been set with - the returned + the returned pointer is NULL. @@ -2294,8 +2294,8 @@ - Get information about the thread group. The fields of the - structure + Get information about the thread group. The fields of the + structure are filled in with details of the specified thread group. jvmdi @@ -2312,7 +2312,7 @@ jvmtiThreadGroupInfo On return, filled with information describing the specified - thread group. + thread group. @@ -2373,15 +2373,15 @@

        Stack frames are as described in , - That is, they correspond to method - invocations (including native methods) but do not correspond to platform native or + That is, they correspond to method + invocations (including native methods) but do not correspond to platform native or VM internal frames.

        A implementation may use method invocations to launch a thread and the corresponding frames may be included in the stack as presented by these functions -- that is, there may be frames shown deeper than main() and run(). - However this presentation must be consistent across all functionality which + However this presentation must be consistent across all functionality which uses stack frames or stack depth. @@ -2425,16 +2425,16 @@ jvmtiFrameInfo - On return, this agent allocated buffer is filled - with stack frame information. + On return, this agent allocated buffer is filled + with stack frame information. - On return, the number of records filled into + On return, the number of records filled into frame_buffer. - This will be + This will be min(max_frame_count, stackDepth). @@ -2445,7 +2445,7 @@ Get information about the stack of a thread. If is less than the depth of the stack, - the topmost frames are returned, + the topmost frames are returned, otherwise the entire stack is returned. The topmost frames, those most recently invoked, are at the beginning of the returned buffer.

        @@ -2457,23 +2457,23 @@ jint count; jvmtiError err; -err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5, +err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5, frames, &count); if (err == JVMTI_ERROR_NONE && count >= 1) { char *methodName; - err = (*jvmti)->GetMethodName(jvmti, frames[0].method, + err = (*jvmti)->GetMethodName(jvmti, frames[0].method, &methodName, NULL, NULL); if (err == JVMTI_ERROR_NONE) { printf("Executing method: %s", methodName); } } - + check example code.

        The need not be suspended - to call this function. + to call this function.

        The function can be used to map locations to line numbers. Note that @@ -2492,15 +2492,15 @@ - Begin retrieving frames at this depth. - If non-negative, count from the current frame, - the first frame retrieved is at depth start_depth. + Begin retrieving frames at this depth. + If non-negative, count from the current frame, + the first frame retrieved is at depth start_depth. For example, if zero, start from the current frame; if one, start from the caller of the current frame; if two, start from the caller of the caller of the current frame; and so on. If negative, count from below the oldest frame, - the first frame retrieved is at depth stackDepth + start_depth, - where stackDepth is the count of frames on the stack. + the first frame retrieved is at depth stackDepth + start_depth, + where stackDepth is the count of frames on the stack. For example, if negative one, only the oldest frame is retrieved; if negative two, start from the frame called by the oldest frame. @@ -2516,17 +2516,17 @@ jvmtiFrameInfo - On return, this agent allocated buffer is filled - with stack frame information. + On return, this agent allocated buffer is filled + with stack frame information. On return, points to the number of records filled in. - For non-negative start_depth, this will be + For non-negative start_depth, this will be min(max_frame_count, stackDepth - start_depth). - For negative start_depth, this will be + For negative start_depth, this will be min(max_frame_count, -start_depth). @@ -2546,23 +2546,23 @@ Get information about the stacks of all live threads (including agent threads). If is less than the depth of a stack, - the topmost frames are returned for that thread, + the topmost frames are returned for that thread, otherwise the entire stack is returned. The topmost frames, those most recently invoked, are at the beginning of the returned buffer.

        - All stacks are collected simultaneously, that is, no changes will occur to the + All stacks are collected simultaneously, that is, no changes will occur to the thread state or stacks between the sampling of one thread and the next. The threads need not be suspended. - + jvmtiStackInfo *stack_info; jint thread_count; int ti; jvmtiError err; -err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count); +err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count); if (err != JVMTI_ERROR_NONE) { - ... + ... } for (ti = 0; ti < thread_count; ++ti) { jvmtiStackInfo *infop = &stack_info[ti]; @@ -2577,9 +2577,9 @@ } } /* this one Deallocate call frees all data allocated by GetAllStackTraces */ -err = (*jvmti)->Deallocate(jvmti, stack_info); +err = (*jvmti)->Deallocate(jvmti, stack_info); - + check example code. @@ -2599,12 +2599,12 @@ jvmtiStackInfo - On return, this buffer is filled - with stack information for each thread. - The number of records is determined + On return, this buffer is filled + with stack information for each thread. + The number of records is determined by .

        - Note that this buffer is allocated to include the + Note that this buffer is allocated to include the buffers pointed to by . These buffers must not be separately deallocated. @@ -2625,11 +2625,11 @@ Get information about the stacks of the supplied threads. If is less than the depth of a stack, - the topmost frames are returned for that thread, + the topmost frames are returned for that thread, otherwise the entire stack is returned. The topmost frames, those most recently invoked, are at the beginning of the returned buffer.

        - All stacks are collected simultaneously, that is, no changes will occur to the + All stacks are collected simultaneously, that is, no changes will occur to the thread state or stacks between the sampling one thread and the next. The threads need not be suspended.

        @@ -2667,12 +2667,12 @@ jvmtiStackInfo - On return, this buffer is filled - with stack information for each thread. - The number of records is determined + On return, this buffer is filled + with stack information for each thread. + The number of records is determined by .

        - Note that this buffer is allocated to include the + Note that this buffer is allocated to include the buffers pointed to by . These buffers must not be separately deallocated. @@ -2703,8 +2703,8 @@ - If false, - + If false, + must be false. @@ -2713,7 +2713,7 @@ Return the stack showing - model of the stack; + model of the stack; otherwise, show the internal representation of the stack with inlined and optimized methods missing. If the virtual machine is using the Java Virtual Machine Specification stack model @@ -2734,9 +2734,9 @@ The agent passes in a buffer - large enough to hold max_count records of + large enough to hold max_count records of . This buffer must be - pre-allocated by the agent. + pre-allocated by the agent. @@ -2788,27 +2788,27 @@ Pop Frame Pop the current frame of thread's stack. - Popping a frame takes you to the previous frame. - When the thread is resumed, the execution + Popping a frame takes you to the previous frame. + When the thread is resumed, the execution state of the thread is reset to the state immediately before the called method was invoked. That is (using terminology):

        • the current frame is discarded as the previous frame becomes the current one
        • the operand stack is restored--the argument values are added back - and if the invoke was not invokestatic, + and if the invoke was not invokestatic, objectref is added back as well
        • the Java virtual machine PC is restored to the opcode of the invoke instruction
        Note however, that any changes to the arguments, which - occurred in the called method, remain; - when execution continues, the first instruction to - execute will be the invoke. + occurred in the called method, remain; + when execution continues, the first instruction to + execute will be the invoke.

        - Between calling PopFrame and resuming the - thread the state of the stack is undefined. - To pop frames beyond the first, + Between calling PopFrame and resuming the + thread the state of the stack is undefined. + To pop frames beyond the first, these three steps must be repeated:

        • suspend the thread via an event (step, breakpoint, ...)
        • @@ -2816,11 +2816,11 @@
        • resume the thread

        - A lock acquired by calling the called method - (if it is a synchronized method) + A lock acquired by calling the called method + (if it is a synchronized method) and locks acquired by entering synchronized - blocks within the called method are released. - Note: this does not apply to native locks or + blocks within the called method are released. + Note: this does not apply to native locks or java.util.concurrent.locks locks.

        Finally blocks are not executed. @@ -2829,7 +2829,7 @@

        The specified thread must be suspended (which implies it cannot be the current thread).

        - Both the called method and calling method must be non-native Java programming + Both the called method and calling method must be non-native Java programming language methods.

        No events are generated by this function. @@ -2892,7 +2892,7 @@ - On return, points to the index of the currently + On return, points to the index of the currently executing instruction. Is set to -1 if the frame is executing a native method. @@ -2906,11 +2906,11 @@ Notify Frame Pop - When the frame that is currently at + When the frame that is currently at is popped from the stack, generate a - event. See the + event. See the event for details. - Only frames corresponding to non-native Java programming language + Only frames corresponding to non-native Java programming language methods can receive notification.

        The specified thread must either be the current thread @@ -2922,7 +2922,7 @@ - + The thread of the frame for which the frame pop event will be generated. @@ -2935,7 +2935,7 @@ - + The frame at depth is executing a native method. @@ -2954,7 +2954,7 @@ The method which will return early is referred to as the called method. The called method is the current method (as defined by - ) + ) for the specified thread at the time the function is called.

        @@ -2962,17 +2962,17 @@ The return occurs when execution of Java programming language code is resumed on this thread. Between calling one of these functions and resumption - of thread execution, the state of the stack is undefined. + of thread execution, the state of the stack is undefined.

        - No further instructions are executed in the called method. + No further instructions are executed in the called method. Specifically, finally blocks are not executed. Note: this can cause inconsistent states in the application.

        - A lock acquired by calling the called method - (if it is a synchronized method) + A lock acquired by calling the called method + (if it is a synchronized method) and locks acquired by entering synchronized - blocks within the called method are released. - Note: this does not apply to native locks or + blocks within the called method are released. + Note: this does not apply to native locks or java.util.concurrent.locks locks.

        Events, such as , @@ -2989,7 +2989,7 @@ This function can be used to return from a method whose result type is Object - or a subclass of Object. + or a subclass of Object. new @@ -3005,7 +3005,7 @@ - The return value for the called frame. + The return value for the called frame. An object or NULL. @@ -3017,12 +3017,12 @@ Or the implementation is unable to provide this functionality on this frame. - - The result type of the called method is not + + The result type of the called method is not Object or a subclass of Object. - - The supplied is not compatible with the + + The supplied is not compatible with the result type of the called method. @@ -3039,8 +3039,8 @@ This function can be used to return from a method whose result type is int, short, - char, byte, or - boolean. + char, byte, or + boolean. new @@ -3067,10 +3067,10 @@ Or the implementation is unable to provide this functionality on this frame. - - The result type of the called method is not + + The result type of the called method is not int, short, - char, byte, or + char, byte, or boolean. @@ -3113,7 +3113,7 @@ Or the implementation is unable to provide this functionality on this frame. - + The result type of the called method is not long. @@ -3156,7 +3156,7 @@ Or the implementation is unable to provide this functionality on this frame. - + The result type of the called method is not float. @@ -3197,7 +3197,7 @@ Attempted to return early from a frame corresponding to a native method. Or the implementation is unable to provide this functionality on this frame. - + The result type of the called method is not double. @@ -3234,8 +3234,8 @@ Or the implementation is unable to provide this functionality on this frame. - - The called method has a result type. + + The called method has a result type. Thread was not the current thread and was not suspended. @@ -3254,12 +3254,12 @@ Functionality includes the ability to view the objects in the heap and to tag these objects. - + A tag is a value associated with an object. Tags are explicitly set by the agent using the function or by - callback functions such as . + callback functions such as .

        Tags are local to the environment; that is, the tags of one environment are not visible in another. @@ -3267,10 +3267,10 @@ Tags are jlong values which can be used simply to mark an object or to store a pointer to more detailed information. Objects which have not been tagged have a - tag of zero. + tag of zero. Setting a tag to zero makes the object untagged. - + Heap functions which iterate through the heap and recursively follow object references use agent supplied callback functions @@ -3278,7 +3278,7 @@

        These heap callback functions must adhere to the following restrictions -- These callbacks must not use JNI functions. - These callbacks must not use functions except + These callbacks must not use functions except callback safe functions which specifically allow such use (see the raw monitor, memory management, and environment local storage functions). @@ -3289,7 +3289,7 @@ be invoked at a time.

        The Heap Filter Flags can be used to prevent reporting - based on the tag status of an object or its class. + based on the tag status of an object or its class. If no flags are set (the jint is zero), objects will not be filtered out. @@ -3310,43 +3310,43 @@

        The Heap Visit Control Flags are returned by the heap callbacks - and can be used to abort the iteration. For the - Heap - Reference Callback, it can also be used + and can be used to abort the iteration. For the + Heap + Reference Callback, it can also be used to prune the graph of traversed references (JVMTI_VISIT_OBJECTS is not set). - If we are visiting an object and if this callback - was initiated by , + was initiated by , traverse the references of this object. Otherwise ignored. - + Abort the iteration. Ignore all other bits.

        - The Heap Reference Enumeration is provided by the - Heap - Reference Callback and - Primitive Field - Callback to + The Heap Reference Enumeration is provided by the + Heap + Reference Callback and + Primitive Field + Callback to describe the kind of reference being reported. - Reference from an object to its class. - + Reference from an object to the value of one of its instance fields. @@ -3361,11 +3361,11 @@ Reference from a class to its protection domain. - + - Reference from a class to one of its interfaces. + Reference from a class to one of its interfaces. Note: interfaces are defined via a constant pool reference, - so the referenced interfaces may also be reported with a + so the referenced interfaces may also be reported with a JVMTI_HEAP_REFERENCE_CONSTANT_POOL reference kind. @@ -3375,10 +3375,10 @@ Reference from a class to a resolved entry in the constant pool. - Reference from a class to its superclass. + Reference from a class to its superclass. A callback is not sent if the superclass is java.lang.Object. Note: loaded classes define superclasses via a constant pool - reference, so the referenced superclass may also be reported with + reference, so the referenced superclass may also be reported with a JVMTI_HEAP_REFERENCE_CONSTANT_POOL reference kind. @@ -3408,88 +3408,88 @@ Definitions for the single character type descriptors of primitive types. - 'Z' - Java programming language boolean - JNI jboolean - + 'B' - Java programming language byte - JNI jbyte - + 'C' - Java programming language char - JNI jchar - + 'S' - Java programming language short - JNI jshort - + 'I' - Java programming language int - JNI jint - + 'J' - Java programming language long - JNI jlong - + 'F' - Java programming language float - JNI jfloat - + 'D' - Java programming language double - JNI jdouble - + - - Reference information returned for - and + Reference information returned for + and references. - - For , the - referrer object is not a class or an inteface. - In this case, index is the index of the field - in the class of the referrer object. + + For , the + referrer object is not a class or an inteface. + In this case, index is the index of the field + in the class of the referrer object. This class is referred to below as C.

        For , the referrer object is a class (referred to below as C) or an interface (referred to below as I). - In this case, index is the index of the field in + In this case, index is the index of the field in that class or interface.

        - If the referrer object is not an interface, then the field - indices are determined as follows: + If the referrer object is not an interface, then the field + indices are determined as follows:

        • make a list of all the fields in C and its - superclasses, starting with all the fields in + superclasses, starting with all the fields in java.lang.Object and ending with all the fields in C.
        • -
        • Within this list, put +
        • Within this list, put the fields for a given class in the order returned by .
        • -
        • Assign the fields in this list indices - n, n+1, ..., in order, where n +
        • Assign the fields in this list indices + n, n+1, ..., in order, where n is the count of the fields in all the interfaces - implemented by C. - Note that C implements all interfaces + implemented by C. + Note that C implements all interfaces directly implemented by its superclasses; as well as all superinterfaces of these interfaces.
        - If the referrer object is an interface, then the field + If the referrer object is an interface, then the field indices are determined as follows:
          -
        • make a list of the fields directly declared in +
        • make a list of the fields directly declared in I.
        • -
        • Within this list, put +
        • Within this list, put the fields in the order returned by .
        • -
        • Assign the fields in this list indices - n, n+1, ..., in order, where n +
        • Assign the fields in this list indices + n, n+1, ..., in order, where n is the count of the fields in all the superinterfaces of I.
        @@ -3522,7 +3522,7 @@ Assume that called on C1 returns the fields of C1 in the - order: a, b; and that the fields of C2 are + order: a, b; and that the fields of C2 are returned in the order: q, r. An instance of class C1 will have the following field indices: @@ -3569,7 +3569,7 @@ The count of the fields in the interfaces implemented by C2 is three (n=3): p of I0, - x of I1 and y of I2 + x of I1 and y of I2 (an interface of C2). Note that the field p of I0 is only included once. @@ -3611,7 +3611,7 @@ The class C2 will have the same field indices. Note that a field may have a different index depending on the object that is viewing it -- for example field "a" above. - Note also: not all field indices may be visible from the + Note also: not all field indices may be visible from the callbacks, but all indices are shown for illustrative purposes.

        The interface I1 will have the @@ -3631,46 +3631,46 @@

  • - + - - Reference information returned for + Reference information returned for references. - + The array index. - - Reference information returned for + Reference information returned for references. - - The index into the constant pool of the class. See the description in + + The index into the constant pool of the class. See the description in . - - Reference information returned for + Reference information returned for references. @@ -3688,7 +3688,7 @@ - The depth of the frame. + The depth of the frame. @@ -3711,11 +3711,11 @@ - - Reference information returned for + Reference information returned for references. @@ -3733,7 +3733,7 @@ - The depth of the frame. + The depth of the frame. @@ -3744,8 +3744,8 @@ - Reference information returned for other references. @@ -3800,8 +3800,8 @@ - The information returned about referrers. @@ -3809,50 +3809,50 @@ jvmtiHeapReferenceInfoField - - The referrer information for - + + The referrer information for + and references. jvmtiHeapReferenceInfoArray - - The referrer information for + + The referrer information for For references. jvmtiHeapReferenceInfoConstantPool - - The referrer information for + + The referrer information for For references. jvmtiHeapReferenceInfoStackLocal - - The referrer information for + + The referrer information for For references. jvmtiHeapReferenceInfoJniLocal - - The referrer information for + + The referrer information for For references. jvmtiHeapReferenceInfoReserved - + reserved for future use. - @@ -3860,22 +3860,22 @@ The callback to be called to describe an - object in the heap. Used by the + object in the heap. Used by the function, ignored by the function. - + jvmtiHeapReferenceCallback The callback to be called to describe an - object reference. Used by the + object reference. Used by the function, ignored by the function. - + jvmtiPrimitiveFieldCallback @@ -3884,7 +3884,7 @@ The callback to be called to describe a primitive field. - + jvmtiArrayPrimitiveValueCallback @@ -3893,7 +3893,7 @@ The callback to be called to describe an array of primitive values. - + jvmtiStringPrimitiveValueCallback @@ -3901,7 +3901,7 @@ The callback to be called to describe a String value. - + jvmtiReservedCallback @@ -3909,7 +3909,7 @@ Reserved for future use.. - + jvmtiReservedCallback @@ -3917,7 +3917,7 @@ Reserved for future use.. - + jvmtiReservedCallback @@ -3925,7 +3925,7 @@ Reserved for future use.. - + jvmtiReservedCallback @@ -3933,7 +3933,7 @@ Reserved for future use.. - + jvmtiReservedCallback @@ -3941,7 +3941,7 @@ Reserved for future use.. - + jvmtiReservedCallback @@ -3949,7 +3949,7 @@ Reserved for future use.. - + jvmtiReservedCallback @@ -3957,7 +3957,7 @@ Reserved for future use.. - + jvmtiReservedCallback @@ -3965,7 +3965,7 @@ Reserved for future use.. - + jvmtiReservedCallback @@ -3973,7 +3973,7 @@ Reserved for future use.. - + jvmtiReservedCallback @@ -3981,7 +3981,7 @@ Reserved for future use.. - + jvmtiReservedCallback @@ -3989,7 +3989,7 @@ Reserved for future use.. - + @@ -4033,10 +4033,10 @@ - The tag of the class of object (zero if the class is not tagged). - If the object represents a runtime class, - the class_tag is the tag - associated with java.lang.Class + The tag of the class of object (zero if the class is not tagged). + If the object represents a runtime class, + the class_tag is the tag + associated with java.lang.Class (zero if java.lang.Class is not tagged). @@ -4051,7 +4051,7 @@ The object tag value, or zero if the object is not tagged. To set the tag value to be associated with the object - the agent sets the jlong pointed to by the parameter. + the agent sets the jlong pointed to by the parameter. @@ -4063,17 +4063,17 @@ - The user supplied data that was passed into the iteration function. - - - - + The user supplied data that was passed into the iteration function. + + + + Heap Reference Callback - Agent supplied callback function. + Agent supplied callback function. Describes a reference from an object or the VM (the referrer) to another object (the referree) or a heap root to a referree.

    @@ -4097,12 +4097,12 @@ jvmtiHeapReferenceInfo - Details about the reference. + Details about the reference. Set when the reference_kind is , , , - , + , , or . Otherwise NULL. @@ -4111,9 +4111,9 @@ - The tag of the class of referree object (zero if the class is not tagged). - If the referree object represents a runtime class, - the class_tag is the tag + The tag of the class of referree object (zero if the class is not tagged). + If the referree object represents a runtime class, + the class_tag is the tag associated with java.lang.Class (zero if java.lang.Class is not tagged). @@ -4131,14 +4131,14 @@ - Size of the referree object (in bytes). + Size of the referree object (in bytes). See . - Points to the referree object tag value, or zero if the object is not + Points to the referree object tag value, or zero if the object is not tagged. To set the tag value to be associated with the object the agent sets the jlong pointed to by the parameter. @@ -4147,14 +4147,14 @@ - Points to the tag of the referrer object, or + Points to the tag of the referrer object, or points to the zero if the referrer - object is not tagged. + object is not tagged. NULL if the referrer in not an object (that is, this callback is reporting a heap root). To set the tag value to be associated with the referrer object the agent sets the jlong pointed to by the parameter. - If this callback is reporting a reference from an object to itself, + If this callback is reporting a reference from an object to itself, referrer_tag_ptr == tag_ptr. @@ -4167,7 +4167,7 @@ - The user supplied data that was passed into the iteration function. + The user supplied data that was passed into the iteration function. @@ -4177,7 +4177,7 @@ Primitive Field Callback - Agent supplied callback function which + Agent supplied callback function which describes a primitive field of an object (the object). A primitive field is a field whose type is a primitive type. This callback will describe a static field if the object is a class, @@ -4195,7 +4195,7 @@ jvmtiHeapReferenceKind - The kind of field -- instance or static ( or + The kind of field -- instance or static ( or ). @@ -4210,17 +4210,17 @@ - The tag of the class of the object (zero if the class is not tagged). - If the object represents a runtime class, the - object_class_tag is the tag - associated with java.lang.Class + The tag of the class of the object (zero if the class is not tagged). + If the object represents a runtime class, the + object_class_tag is the tag + associated with java.lang.Class (zero if java.lang.Class is not tagged). - Points to the tag of the object, or zero if the object is not + Points to the tag of the object, or zero if the object is not tagged. To set the tag value to be associated with the object the agent sets the jlong pointed to by the parameter. @@ -4241,7 +4241,7 @@ - The user supplied data that was passed into the iteration function. + The user supplied data that was passed into the iteration function. @@ -4251,7 +4251,7 @@ Array Primitive Value Callback - Agent supplied callback function. + Agent supplied callback function. Describes the values in an array of a primitive type.

    This function should return a bit vector of the desired @@ -4266,20 +4266,20 @@ - The tag of the class of the array object (zero if the class is not tagged). + The tag of the class of the array object (zero if the class is not tagged). - Size of the array (in bytes). + Size of the array (in bytes). See . - Points to the tag of the array object, or zero if the object is not + Points to the tag of the array object, or zero if the object is not tagged. To set the tag value to be associated with the object the agent sets the jlong pointed to by the parameter. @@ -4307,7 +4307,7 @@ - The user supplied data that was passed into the iteration function. + The user supplied data that was passed into the iteration function. @@ -4317,7 +4317,7 @@ String Primitive Value Callback - Agent supplied callback function. + Agent supplied callback function. Describes the value of a java.lang.String.

    This function should return a bit vector of the desired @@ -4332,21 +4332,21 @@ - The tag of the class of the String class (zero if the class is not tagged). + The tag of the class of the String class (zero if the class is not tagged). Is this needed? - Size of the string (in bytes). + Size of the string (in bytes). See . - Points to the tag of the String object, or zero if the object is not + Points to the tag of the String object, or zero if the object is not tagged. To set the tag value to be associated with the object the agent sets the jlong pointed to by the parameter. @@ -4361,15 +4361,15 @@ - The length of the string. - The length is equal to the number of 16-bit Unicode + The length of the string. + The length is equal to the number of 16-bit Unicode characters in the string. - The user supplied data that was passed into the iteration function. + The user supplied data that was passed into the iteration function. @@ -4388,27 +4388,27 @@ Follow References - - This function initiates a traversal over the objects that are + + This function initiates a traversal over the objects that are directly and indirectly reachable from the specified object or, - if initial_object is not specified, all objects + if initial_object is not specified, all objects reachable from the heap roots. - The heap root are the set of system classes, - JNI globals, references from thread stacks, and other objects used as roots - for the purposes of garbage collection. + The heap root are the set of system classes, + JNI globals, references from thread stacks, and other objects used as roots + for the purposes of garbage collection.

    This function operates by traversing the reference graph. Let A, B, ... represent objects. When a reference from A to B is traversed, - when a reference from a heap root to B is traversed, - or when B is specified as the , + when a reference from a heap root to B is traversed, + or when B is specified as the , then B is said to be visited. - A reference from A to B is not traversed until A + A reference from A to B is not traversed until A is visited. References are reported in the same order that the references are traversed. - Object references are reported by invoking the agent supplied + Object references are reported by invoking the agent supplied callback function . - In a reference from A to B, A is known + In a reference from A to B, A is known as the referrer and B as the referree. The callback is invoked exactly once for each reference from a referrer; this is true even if there are reference cycles or multiple paths to @@ -4416,10 +4416,10 @@ There may be more than one reference between a referrer and a referree, each reference is reported. These references may be distinguished by examining the - reference_kind and - reference_info parameters of the callback.

    @@ -4456,10 +4456,10 @@ whether the callback will be invoked, it does not influence which objects are visited nor does it influence whether other callbacks will be invoked. - However, the + However, the visit control flags returned by - do determine if the objects referenced by the + do determine if the objects referenced by the current object as visited. The heap filter flags and provided as parameters to this function @@ -4468,7 +4468,7 @@ For example, if the only callback that was set is and klass is set to the array of bytes class, then only arrays of byte will be - reported. + reported. The table below summarizes this:

    @@ -4547,22 +4547,22 @@

    During the execution of this function the state of the heap does not change: no objects are allocated, no objects are - garbage collected, and the state of objects (including - held values) does not change. - As a result, threads executing Java + garbage collected, and the state of objects (including + held values) does not change. + As a result, threads executing Java programming language code, threads attempting to resume the - execution of Java programming language code, and threads + execution of Java programming language code, and threads attempting to execute JNI functions are typically stalled. new - + - This bit vector of + This bit vector of heap filter flags. restricts the objects for which the callback function is called. This applies to both the object and primitive callbacks. @@ -4575,7 +4575,7 @@ class - Callbacks are only reported when the object is an instance of + Callbacks are only reported when the object is an instance of this class. Objects which are instances of a subclass of klass are not reported. @@ -4599,14 +4599,14 @@ Structure defining the set of callback functions. - + NULL is passed as the user supplied data - User supplied data to be passed to the callback. + User supplied data to be passed to the callback. @@ -4623,12 +4623,12 @@ Iterate Through Heap - - Initiate an iteration over all objects in the heap. - This includes both reachable and + + Initiate an iteration over all objects in the heap. + This includes both reachable and unreachable objects. Objects are visited in no particular order.

    - Heap objects are reported by invoking the agent supplied + Heap objects are reported by invoking the agent supplied callback function . References between objects are not reported. If only reachable objects are desired, or if object reference information @@ -4642,7 +4642,7 @@ . A primitive field is reported after the object with that field is visited; - it is reported by invoking the agent supplied + it is reported by invoking the agent supplied callback function .

    @@ -4660,7 +4660,7 @@ For example, if the only callback that was set is and klass is set to the array of bytes class, then only arrays of byte will be - reported. The table below summarizes this (contrast this with + reported. The table below summarizes this (contrast this with ):

    @@ -4739,11 +4739,11 @@

    During the execution of this function the state of the heap does not change: no objects are allocated, no objects are - garbage collected, and the state of objects (including - held values) does not change. - As a result, threads executing Java + garbage collected, and the state of objects (including + held values) does not change. + As a result, threads executing Java programming language code, threads attempting to resume the - execution of Java programming language code, and threads + execution of Java programming language code, and threads attempting to execute JNI functions are typically stalled. new @@ -4754,7 +4754,7 @@ - This bit vector of + This bit vector of heap filter flags. restricts the objects for which the callback function is called. This applies to both the object and primitive callbacks. @@ -4766,7 +4766,7 @@ callbacks are not limited to instances of a particular class - Callbacks are only reported when the object is an instance of + Callbacks are only reported when the object is an instance of this class. Objects which are instances of a subclass of klass are not reported. @@ -4781,14 +4781,14 @@ Structure defining the set callback functions. - + NULL is passed as the user supplied data - User supplied data to be passed to the callback. + User supplied data to be passed to the callback. @@ -4803,7 +4803,7 @@ Get Tag Retrieve the tag associated with an object. - The tag is a long value typically used to store a + The tag is a long value typically used to store a unique identifier or pointer to object information. The tag is set with . @@ -4824,7 +4824,7 @@ - On return, the referenced long is set to the value + On return, the referenced long is set to the value of the tag. @@ -4837,7 +4837,7 @@ Set Tag Set the tag associated with an object. - The tag is a long value typically used to store a + The tag is a long value typically used to store a unique identifier or pointer to object information. The tag is visible with . @@ -4895,7 +4895,7 @@ - Return the number of objects with any of the tags + Return the number of objects with any of the tags in . @@ -4905,7 +4905,7 @@ this information is not returned - Returns the array of objects with any of the tags + Returns the array of objects with any of the tags in . @@ -4936,13 +4936,13 @@ This function does not return until the garbage collection is finished.

    - Although garbage collection is as complete - as possible there is no guarantee that all + Although garbage collection is as complete + as possible there is no guarantee that all - events will have been - sent by the time that this function - returns. In particular, an object may be - prevented from being freed because it + events will have been + sent by the time that this function + returns. In particular, an object may be + prevented from being freed because it is awaiting finalization. new @@ -4960,7 +4960,7 @@ - These functions and data types were introduced in the original + These functions and data types were introduced in the original version 1.0 and have been superseded by more powerful and flexible versions @@ -4970,7 +4970,7 @@

    • - Allow access to primitive values (the value of Strings, arrays, + Allow access to primitive values (the value of Strings, arrays, and primitive fields)
    • @@ -5034,13 +5034,13 @@ Reference from an object to its class. - + Reference from an object to the value of one of its instance fields. For references of this kind the referrer_index parameter to the jvmtiObjectReferenceCallback is the index of the - the instance field. The index is based on the order of all the + the instance field. The index is based on the order of all the object's fields. This includes all fields of the directly declared static and instance fields in the class, and includes all fields (both public and private) fields declared in superclasses and superinterfaces. @@ -5063,7 +5063,7 @@ Reference from a class to its protection domain. - + Reference from a class to one of its interfaces. @@ -5072,7 +5072,7 @@ For references of this kind the referrer_index parameter to the jvmtiObjectReferenceCallback is the index of the - the static field. The index is based on the order of all the + the static field. The index is based on the order of all the object's fields. This includes all fields of the directly declared static and instance fields in the class, and includes all fields (both public and private) fields declared in superclasses and superinterfaces. @@ -5095,11 +5095,11 @@ - Continue the iteration. + Continue the iteration. If this is a reference iteration, follow the references of this object. - + - Continue the iteration. + Continue the iteration. If this is a reference iteration, ignore the references of this object. @@ -5125,9 +5125,9 @@ - The tag of the class of object (zero if the class is not tagged). - If the object represents a runtime class, - the class_tag is the tag + The tag of the class of object (zero if the class is not tagged). + If the object represents a runtime class, + the class_tag is the tag associated with java.lang.Class (zero if java.lang.Class is not tagged). @@ -5143,82 +5143,82 @@ The object tag value, or zero if the object is not tagged. To set the tag value to be associated with the object - the agent sets the jlong pointed to by the parameter. - - - - - - The user supplied data that was passed into the iteration function. - - - - - - - jvmtiIterationControl - Heap Root Object Callback - - Agent supplied callback function. - Describes (but does not pass in) an object that is a root for the purposes - of garbage collection. -

      - Return value should be JVMTI_ITERATION_CONTINUE to continue iteration, - JVMTI_ITERATION_IGNORE to continue iteration without pursuing - references from referree object or JVMTI_ITERATION_ABORT to stop iteration. -

      - See the heap callback - function restrictions. - - - - jvmtiHeapRootKind - - The kind of heap root. - - - - - - The tag of the class of object (zero if the class is not tagged). - If the object represents a runtime class, the class_tag is the tag - associated with java.lang.Class - (zero if java.lang.Class is not tagged). - - - - - - Size of the object (in bytes). See . - - - - - - The object tag value, or zero if the object is not tagged. - To set the tag value to be associated with the object the agent sets the jlong pointed to by the parameter. - The user supplied data that was passed into the iteration function. - - - - + The user supplied data that was passed into the iteration function. + + + + + + + jvmtiIterationControl + Heap Root Object Callback + + Agent supplied callback function. + Describes (but does not pass in) an object that is a root for the purposes + of garbage collection. +

      + Return value should be JVMTI_ITERATION_CONTINUE to continue iteration, + JVMTI_ITERATION_IGNORE to continue iteration without pursuing + references from referree object or JVMTI_ITERATION_ABORT to stop iteration. +

      + See the heap callback + function restrictions. + + + + jvmtiHeapRootKind + + The kind of heap root. + + + + + + The tag of the class of object (zero if the class is not tagged). + If the object represents a runtime class, the class_tag is the tag + associated with java.lang.Class + (zero if java.lang.Class is not tagged). + + + + + + Size of the object (in bytes). See . + + + + + + The object tag value, or zero if the object is not tagged. + To set the tag value to be associated with the object + the agent sets the jlong pointed to by the parameter. + + + + + + The user supplied data that was passed into the iteration function. + + + + jvmtiIterationControl Stack Reference Object Callback Agent supplied callback function. - Describes (but does not pass in) an object on the stack that is a root for + Describes (but does not pass in) an object on the stack that is a root for the purposes of garbage collection.

      Return value should be JVMTI_ITERATION_CONTINUE to continue iteration, - JVMTI_ITERATION_IGNORE to continue iteration without pursuing + JVMTI_ITERATION_IGNORE to continue iteration without pursuing references from referree object or JVMTI_ITERATION_ABORT to stop iteration.

      See the heap callback @@ -5235,9 +5235,9 @@ - The tag of the class of object (zero if the class is not tagged). - If the object represents a runtime class, the class_tag is the tag - associated with java.lang.Class + The tag of the class of object (zero if the class is not tagged). + If the object represents a runtime class, the class_tag is the tag + associated with java.lang.Class (zero if java.lang.Class is not tagged). @@ -5264,7 +5264,7 @@ - The depth of the frame. + The depth of the frame. @@ -5282,7 +5282,7 @@ - The user supplied data that was passed into the iteration function. + The user supplied data that was passed into the iteration function. @@ -5292,12 +5292,12 @@ jvmtiIterationControl Object Reference Callback - Agent supplied callback function. + Agent supplied callback function. Describes a reference from an object (the referrer) to another object (the referree).

      Return value should be JVMTI_ITERATION_CONTINUE to continue iteration, - JVMTI_ITERATION_IGNORE to continue iteration without pursuing + JVMTI_ITERATION_IGNORE to continue iteration without pursuing references from referree object or JVMTI_ITERATION_ABORT to stop iteration.

      See the heap callback @@ -5313,24 +5313,24 @@ - The tag of the class of referree object (zero if the class is not tagged). + The tag of the class of referree object (zero if the class is not tagged). If the referree object represents a runtime class, - the class_tag is the tag - associated with java.lang.Class + the class_tag is the tag + associated with java.lang.Class (zero if java.lang.Class is not tagged). - Size of the referree object (in bytes). + Size of the referree object (in bytes). See . - The referree object tag value, or zero if the object is not + The referree object tag value, or zero if the object is not tagged. To set the tag value to be associated with the object the agent sets the jlong pointed to by the parameter. @@ -5345,11 +5345,11 @@ - + For references of type JVMTI_REFERENCE_FIELD or JVMTI_REFERENCE_STATIC_FIELD the index - of the field in the referrer object. The index is based on the - order of all the object's fields - see JVMTI_REFERENCE_FIELD or JVMTI_REFERENCE_STATIC_FIELD @@ -5362,7 +5362,7 @@ For references of type JVMTI_REFERENCE_CONSTANT_POOL the index into the constant pool of the class - see - JVMTI_REFERENCE_CONSTANT_POOL for further + JVMTI_REFERENCE_CONSTANT_POOL for further description.

      For references of other kinds the referrer_index is @@ -5372,7 +5372,7 @@ - The user supplied data that was passed into the iteration function. + The user supplied data that was passed into the iteration function. @@ -5380,17 +5380,17 @@ Iterate Over Objects Reachable From Object - + This function iterates over all objects that are directly and indirectly reachable from the specified object. For each object A (known - as the referrer) with a reference to object B the specified + as the referrer) with a reference to object B the specified callback function is called to describe the object reference. The callback is called exactly once for each reference from a referrer; this is true even if there are reference cycles or multiple paths to the referrer. There may be more than one reference between a referrer and a referree, - These may be distinguished by the + These may be distinguished by the and . The callback for an object will always occur after the callback for @@ -5401,18 +5401,18 @@

      During the execution of this function the state of the heap does not change: no objects are allocated, no objects are - garbage collected, and the state of objects (including - held values) does not change. - As a result, threads executing Java + garbage collected, and the state of objects (including + held values) does not change. + As a result, threads executing Java programming language code, threads attempting to resume the - execution of Java programming language code, and threads + execution of Java programming language code, and threads attempting to execute JNI functions are typically stalled. new - + @@ -5427,14 +5427,14 @@ The callback to be called to describe each object reference. - + NULL is passed as the user supplied data - User supplied data to be passed to the callback. + User supplied data to be passed to the callback. @@ -5447,9 +5447,9 @@ This function iterates over the root objects and all objects that are directly and indirectly reachable from the root objects. - The root objects comprise the set of system classes, - JNI globals, references from thread stacks, and other objects used as roots - for the purposes of garbage collection. + The root objects comprise the set of system classes, + JNI globals, references from thread stacks, and other objects used as roots + for the purposes of garbage collection.

      For each root the or callback is called. @@ -5462,7 +5462,7 @@ this is true even if there are reference cycles or multiple paths to the referrer. There may be more than one reference between a referrer and a referree, - These may be distinguished by the + These may be distinguished by the and . The callback for an object will always occur after the callback for @@ -5472,26 +5472,26 @@ references which are reported.

      Roots are always reported to the profiler before any object references - are reported. In other words, the + are reported. In other words, the callback will not be called until the appropriate callback has been called - for all roots. If the callback is + for all roots. If the callback is specified as NULL then this function returns after reporting the root objects to the profiler.

      During the execution of this function the state of the heap does not change: no objects are allocated, no objects are - garbage collected, and the state of objects (including - held values) does not change. - As a result, threads executing Java + garbage collected, and the state of objects (including + held values) does not change. + As a result, threads executing Java programming language code, threads attempting to resume the - execution of Java programming language code, and threads + execution of Java programming language code, and threads attempting to execute JNI functions are typically stalled. new - + jvmtiHeapRootCallback @@ -5502,7 +5502,7 @@ JVMTI_HEAP_ROOT_JNI_GLOBAL, JVMTI_HEAP_ROOT_SYSTEM_CLASS, JVMTI_HEAP_ROOT_MONITOR, - JVMTI_HEAP_ROOT_THREAD, or + JVMTI_HEAP_ROOT_THREAD, or JVMTI_HEAP_ROOT_OTHER. @@ -5532,7 +5532,7 @@ NULL is passed as the user supplied data - User supplied data to be passed to the callback. + User supplied data to be passed to the callback. @@ -5542,14 +5542,14 @@ Iterate Over Heap - - Iterate over all objects in the heap. This includes both reachable and + + Iterate over all objects in the heap. This includes both reachable and unreachable objects.

      The parameter indicates the objects for which the callback function is called. If this parameter - is JVMTI_HEAP_OBJECT_TAGGED then the callback will only be - called for every object that is tagged. If the parameter is + is JVMTI_HEAP_OBJECT_TAGGED then the callback will only be + called for every object that is tagged. If the parameter is JVMTI_HEAP_OBJECT_UNTAGGED then the callback will only be for objects that are not tagged. If the parameter is JVMTI_HEAP_OBJECT_EITHER then the callback will be @@ -5558,11 +5558,11 @@

      During the execution of this function the state of the heap does not change: no objects are allocated, no objects are - garbage collected, and the state of objects (including - held values) does not change. - As a result, threads executing Java + garbage collected, and the state of objects (including + held values) does not change. + As a result, threads executing Java programming language code, threads attempting to resume the - execution of Java programming language code, and threads + execution of Java programming language code, and threads attempting to execute JNI functions are typically stalled. new @@ -5591,7 +5591,7 @@ NULL is passed as the user supplied data - User supplied data to be passed to the callback. + User supplied data to be passed to the callback. @@ -5602,15 +5602,15 @@ Iterate Over Instances Of Class - Iterate over all objects in the heap that are instances of the specified class. - This includes direct instances of the specified class and + Iterate over all objects in the heap that are instances of the specified class. + This includes direct instances of the specified class and instances of all subclasses of the specified class. This includes both reachable and unreachable objects.

      The parameter indicates the objects for which the callback function is called. If this parameter - is JVMTI_HEAP_OBJECT_TAGGED then the callback will only be - called for every object that is tagged. If the parameter is + is JVMTI_HEAP_OBJECT_TAGGED then the callback will only be + called for every object that is tagged. If the parameter is JVMTI_HEAP_OBJECT_UNTAGGED then the callback will only be called for objects that are not tagged. If the parameter is JVMTI_HEAP_OBJECT_EITHER then the callback will be @@ -5619,11 +5619,11 @@

      During the execution of this function the state of the heap does not change: no objects are allocated, no objects are - garbage collected, and the state of objects (including - held values) does not change. - As a result, threads executing Java + garbage collected, and the state of objects (including + held values) does not change. + As a result, threads executing Java programming language code, threads attempting to resume the - execution of Java programming language code, and threads + execution of Java programming language code, and threads attempting to execute JNI functions are typically stalled. new @@ -5649,7 +5649,7 @@ The iterator function to be called for each - instance matching + instance matching the . @@ -5659,7 +5659,7 @@ NULL is passed as the user supplied data - User supplied data to be passed to the callback. + User supplied data to be passed to the callback. @@ -5672,19 +5672,19 @@ - These functions are used to retrieve or set the value of a local variable. + These functions are used to retrieve or set the value of a local variable. The variable is identified by the depth of the frame containing its - value and the variable's slot number within that frame. - The mapping of variables to - slot numbers can be obtained with the function + value and the variable's slot number within that frame. + The mapping of variables to + slot numbers can be obtained with the function . Get Local Variable - Object - This function can be used to retrieve the value of a local - variable whose type is Object or a subclass of Object. + This function can be used to retrieve the value of a local + variable whose type is Object or a subclass of Object. jvmdi @@ -5712,7 +5712,7 @@ - On return, points to the variable's value. + On return, points to the variable's value. @@ -5720,11 +5720,11 @@ Invalid slot. - + The variable type is not Object or a subclass of Object. - + Not a visible frame @@ -5736,7 +5736,7 @@ This function can be used to retrieve the value of the local object variable at slot 0 (the "this" object) from non-static frames. This function can retrieve the "this" object from - native method frames, whereas GetLocalObject() would + native method frames, whereas GetLocalObject() would return JVMTI_ERROR_OPAQUE_FRAME in those cases. new @@ -5759,7 +5759,7 @@ - On return, points to the variable's value. + On return, points to the variable's value. @@ -5772,10 +5772,10 @@ Get Local Variable - Int - This function can be used to retrieve the value of a local + This function can be used to retrieve the value of a local variable whose type is int, - short, char, byte, or - boolean. + short, char, byte, or + boolean. jvmdi @@ -5803,7 +5803,7 @@ - On return, points to the variable's value. + On return, points to the variable's value. @@ -5811,13 +5811,13 @@ Invalid slot. - - The variable type is not + + The variable type is not int, short, - char, byte, or + char, byte, or boolean. - + Not a visible frame @@ -5826,8 +5826,8 @@ Get Local Variable - Long - This function can be used to retrieve the value of a local - variable whose type is long. + This function can be used to retrieve the value of a local + variable whose type is long. jvmdi @@ -5855,7 +5855,7 @@ - On return, points to the variable's value. + On return, points to the variable's value. @@ -5863,10 +5863,10 @@ Invalid slot. - + The variable type is not long. - + Not a visible frame @@ -5875,8 +5875,8 @@ Get Local Variable - Float - This function can be used to retrieve the value of a local - variable whose type is float. + This function can be used to retrieve the value of a local + variable whose type is float. jvmdi @@ -5904,7 +5904,7 @@ - On return, points to the variable's value. + On return, points to the variable's value. @@ -5912,10 +5912,10 @@ Invalid slot. - + The variable type is not float. - + Not a visible frame @@ -5924,8 +5924,8 @@ Get Local Variable - Double - This function can be used to retrieve the value of a local - variable whose type is long. + This function can be used to retrieve the value of a local + variable whose type is long. jvmdi @@ -5953,7 +5953,7 @@ - On return, points to the variable's value. + On return, points to the variable's value. @@ -5961,10 +5961,10 @@ Invalid slot. - + The variable type is not double. - + Not a visible frame @@ -5973,8 +5973,8 @@ Set Local Variable - Object - This function can be used to set the value of a local - variable whose type is Object or a subclass of Object. + This function can be used to set the value of a local + variable whose type is Object or a subclass of Object. jvmdi @@ -6015,7 +6015,7 @@ Object or a subclass of Object. - The supplied is not compatible + The supplied is not compatible with the variable type. @@ -6027,10 +6027,10 @@ Set Local Variable - Int - This function can be used to set the value of a local + This function can be used to set the value of a local variable whose type is int, - short, char, byte, or - boolean. + short, char, byte, or + boolean. jvmdi @@ -6066,10 +6066,10 @@ Invalid slot. - - The variable type is not + + The variable type is not int, short, - char, byte, or + char, byte, or boolean. @@ -6081,8 +6081,8 @@ Set Local Variable - Long - This function can be used to set the value of a local - variable whose type is long. + This function can be used to set the value of a local + variable whose type is long. jvmdi @@ -6118,7 +6118,7 @@ Invalid slot. - + The variable type is not long. @@ -6130,8 +6130,8 @@ Set Local Variable - Float - This function can be used to set the value of a local - variable whose type is float. + This function can be used to set the value of a local + variable whose type is float. jvmdi @@ -6167,7 +6167,7 @@ Invalid slot. - + The variable type is not float. @@ -6179,8 +6179,8 @@ Set Local Variable - Double - This function can be used to set the value of a local - variable whose type is double. + This function can be used to set the value of a local + variable whose type is double. jvmdi @@ -6216,7 +6216,7 @@ Invalid slot. - + The variable type is not double. @@ -6267,7 +6267,7 @@ - + The designated bytecode already has a breakpoint. @@ -6304,7 +6304,7 @@ - + There's no breakpoint at the designated bytecode. @@ -6325,14 +6325,14 @@ by klass and field is about to be accessed. An event will be generated for each access of the field - until it is canceled with + until it is canceled with . Field accesses from Java programming language code or from JNI code are watched, fields modified by other means are not watched. Note that users should be aware that their own field accesses will trigger the watch. A field can only have one field access watch set. - Modification of a field is not considered an access--use + Modification of a field is not considered an access--use to monitor modifications. @@ -6356,7 +6356,7 @@ - + The designated field is already being watched for accesses. @@ -6365,8 +6365,8 @@ Clear Field Access Watch - Cancel a field access watch previously set by - , on the + Cancel a field access watch previously set by + , on the field specified by klass and field. @@ -6391,7 +6391,7 @@ - + The designated field is not being watched for accesses. @@ -6405,7 +6405,7 @@ by klass and field is about to be modified. An event will be generated for each modification of the field - until it is canceled with + until it is canceled with . Field modifications from Java programming language code or from JNI code are watched, fields modified by other means are not watched. @@ -6433,7 +6433,7 @@ - + The designated field is already being watched for modifications. @@ -6443,8 +6443,8 @@ Clear Field Modification Watch - Cancel a field modification watch previously set by - , on the + Cancel a field modification watch previously set by + , on the field specified by klass and field. @@ -6469,7 +6469,7 @@ - + The designated field is not being watched for modifications. @@ -6857,9 +6857,9 @@ class_count_ptr, and the array itself via classes_ptr.

      - Array classes of all types (including arrays of primitive types) are - included in the returned list. Primitive classes (for example, - java.lang.Integer.TYPE) are not included in this list. + Array classes of all types (including arrays of primitive types) are + included in the returned list. Primitive classes (for example, + java.lang.Integer.TYPE) are not included in this list. jvmdi @@ -6887,8 +6887,8 @@ Get Classloader Classes Returns an array of those classes for which this class loader has - been recorded as an initiating loader. Each - class in the returned array was created by this class loader, + been recorded as an initiating loader. Each + class in the returned array was created by this class loader, either by defining it directly or by delegation to another class loader. See .

      @@ -6930,14 +6930,14 @@ Get Class Signature - For the class indicated by klass, return the - JNI - type signature + For the class indicated by klass, return the + JNI + type signature and the generic signature of the class. For example, java.util.List is "Ljava/util/List;" and int[] is "[I" The returned name for primitive classes - is the type signature character of the corresponding primitive type. + is the type signature character of the corresponding primitive type. For example, java.lang.Integer.TYPE is "I". jvmdiClone @@ -6952,7 +6952,7 @@ - + the signature is not returned @@ -6962,14 +6962,14 @@ - + the generic signature is not returned On return, points to the generic signature of the class, encoded as a modified UTF-8 string. If there is no generic signature attribute for the class, then, - on return, points to NULL. + on return, points to NULL. @@ -6980,7 +6980,7 @@ Get Class Status - Get the status of the class. Zero or more of the following bits can be + Get the status of the class. Zero or more of the following bits can be set. @@ -6999,7 +6999,7 @@ Class is an array. If set, all other bits are zero. - Class is a primitive class (for example, java.lang.Integer.TYPE). + Class is a primitive class (for example, java.lang.Integer.TYPE). If set, all other bits are zero. @@ -7017,7 +7017,7 @@ - On return, points to the current state of this class as one or + On return, points to the current state of this class as one or more of the class status flags. @@ -7030,11 +7030,11 @@ Get Source File Name For the class indicated by klass, return the source file - name via source_name_ptr. The returned string - is a file name only and never contains a directory name. + name via source_name_ptr. The returned string + is a file name only and never contains a directory name.

      - For primitive classes (for example, java.lang.Integer.TYPE) - and for arrays this function returns + For primitive classes (for example, java.lang.Integer.TYPE) + and for arrays this function returns . jvmdi @@ -7057,7 +7057,7 @@ - + Class information does not include a source file name. This includes cases where the class is an array class or primitive class. @@ -7072,17 +7072,17 @@ via modifiers_ptr. Access flags are defined in .

      - If the class is an array class, then its public, private, and protected - modifiers are the same as those of its component type. For arrays of - primitives, this component type is represented by one of the primitive - classes (for example, java.lang.Integer.TYPE). + If the class is an array class, then its public, private, and protected + modifiers are the same as those of its component type. For arrays of + primitives, this component type is represented by one of the primitive + classes (for example, java.lang.Integer.TYPE).

      - If the class is a primitive class, its public modifier is always true, - and its protected and private modifiers are always false. + If the class is a primitive class, its public modifier is always true, + and its protected and private modifiers are always false.

      - If the class is an array class or a primitive class then its final - modifier is always true and its interface modifier is always false. - The values of its other modifiers are not determined by this specification. + If the class is an array class or a primitive class then its final + modifier is always true and its interface modifier is always false. + The values of its other modifiers are not determined by this specification. jvmdi @@ -7112,7 +7112,7 @@ For the class indicated by klass, return a count of methods via method_count_ptr and a list of - method IDs via methods_ptr. The method list contains + method IDs via methods_ptr. The method list contains constructors and static initializers as well as true methods. Only directly declared methods are returned (not inherited methods). An empty method list is returned for array classes and primitive classes @@ -7185,7 +7185,7 @@ - + is not prepared. @@ -7194,7 +7194,7 @@ Get Implemented Interfaces - Return the direct super-interfaces of this class. For a class, this + Return the direct super-interfaces of this class. For a class, this function returns the interfaces declared in its implements clause. For an interface, this function returns the interfaces declared in its extends clause. @@ -7225,7 +7225,7 @@ - + is not prepared. @@ -7234,10 +7234,10 @@ Get Class Version Numbers - For the class indicated by klass, + For the class indicated by klass, return the minor and major version numbers, as defined in - . + . new @@ -7253,7 +7253,7 @@ On return, points to the value of the - minor_version item of the + minor_version item of the Class File Format. Note: to be consistent with the Class File Format, the minor version number is the first parameter. @@ -7263,13 +7263,13 @@ On return, points to the value of the - major_version item of the + major_version item of the Class File Format. - + The class is a primitive or array class. @@ -7278,13 +7278,13 @@ Get Constant Pool - For the class indicated by klass, + For the class indicated by klass, return the raw bytes of the constant pool in the format of the - constant_pool item of + constant_pool item of . The format of the constant pool may differ between versions - of the Class File Format, so, the - minor and major + of the Class File Format, so, the + minor and major class version numbers should be checked for compatibility.

      @@ -7294,17 +7294,17 @@ more or fewer entries than the defining constant pool. Entries may be in a different order. The constant pool returned by GetConstantPool() will match the - constant pool used by + constant pool used by GetBytecodes(). That is, the bytecodes returned by GetBytecodes() will have constant pool indices which refer to constant pool entries returned by GetConstantPool(). - Note that since - and can change + Note that since + and can change the constant pool, the constant pool returned by this function - can change accordingly. Thus, the correspondence between + can change accordingly. Thus, the correspondence between GetConstantPool() and GetBytecodes() does not hold if there - is an intervening class retransformation or redefinition. + is an intervening class retransformation or redefinition. The value of a constant pool entry used by a given bytecode will match that of the defining class file (even if the indices don't match). Constant pool entries which are not used directly or indirectly by @@ -7342,13 +7342,13 @@ On return, points to the raw constant pool, that is the bytes - defined by the constant_pool item of the + defined by the constant_pool item of the Class File Format - + The class is a primitive or array class. @@ -7360,7 +7360,7 @@ Determines whether a class object reference represents an interface. The jboolean result is JNI_TRUE if the "class" is actually an interface, - JNI_FALSE otherwise. + JNI_FALSE otherwise. jvmdi @@ -7390,7 +7390,7 @@ Determines whether a class object reference represents an array. The jboolean result is JNI_TRUE if the class is an array, - JNI_FALSE otherwise. + JNI_FALSE otherwise. jvmdi @@ -7420,11 +7420,11 @@ Determines whether a class is modifiable. If a class is modifiable ( returns JNI_TRUE) the class can be - redefined with (assuming + redefined with (assuming the agent possesses the capability) or - retransformed with (assuming + retransformed with (assuming the agent possesses the capability). @@ -7433,7 +7433,7 @@ redefined nor retransformed.

      Primitive classes (for example, java.lang.Integer.TYPE), - array classes, and some implementation defined classes are never modifiable. + array classes, and some implementation defined classes are never modifiable.

      new @@ -7511,11 +7511,11 @@ Get Source Debug Extension - For the class indicated by klass, return the debug + For the class indicated by klass, return the debug extension via source_debug_extension_ptr. - The returned string + The returned string contains exactly the debug extension information present in the - class file of klass. + class file of klass. jvmdi @@ -7537,7 +7537,7 @@ - + Class information does not include a debug extension. @@ -7546,15 +7546,15 @@ Retransform Classes - This function facilitates the + This function facilitates the bytecode instrumentation of already loaded classes. To replace the class definition without reference to the existing - bytecodes, as one might do when recompiling from source for + bytecodes, as one might do when recompiling from source for fix-and-continue debugging, function should be used instead.

      - When classes are initially loaded or when they are + When classes are initially loaded or when they are redefined, the initial class file bytes can be transformed with the event. @@ -7562,16 +7562,16 @@ (whether or not a transformation has previously occurred). This retransformation follows these steps:

        -
      • starting from the initial class file bytes +
      • starting from the initial class file bytes
      • for each retransformation incapable agent which received a ClassFileLoadHook event during the previous - load or redefine, the bytes it returned + load or redefine, the bytes it returned (via the new_class_data parameter) - are reused as the output of the transformation; + are reused as the output of the transformation; note that this is equivalent to reapplying the previous transformation, unaltered. except that the ClassFileLoadHook event @@ -7589,7 +7589,7 @@
      See the event for more details.

      - The initial class file bytes represent the bytes passed to + The initial class file bytes represent the bytes passed to ClassLoader.defineClass or RedefineClasses (before any transformations were applied), however they may not exactly match them. @@ -7601,13 +7601,13 @@ order may not be preserved.

      Retransformation can cause new versions of methods to be installed. - Old method versions may become + Old method versions may become obsolete - The new method version will be used on new invokes. + The new method version will be used on new invokes. If a method has active stack frames, those active frames continue to - run the bytecodes of the original method version. -

      - This function does not cause any initialization except that which + run the bytecodes of the original method version. +

      + This function does not cause any initialization except that which would occur under the customary JVM semantics. In other words, retransforming a class does not cause its initializers to be run. The values of static fields will remain as they were @@ -7620,7 +7620,7 @@ All attributes are updated.

      Instances of the retransformed class are not affected -- fields retain their - previous values. + previous values. Tags on the instances are also unaffected.

      @@ -7629,8 +7629,8 @@ will be sent.

      The retransformation may change method bodies, the constant pool and attributes. - The retransformation must not add, remove or rename fields or methods, change the - signatures of methods, change modifiers, or change inheritance. + The retransformation must not add, remove or rename fields or methods, change the + signatures of methods, change modifiers, or change inheritance. These restrictions may be lifted in future versions. See the error return description below for information on error codes returned if an unsupported retransformation is attempted. @@ -7640,7 +7640,7 @@ If any error code is returned other than JVMTI_ERROR_NONE, none of the classes to be retransformed will have a new definition installed. When this function returns (with the error code of JVMTI_ERROR_NONE) - all of the classes to be retransformed will have their new definitions installed. + all of the classes to be retransformed will have their new definitions installed. new @@ -7663,7 +7663,7 @@ - One of the cannot be modified. + One of the cannot be modified. See . @@ -7676,7 +7676,7 @@ A retransformed class file is malformed (The VM would return a ClassFormatError). - The retransformed class file definitions would lead to a circular definition + The retransformed class file definitions would lead to a circular definition (the VM would return a ClassCircularityError). @@ -7739,22 +7739,22 @@ This function is used to replace the definition of a class with a new definition, as might be needed in fix-and-continue debugging. - Where the existing class file bytes are to be transformed, for + Where the existing class file bytes are to be transformed, for example in bytecode instrumentation, should be used.

      Redefinition can cause new versions of methods to be installed. - Old method versions may become + Old method versions may become obsolete - The new method version will be used on new invokes. + The new method version will be used on new invokes. If a method has active stack frames, those active frames continue to - run the bytecodes of the original method version. - If resetting of stack frames is desired, use + run the bytecodes of the original method version. + If resetting of stack frames is desired, use to pop frames with obsolete method versions.

      - This function does not cause any initialization except that which + This function does not cause any initialization except that which would occur under the customary JVM semantics. In other words, redefining a class does not cause its initializers to be run. The values of static fields will remain as they were @@ -7767,7 +7767,7 @@ All attributes are updated.

      Instances of the redefined class are not affected -- fields retain their - previous values. + previous values. Tags on the instances are also unaffected.

      @@ -7776,8 +7776,8 @@ will be sent (if enabled), but no other events will be sent.

      The redefinition may change method bodies, the constant pool and attributes. - The redefinition must not add, remove or rename fields or methods, change the - signatures of methods, change modifiers, or change inheritance. + The redefinition must not add, remove or rename fields or methods, change the + signatures of methods, change modifiers, or change inheritance. These restrictions may be lifted in future versions. See the error return description below for information on error codes returned if an unsupported redefinition is attempted. @@ -7788,7 +7788,7 @@ If any error code is returned other than JVMTI_ERROR_NONE, none of the classes to be redefined will have a new definition installed. When this function returns (with the error code of JVMTI_ERROR_NONE) - all of the classes to be redefined will have their new definitions installed. + all of the classes to be redefined will have their new definitions installed. jvmdi @@ -7827,7 +7827,7 @@ A new class file is malformed (The VM would return a ClassFormatError). - The new class file definitions would lead to a circular definition + The new class file definitions would lead to a circular definition (the VM would return a ClassCircularityError). @@ -7876,7 +7876,7 @@ For the object indicated by object, return via size_ptr the size of the object. This size is an implementation-specific approximation of - the amount of storage consumed by this object. + the amount of storage consumed by this object. It may include some or all of the object's overhead, and thus is useful for comparison within an implementation but not between implementations. @@ -7909,11 +7909,11 @@ For the object indicated by object, return via hash_code_ptr a hash code. This hash code could be used to maintain a hash table of object references, - however, on some implementations this can cause significant performance - impacts--in most cases - tags + however, on some implementations this can cause significant performance + impacts--in most cases + tags will be a more efficient means of associating information with objects. - This function guarantees + This function guarantees the same hash code value for a particular object throughout its life jvmdi @@ -7979,7 +7979,7 @@ Get information about the object's monitor. - The fields of the structure + The fields of the structure are filled in with information about usage of the monitor. Decide and then clarify suspend requirements. @@ -7999,7 +7999,7 @@ jvmtiMonitorUsage - On return, filled with monitor information for the + On return, filled with monitor information for the specified object. @@ -8014,7 +8014,7 @@ Return the list of object monitors.

      - Note: details about each monitor can be examined with + Note: details about each monitor can be examined with . new @@ -8025,7 +8025,7 @@ - On return, pointer to the number + On return, pointer to the number of monitors returned in monitors_ptr. @@ -8056,7 +8056,7 @@ .

      Field signatures are defined in the - JNI Specification + JNI Specification and are referred to as field descriptors in . @@ -8098,14 +8098,14 @@ - + the generic signature is not returned On return, points to the generic signature of the field, encoded as a modified UTF-8 string. If there is no generic signature attribute for the field, then, - on return, points to NULL. + on return, points to NULL. @@ -8187,7 +8187,7 @@ For the field indicated by klass and field, return a value indicating whether the field is synthetic via is_synthetic_ptr. - Synthetic fields are generated by the compiler but not present in the + Synthetic fields are generated by the compiler but not present in the original source code. jvmdi @@ -8241,7 +8241,7 @@ An original method version which is not equivalent to the new method version is called obsolete and is assigned a new method ID; the original method ID now refers to the new method version. - A method ID can be tested for obsolescence with + A method ID can be tested for obsolescence with . @@ -8253,8 +8253,8 @@ signature_ptr.

      Method signatures are defined in the - JNI Specification - and are referred to as method descriptors in + JNI Specification + and are referred to as method descriptors in . Note this is different than method signatures as defined in the Java Language Specification. @@ -8291,14 +8291,14 @@ - + the generic signature is not returned On return, points to the generic signature of the method, encoded as a modified UTF-8 string. If there is no generic signature attribute for the method, then, - on return, points to NULL. + on return, points to NULL. @@ -8379,7 +8379,7 @@ For the method indicated by method, return the number of local variable slots used by the method, including the local variables used to pass parameters to the - method on its invocation. + method on its invocation.

      See max_locals in . @@ -8465,7 +8465,7 @@ For the method indicated by method, return a table of source line number entries. The size of the table is returned via entry_count_ptr and the table itself is - returned via table_ptr. + returned via table_ptr. jvmdi @@ -8498,7 +8498,7 @@ - + Class information does not include line numbers. @@ -8510,10 +8510,10 @@ For the method indicated by method, return the beginning and ending addresses through start_location_ptr and end_location_ptr. In a - conventional byte code indexing scheme, + conventional byte code indexing scheme, start_location_ptr will always point to zero - and end_location_ptr - will always point to the byte code count minus one. + and end_location_ptr + will always point to the byte code count minus one. jvmdi @@ -8534,9 +8534,9 @@ - On return, points to the first location, or + On return, points to the first location, or -1 if location information is not available. - If the information is available and + If the information is available and returns then this will always be zero. @@ -8551,7 +8551,7 @@ - + Class information does not include method sizes. @@ -8571,7 +8571,7 @@ The length of the valid section for this local variable. - The last code array index where the local variable is valid + The last code array index where the local variable is valid is start_location + length. @@ -8596,7 +8596,7 @@ The local variable's generic signature, encoded as a modified UTF-8 string. - The value of this field will be NULL for any local + The value of this field will be NULL for any local variable which does not have a generic type. @@ -8722,7 +8722,7 @@ For the method indicated by method, return a value indicating whether the method is synthetic via is_synthetic_ptr. - Synthetic methods are generated by the compiler but not present in the + Synthetic methods are generated by the compiler but not present in the original source code. jvmdi @@ -8793,7 +8793,7 @@ This function modifies the failure handling of native method resolution by allowing retry with a prefix applied to the name. - When used with the + When used with the ClassFileLoadHook event, it enables native methods to be instrumented. @@ -8805,7 +8805,7 @@ native boolean foo(int x);

      - We could transform the class file (with the + We could transform the class file (with the ClassFileLoadHook event) so that this becomes: boolean foo(int x) { @@ -8823,28 +8823,28 @@ better but would make these examples less readable.

      The wrapper will allow data to be collected on the native - method call, but now the problem becomes linking up the - wrapped method with the native implementation. - That is, the method wrapped_foo needs to be + method call, but now the problem becomes linking up the + wrapped method with the native implementation. + That is, the method wrapped_foo needs to be resolved to the native implementation of foo, which might be: Java_somePackage_someClass_foo(JNIEnv* env, jint x)

      This function allows the prefix to be specified and the - proper resolution to occur. + proper resolution to occur. Specifically, when the standard resolution fails, the resolution is retried taking the prefix into consideration. There are two ways that resolution occurs, explicit resolution with the JNI function RegisterNatives - and the normal automatic resolution. For - RegisterNatives, the VM will attempt this + and the normal automatic resolution. For + RegisterNatives, the VM will attempt this association: method(foo) -> nativeImplementation(foo)

      When this fails, the resolution will be retried with - the specified prefix prepended to the method name, + the specified prefix prepended to the method name, yielding the correct resolution: method(wrapped_foo) -> nativeImplementation(foo) @@ -8854,7 +8854,7 @@ method(wrapped_foo) -> nativeImplementation(wrapped_foo)

      When this fails, the resolution will be retried with - the specified prefix deleted from the implementation name, + the specified prefix deleted from the implementation name, yielding the correct resolution: method(wrapped_foo) -> nativeImplementation(foo) @@ -8863,7 +8863,7 @@ resolution fails, native methods can be wrapped selectively.

      Since each environment is independent and - can do its own transformation of the bytecodes, more + can do its own transformation of the bytecodes, more than one layer of wrappers may be applied. Thus each environment needs its own prefix. Since transformations are applied in order, the prefixes, if applied, will @@ -8871,21 +8871,21 @@ The order of transformation application is described in the event. Thus if three environments applied - wrappers, foo might become + wrappers, foo might become $env3_$env2_$env1_foo. But if, say, the second environment did not apply a wrapper to - foo it would be just - $env3_$env1_foo. To be able to + foo it would be just + $env3_$env1_foo. To be able to efficiently determine the sequence of prefixes, an intermediate prefix is only applied if its non-native - wrapper exists. Thus, in the last example, even though + wrapper exists. Thus, in the last example, even though $env1_foo is not a native method, the - $env1_ prefix is applied since + $env1_ prefix is applied since $env1_foo exists.

      Since the prefixes are used at resolution time and since resolution may be arbitrarily delayed, a - native method prefix must remain set as long as there + native method prefix must remain set as long as there are corresponding prefixed native methods. new @@ -8918,7 +8918,7 @@ For a meta-agent that performs multiple independent class file transformations (for example as a proxy for another layer of agents) this function allows each transformation - to have its own prefix. + to have its own prefix. The prefixes are applied in the order supplied and are processed in the same manor as described for the application of prefixes from multiple environments @@ -8929,13 +8929,13 @@ disables prefixing in this environment.

      and this function - are the two ways to set the prefixes. - Calling SetNativeMethodPrefix with - a prefix is the same as calling this function with - of 1. - Calling SetNativeMethodPrefix with - NULL is the same as calling this function with - of 0. + are the two ways to set the prefixes. + Calling SetNativeMethodPrefix with + a prefix is the same as calling this function with + of 1. + Calling SetNativeMethodPrefix with + NULL is the same as calling this function with + of 0. new @@ -9014,16 +9014,16 @@ - + Not monitor owner - + Raw Monitor Enter - Gain exclusive ownership of a raw monitor. + Gain exclusive ownership of a raw monitor. The same thread may enter a monitor more then once. The thread must exit @@ -9064,7 +9064,7 @@ - + Not monitor owner @@ -9075,9 +9075,9 @@ Wait for notification of the raw monitor.

      - Causes the current thread to wait until either another thread calls - or - + Causes the current thread to wait until either another thread calls + or + for the specified raw monitor, or the specified timeout has elapsed. @@ -9102,10 +9102,10 @@ - + Not monitor owner - + Wait was interrupted, try again @@ -9151,7 +9151,7 @@ - + Not monitor owner @@ -9161,7 +9161,7 @@ Get Raw Monitor Use - The fields of the structure + The fields of the structure are filled in with information about usage of the raw monitor. new @@ -9178,7 +9178,7 @@ jvmtiMonitorUsage - On return, filled with monitor information for the + On return, filled with monitor information for the specified raw monitor. @@ -9192,7 +9192,7 @@ Return the list of raw monitors.

      - Note: details about each monitor can be examined with + Note: details about each monitor can be examined with . new @@ -9203,7 +9203,7 @@ - On return, pointer to the number + On return, pointer to the number of monitors returned in monitors_ptr. @@ -9223,13 +9223,13 @@ - Provides the ability to intercept and resend + Provides the ability to intercept and resend Java Native Interface (JNI) function calls by manipulating the JNI function table. - See JNI + See JNI Functions in the Java Native Interface Specification.

      - The following example illustrates intercepting the + The following example illustrates intercepting the NewGlobalRef JNI call in order to count reference creation. @@ -9274,19 +9274,19 @@ check that the example compiles and executes. - + Set JNI Function Table - Set the JNI function table + Set the JNI function table in all current and future JNI environments. As a result, all future JNI calls are directed to the specified functions. Use to get the function table to pass to this function. - For this function to take effect the the updated table entries must be + For this function to take effect the the updated table entries must be used by the JNI clients. Since the table is defined const some compilers may optimize - away the access to the table, thus preventing this function from taking + away the access to the table, thus preventing this function from taking effect. The table is copied--changes to the local copy of the table have no effect. @@ -9310,16 +9310,16 @@ - + Get JNI Function Table Get the JNI function table. The JNI function table is copied into allocated memory. - If + If has been called, the modified (not the original) function table is returned. - Only the function table is copied, no other aspects of the environment + Only the function table is copied, no other aspects of the environment are copied. See the examples above. @@ -9332,7 +9332,7 @@ jniNativeInterface - On return, *function_table + On return, *function_table points a newly allocated copy of the JNI function table. @@ -9354,13 +9354,13 @@ table have no effect. This is an atomic action, all callbacks are set at once. No events are sent before this function is called. - When an entry is NULL or when the event is beyond + When an entry is NULL or when the event is beyond no event is sent. - Details on events are + Details on events are described later in this document. An event must be enabled and have a callback in order to be - sent--the order in which this function and - + sent--the order in which this function and + are called does not affect the result. new @@ -9391,28 +9391,28 @@ Set Event Notification Mode - Control the generation of events. + Control the generation of events. - If is JVMTI_ENABLE, + If is JVMTI_ENABLE, the event will be enabled - If is JVMTI_DISABLE, + If is JVMTI_DISABLE, the event will be disabled If thread is NULL, - the event is enabled or disabled globally; otherwise, it is - enabled or disabled for a particular thread. - An event is generated for + the event is enabled or disabled globally; otherwise, it is + enabled or disabled for a particular thread. + An event is generated for a particular thread if it is enabled either at the thread or global - levels. + levels.

      See below for information on specific events.

      The following events cannot be controlled at the thread - level through this function. + level through this function.

      • @@ -9424,13 +9424,13 @@

      - Initially, no events are enabled at either the thread level + Initially, no events are enabled at either the thread level or the global level.

      Any needed capabilities (see Event Enabling Capabilities below) must be possessed before calling this function.

      - Details on events are + Details on events are described below. jvmdiClone @@ -9472,10 +9472,10 @@ is non-NULL and is not live (has not been started or is now dead). - thread level control was attempted on events which do not + thread level control was attempted on events which do not permit thread level control. - + The Required Event Enabling Capability is not possessed. @@ -9484,14 +9484,14 @@ Generate Events - Generate events to represent the current state of the VM. - For example, if is + Generate events to represent the current state of the VM. + For example, if is JVMTI_EVENT_COMPILED_METHOD_LOAD, a event will be sent for each currently compiled method. Methods that were loaded and now have been unloaded are not sent. - The history of what events have previously been sent does not - effect what events are sent by this function--for example, + The history of what events have previously been sent does not + effect what events are sent by this function--for example, all currently compiled methods will be sent each time this function is called.

      @@ -9502,14 +9502,14 @@ Attempts to execute Java programming language code or JNI functions may be paused until this function returns - so neither should be called from the thread sending the event. - This function returns only after the missed events have been + This function returns only after the missed events have been sent, processed and have returned. The event may be sent on a different thread than the thread on which the event occurred. - The callback for the event must be set with - + The callback for the event must be set with + and the event must be enabled with - + or the events will not occur. If the VM no longer has the information to generate some or all of the requested events, the events are simply not sent - @@ -9538,13 +9538,13 @@ - - is + + is JVMTI_EVENT_COMPILED_METHOD_LOAD and is false. - + is other than JVMTI_EVENT_COMPILED_METHOD_LOAD or JVMTI_EVENT_DYNAMIC_CODE_GENERATED. @@ -9566,63 +9566,63 @@ - Java programming language primitive type - byte. + Java programming language primitive type - byte. JNI type jbyte. - Java programming language primitive type - char. + Java programming language primitive type - char. JNI type jchar. - Java programming language primitive type - short. + Java programming language primitive type - short. JNI type jshort. - Java programming language primitive type - int. + Java programming language primitive type - int. JNI type . - Java programming language primitive type - long. + Java programming language primitive type - long. JNI type . - Java programming language primitive type - float. + Java programming language primitive type - float. JNI type . - Java programming language primitive type - double. + Java programming language primitive type - double. JNI type . - Java programming language primitive type - boolean. + Java programming language primitive type - boolean. JNI type . - Java programming language object type - java.lang.Object. + Java programming language object type - java.lang.Object. JNI type . Returned values are JNI local references and must be managed. - Java programming language object type - java.lang.Thread. + Java programming language object type - java.lang.Thread. type . Returned values are JNI local references and must be managed. - Java programming language object type - java.lang.Class. + Java programming language object type - java.lang.Class. JNI type . Returned values are JNI local references and must be managed. - Union of all Java programming language primitive and object types - + Union of all Java programming language primitive and object types - JNI type . Returned values which represent object types are JNI local references and must be managed. - Java programming language field identifier - + Java programming language field identifier - JNI type . - Java programming language method identifier - + Java programming language method identifier - JNI type . @@ -9757,7 +9757,7 @@ jvmtiParamInfo - Array of + Array of parameters (jvmtiEnv *jvmti_env excluded) @@ -9840,7 +9840,7 @@ jvmtiParamInfo - Array of + Array of parameters (jvmtiEnv *jvmti_env excluded) @@ -9876,7 +9876,7 @@ Extension Event This is the implementation-specific event. - The event handler is set with + The event handler is set with .

      Event handlers for extension events must be declared varargs to match this definition. @@ -9927,9 +9927,9 @@ Identifies which callback to set. - This index is the + This index is the - field of + field of . @@ -9939,18 +9939,18 @@ disable the event - If callback is non-NULL, + If callback is non-NULL, set callback to be the event callback function and enable the event. - + is not an - - returned by + returned by @@ -9962,30 +9962,30 @@ The capabilities functions allow you to change the - functionality available to --that is, - which + functionality available to --that is, + which functions can be called, what events can be generated, and what functionality these events and functions can provide.

      - The "Capabilities" section of each function and event describe which + The "Capabilities" section of each function and event describe which capabilities, if any, they are associated with. "Required Functionality" means it is available for use and no capabilities must be added to use it. "Optional Functionality" means the agent must possess the capability - before it can be used. + before it can be used. To possess a capability, the agent must add the capability. "Optional Features" describe capabilities which, if added, extend the feature set.

      - The potentially available capabilities of each implementation are different. + The potentially available capabilities of each implementation are different. Depending on the implementation, a capability:

      • may never be added
      • may be added in either the OnLoad or live phase in any environment
      • may be added only during the OnLoad phase
      • may be possessed by only one environment at a time
      • -
      • may be possessed by only one environment at a time, +
      • may be possessed by only one environment at a time, and only during the OnLoad phase
      • and so on ...
      @@ -9993,24 +9993,24 @@ time, and/or memory footprint. Note that the overhead of using a capability is completely different than the overhead of possessing a capability. Take single stepping as an example. When single stepping is on (that - is, when the event is enabled and thus actively sending events) - the overhead of sending and processing an event - on each instruction is huge in any implementation. - However, the overhead of possessing the capability may be small or large, + is, when the event is enabled and thus actively sending events) + the overhead of sending and processing an event + on each instruction is huge in any implementation. + However, the overhead of possessing the capability may be small or large, depending on the implementation. Also, when and if a capability is potentially available depends on the implementation. Some examples:
        -
      • One VM might perform all execution by compiling bytecodes into +
      • One VM might perform all execution by compiling bytecodes into native code and be unable to generate single step instructions. In this implementation the capability can not be added.
      • Another VM may be able to switch execution to a single stepping - interpreter at any time. In this implementation, having the capability has no + interpreter at any time. In this implementation, having the capability has no overhead and could be added at any time.
      • Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted execution engine at start up, but be unable to switch between them. - In this implementation the capability would need to be added + In this implementation the capability would need to be added during the OnLoad phase (before bytecode - execution begins) and would have a large impact on execution speed + execution begins) and would have a large impact on execution speed even if single stepping was never used.
      • Still another VM might be able to add an "is single stepping on" check into compiled bytecodes or a generated interpreter. Again in this implementation @@ -10019,30 +10019,30 @@

      Each environment - has its own set of capabilities. + has its own set of capabilities. Initially, that set is empty. Any desired capability must be added. - If possible, capabilities should be added during the OnLoad phase. For most - virtual machines certain capabilities require special set up for + If possible, capabilities should be added during the OnLoad phase. For most + virtual machines certain capabilities require special set up for the virtual machine and this set up must happen - during the OnLoad phase, before the virtual machine begins execution. + during the OnLoad phase, before the virtual machine begins execution. Once a capability is added, it can only be removed if explicitly relinquished by the environment.

      - The agent can, + The agent can, determine what capabilities this VM can potentially provide, add the capabilities to be used, release capabilities which are no longer needed, and - examine the currently available + examine the currently available capabilities. For example, a freshly started agent (in the OnLoad function) - wants to enable all possible capabilities. + wants to enable all possible capabilities. Note that, in general, this is not advisable as the agent may suffer a performance penalty for functionality it is not using. The code might look like this in C: @@ -10055,9 +10055,9 @@ err = (*jvmti)->AddCapabilities(jvmti, &capa); For example, if an agent wants to check if it can get - the bytecodes of a method (that is, it wants to check - if it previously added this capability and has not - relinquished it), the code might + the bytecodes of a method (that is, it wants to check + if it previously added this capability and has not + relinquished it), the code might look like this in C: jvmtiCapabilities capa; @@ -10065,13 +10065,13 @@ err = (*jvmti)->GetCapabilities(jvmti, &capa); if (err == JVMTI_ERROR_NONE) { - if (capa.can_get_bytecodes) { ... } } + if (capa.can_get_bytecodes) { ... } } - The functions in this category use this capabilities structure + The functions in this category use this capabilities structure which contains boolean flags corresponding to each capability: @@ -10099,14 +10099,14 @@ - Can test if a field or method is synthetic - + Can test if a field or method is synthetic - and - Can get information about ownership of monitors - + Can get information about ownership of monitors - @@ -10167,19 +10167,19 @@ - Can get exception thrown and + Can get exception thrown and exception catch events - Can set and thus get + Can set and thus get events - Can set and thus get + Can set and thus get events @@ -10206,65 +10206,65 @@ thread CPU time - Can generate method entry events on entering a method - Can generate method exit events on leaving a method - Can generate ClassFileLoadHook events for every loaded class. - Can generate events when a method is compiled or unloaded - Can generate events on monitor activity - Can generate events on VM allocation of an object - Can generate events when a native method is bound to its implementation - Can generate events when garbage collection begins or ends - Can generate events when the garbage collector frees an object @@ -10298,16 +10298,16 @@ Can retransform classes with . - In addition to the restrictions imposed by the specific + In addition to the restrictions imposed by the specific implementation on this capability (see the Capability section), - this capability must be set before the + this capability must be set before the event is enabled for the first time in this environment. - An environment that possesses this capability at the time that + An environment that possesses this capability at the time that ClassFileLoadHook is enabled for the first time is said to be retransformation capable. - An environment that does not possess this capability at the time that + An environment that does not possess this capability at the time that ClassFileLoadHook is enabled for the first time is said to be retransformation incapable. @@ -10322,7 +10322,7 @@ - Can generate events when the VM is unable to allocate memory from + Can generate events when the VM is unable to allocate memory from the Java platform heap. See . @@ -10355,11 +10355,11 @@ Get Potential Capabilities - Returns via the + Returns via the features that can potentially be possessed by this environment at this time. The returned capabilities differ from the complete set of capabilities - implemented by the VM in two cases: another environment possesses + implemented by the VM in two cases: another environment possesses capabilities that can only be possessed by one environment, or the current phase is live, and certain capabilities can only be added during the OnLoad phase. @@ -10402,7 +10402,7 @@ conditional implementations would be used or are even a good idea. The thought is that release documentation for the implementation would be the best means of exposing this information. - Unless new arguments are presented, I intend to remove this + Unless new arguments are presented, I intend to remove this function in the next revision.

      @@ -10412,15 +10412,15 @@ . The returned estimates are in percentage of additional overhead, thus a time impact of 100 mean the application might run - at half the speed. + at half the speed. The estimates are very rough approximations and are not guaranteed. Note also, that the estimates are of the impact of having the capability available--when and if it is used the impact may be much greater. - Estimates can be for a single capability or for a set of + Estimates can be for a single capability or for a set of capabilities. Note that the costs are not necessarily additive, - adding support for one capability might make another available - for free or conversely having two capabilities at once may + adding support for one capability might make another available + for free or conversely having two capabilities at once may have multiplicative impact. Estimates are relative to the current set of capabilities - that is, how much more impact given the currently possessed capabilities. @@ -10460,7 +10460,7 @@ - + The desired capabilities are not even potentially available. @@ -10470,7 +10470,7 @@ Add Capabilities - Set new capabilities by adding the capabilities + Set new capabilities by adding the capabilities whose values are set to one (1) in *. All previous capabilities are retained. @@ -10493,7 +10493,7 @@ - + The desired capabilities are not even potentially available. @@ -10547,7 +10547,7 @@ Get Capabilities - Returns via the optional + Returns via the optional features which this environment currently possesses. Each possessed capability is indicated by a one (1) in the corresponding field of the capabilities @@ -10578,16 +10578,16 @@ - - + + These functions provide timing information. - The resolution at which the time is updated is not specified. - They provides nanosecond precision, but not necessarily nanosecond accuracy. + The resolution at which the time is updated is not specified. + They provides nanosecond precision, but not necessarily nanosecond accuracy. Details about the timers, such as their maximum values, can be accessed with - the timer information functions. + the timer information functions. @@ -10621,7 +10621,7 @@ jvmtiTimerKind The kind of timer. - On a platform that does not distinguish between user and system time, JVMTI_TIMER_TOTAL_CPU is returned. @@ -10659,12 +10659,12 @@ Get Current Thread CPU Timer Information - Get information about the - timer. - The fields of the structure + Get information about the + timer. + The fields of the structure are filled in with details about the timer. This information is specific to the platform and the implementation of - and thus + and thus does not vary by thread nor does it vary during a particular invocation of the VM.

      @@ -10696,15 +10696,15 @@ Get Current Thread CPU Time - Return the CPU time utilized by the current thread. + Return the CPU time utilized by the current thread.

      Note that the function provides CPU time for any thread, including - the current thread. GetCurrentThreadCpuTime + the current thread. GetCurrentThreadCpuTime exists to support platforms which cannot - supply CPU time for threads other than the current + supply CPU time for threads other than the current thread or which have more accurate information for - the current thread (see + the current thread (see vs ). On many platforms this call will be equivalent to: @@ -10717,13 +10717,13 @@ Can get current thread CPU time.

      - If this capability is enabled after threads have started, + If this capability is enabled after threads have started, the implementation may choose any time up - to and including the time that the capability is enabled + to and including the time that the capability is enabled as the point where CPU time collection starts.

      - This capability must be potentially available on any - platform where + This capability must be potentially available on any + platform where can_get_thread_cpu_time is potentially available. @@ -10733,7 +10733,7 @@ On return, points to the CPU time used by this thread - in nanoseconds. + in nanoseconds. This is an unsigned value. If tested or printed as a jlong (signed value) it may appear to be a negative number. @@ -10746,12 +10746,12 @@ Get Thread CPU Timer Information - Get information about the - timer. - The fields of the structure + Get information about the + timer. + The fields of the structure are filled in with details about the timer. This information is specific to the platform and the implementation of - and thus + and thus does not vary by thread nor does it vary during a particular invocation of the VM.

      @@ -10783,19 +10783,19 @@ Get Thread CPU Time - Return the CPU time utilized by the specified thread. + Return the CPU time utilized by the specified thread.

      Get information about this timer with - . + . new Can get thread CPU time.

      - If this capability is enabled after threads have started, + If this capability is enabled after threads have started, the implementation may choose any time up - to and including the time that the capability is enabled + to and including the time that the capability is enabled as the point where CPU time collection starts. @@ -10810,7 +10810,7 @@ On return, points to the CPU time used by the specified thread - in nanoseconds. + in nanoseconds. This is an unsigned value. If tested or printed as a jlong (signed value) it may appear to be a negative number. @@ -10823,9 +10823,9 @@ Get Timer Information - Get information about the - timer. - The fields of the structure + Get information about the + timer. + The fields of the structure are filled in with details about the timer. This information will not change during a particular invocation of the VM. @@ -10848,7 +10848,7 @@ Get Time - Return the current value of the system timer, in nanoseconds. + Return the current value of the system timer, in nanoseconds.

      The value returned represents nanoseconds since some fixed but arbitrary time (perhaps in the future, so values may be @@ -10857,7 +10857,7 @@ how frequently values change.

      Get information about this timer with - . + . new @@ -10866,7 +10866,7 @@ - On return, points to the time in nanoseconds. + On return, points to the time in nanoseconds. This is an unsigned value. If tested or printed as a jlong (signed value) it may appear to be a negative number. @@ -10881,7 +10881,7 @@ Returns the number of processors available to the Java virtual machine.

      - This value may change during a particular invocation of the virtual machine. + This value may change during a particular invocation of the virtual machine. Applications that are sensitive to the number of available processors should therefore occasionally poll this property. @@ -10893,7 +10893,7 @@ On return, points to the maximum number of processors available to the - virtual machine; never smaller than one. + virtual machine; never smaller than one. @@ -10914,18 +10914,18 @@ Add To Bootstrap Class Loader Search - This function can be used to cause instrumentation classes to be defined by the + This function can be used to cause instrumentation classes to be defined by the bootstrap class loader. See . After the bootstrap - class loader unsuccessfully searches for a class, the specified platform-dependent - search path will be searched as well. Only one segment may be specified in - the . This function may be called multiple times to add multiple segments, + class loader unsuccessfully searches for a class, the specified platform-dependent + search path will be searched as well. Only one segment may be specified in + the . This function may be called multiple times to add multiple segments, the segments will be searched in the order that this function was called.

      - In the OnLoad phase the function may be used to specify any platform-dependent + In the OnLoad phase the function may be used to specify any platform-dependent search path segment to be searched after the bootstrap class loader unsuccessfully searches for a class. The segment is typically a directory or JAR file. -

      +

      In the live phase the may be used to specify any platform-dependent path to a JAR file. The agent should take care that the JAR file does not @@ -10953,7 +10953,7 @@ - + is an invalid path. In the live phase, anything other than an existing JAR file is an invalid path. @@ -10965,15 +10965,15 @@ This function can be used to cause instrumentation classes to be defined by the system class loader. See . - After the class loader unsuccessfully searches for a class, the specified platform-dependent search - path will be searched as well. Only one segment may be specified in the - . This function may be called multiple times to add multiple segments, the + After the class loader unsuccessfully searches for a class, the specified platform-dependent search + path will be searched as well. Only one segment may be specified in the + . This function may be called multiple times to add multiple segments, the segments will be searched in the order that this function was called.

      - In the OnLoad phase the function may be used to specify any platform-dependent + In the OnLoad phase the function may be used to specify any platform-dependent search path segment to be searched after the system class loader unsuccessfully searches for a class. The segment is typically a directory or JAR file. -

      +

      In the live phase the is a platform-dependent path to a JAR file to be searched after the system class loader unsuccessfully searches for a class. The agent should @@ -10981,9 +10981,9 @@ defined by the system class loader for the purposes of instrumentation.

      In the live phase the system class loader supports adding a JAR file to be searched if - the system class loader implements a method name appendToClassPathForInstrumentation - which takes a single parameter of type java.lang.String. The method is not required - to have public access. + the system class loader implements a method name appendToClassPathForInstrumentation + which takes a single parameter of type java.lang.String. The method is not required + to have public access.

      specifies that a subsequent attempt to resolve a symbolic reference that the Java virtual machine has previously unsuccessfully attempted @@ -11012,7 +11012,7 @@ Operation not supported by the system class loader. - + @@ -11028,7 +11028,7 @@ Get System Properties - The list of VM system property keys which may be used with + The list of VM system property keys which may be used with is returned. It is strongly recommended that virtual machines provide the following property keys: @@ -11043,15 +11043,15 @@ Provides access to system properties defined by and used by the VM. Properties set on the command-line are included. - This allows getting and setting of these properties + This allows getting and setting of these properties before the VM even begins executing bytecodes. - Since this is a VM view of system properties, the set of available + Since this is a VM view of system properties, the set of available properties will usually be different than that in java.lang.System.getProperties. - JNI method invocation may be used to access + JNI method invocation may be used to access java.lang.System.getProperties.

      - The set of properties may grow during execution. + The set of properties may grow during execution. new @@ -11066,7 +11066,7 @@ - On return, points to an array of property keys, encoded as + On return, points to an array of property keys, encoded as modified UTF-8 strings. @@ -11078,25 +11078,25 @@ Get System Property - Return a VM system property value given the property key. + Return a VM system property value given the property key.

      The function returns the set of property keys which may be used. The properties which can be retrieved may grow during execution.

      - Since this is a VM view of system properties, the values - of properties may differ from that returned by + Since this is a VM view of system properties, the values + of properties may differ from that returned by java.lang.System.getProperty(String). - A typical VM might copy the values of the VM system + A typical VM might copy the values of the VM system properties into the Properties held by java.lang.System during the initialization of that class. Thereafter any changes to the VM system - properties (with ) + properties (with ) or the java.lang.System system properties (with java.lang.System.setProperty(String,String)) would cause the values to diverge. - JNI method invocation may be used to access + JNI method invocation may be used to access java.lang.System.getProperty(String). new @@ -11119,7 +11119,7 @@ - + This property is not available. Use to find available properties. @@ -11129,7 +11129,7 @@ Set System Property - Set a VM system property value. + Set a VM system property value.

      The function returns the set of property keys, some of these may be settable. @@ -11161,7 +11161,7 @@ - + This property is not available or is not writeable. @@ -11177,7 +11177,7 @@ Get Phase - Return the current phase of VM execution. + Return the current phase of VM execution. The phases proceed in sequence: @@ -11193,7 +11193,7 @@ VMStart event. - Start phase: when the VMStart event + Start phase: when the VMStart event is sent and until the VMInit event is sent. @@ -11222,8 +11222,8 @@

      Most events are sent only in the live phase. The following events operate in others phases: - - + + new @@ -11245,7 +11245,7 @@ Shutdown a connection created with JNI GetEnv (see Environments). - Dispose of any resources held by the environment. + Dispose of any resources held by the environment. What resources are reclaimed? What is undone? Breakpoints,watchpoints removed? @@ -11255,7 +11255,7 @@ Memory allocated by this environment via calls to functions is not released, this can be done explicitly by the agent by calling . - Raw monitors created by this environment are not destroyed, + Raw monitors created by this environment are not destroyed, this can be done explicitly by the agent by calling . The state of threads waiting on raw monitors created by this environment @@ -11294,7 +11294,7 @@ This value is NULL unless set with this function. Agents can allocate memory in which they store environment specific information. By setting environment-local storage it can then be - accessed with + accessed with .

      Called by the agent to set the value of the @@ -11307,10 +11307,10 @@ - - - value is set to NULL - + + + value is set to NULL + The value to be entered into the environment-local storage. @@ -11324,7 +11324,7 @@ Get Environment Local Storage Called by the agent to get the value of the environment-local - storage. + storage. new @@ -11333,10 +11333,10 @@ - Pointer through which the value of the environment local + Pointer through which the value of the environment local storage is returned. If environment-local storage has not been set with - returned + returned pointer is NULL. @@ -11349,7 +11349,7 @@ Get Version Number Return the version via version_ptr. - The return value is the version identifier. + The return value is the version identifier. The version identifier includes major, minor and micro version as well as the interface type. @@ -11362,10 +11362,10 @@ - Mask to extract interface type. + Mask to extract interface type. The value of the version returned by this function masked with JVMTI_VERSION_MASK_INTERFACE_TYPE is always - JVMTI_VERSION_INTERFACE_JVMTI + JVMTI_VERSION_INTERFACE_JVMTI since this is a function. @@ -11409,11 +11409,11 @@ Get Error Name - Return the symbolic name for an - error code. -

      - For example - GetErrorName(env, JVMTI_ERROR_NONE, &err_name) + Return the symbolic name for an + error code. +

      + For example + GetErrorName(env, JVMTI_ERROR_NONE, &err_name) would return in err_name the string "JVMTI_ERROR_NONE". @@ -11459,7 +11459,7 @@ Control verbose output. - This is the output which typically is sent to stderr. + This is the output which typically is sent to stderr. new @@ -11488,18 +11488,18 @@ Although the greatest functionality is achieved with location information referencing the virtual machine bytecode index, the definition of - jlocation has intentionally been left unconstrained to allow VM + jlocation has intentionally been left unconstrained to allow VM implementations that do not have this information.

      This function describes the representation of jlocation used in this VM. - If the returned format is , + If the returned format is , jlocations can be used as in indices into the array returned by - . + . - jlocation values represent virtual machine - bytecode indices--that is, offsets into the + jlocation values represent virtual machine + bytecode indices--that is, offsets into the virtual machine code for a method. @@ -11534,16 +11534,16 @@ Every function returns a jvmtiError error code.

      - It is the responsibility of the agent to call functions with + It is the responsibility of the agent to call functions with valid parameters and in the proper context (calling thread is attached, - phase is correct, etc.). - Detecting some error conditions may be difficult, inefficient, or + phase is correct, etc.). + Detecting some error conditions may be difficult, inefficient, or impossible for an implementation. - The errors listed in + The errors listed in Function Specific Required Errors must be detected by the implementation. All other errors represent the recommended response to the error - condition. + condition. @@ -11559,7 +11559,7 @@ Pointer is unexpectedly NULL. - The function attempted to allocate memory and no more memory was + The function attempted to allocate memory and no more memory was available for allocation. @@ -11651,7 +11651,7 @@ The following errors are returned by some functions. They are returned in the event of invalid parameters passed by the - agent or usage in an invalid context. + agent or usage in an invalid context. An implementation is not required to detect these errors. @@ -11726,7 +11726,7 @@ declared in the old class version. - The class name defined in the new class file is + The class name defined in the new class file is different from the name in the old class object. @@ -11745,33 +11745,33 @@ programs.

      To handle events, designate a set of callback functions with - . - For each event the corresponding callback function will be + . + For each event the corresponding callback function will be called. Arguments to the callback function provide additional - information about the event. + information about the event.

      - The callback function is usually called from within an application - thread. The implementation does not + The callback function is usually called from within an application + thread. The implementation does not queue events in any way. This means - that event callback functions must be written - carefully. Here are some general guidelines. See + that event callback functions must be written + carefully. Here are some general guidelines. See the individual event descriptions for further suggestions.

        -
      • Any exception thrown during the execution of an event callback can +
      • Any exception thrown during the execution of an event callback can overwrite any current pending exception in the current application thread. Care must be taken to preserve a pending exception when an event callback makes a JNI call that might generate an exception.
      • Event callback functions must be re-entrant. The implementation does - not queue events. If an agent needs to process events one at a time, it - can use a raw monitor inside the + not queue events. If an agent needs to process events one at a time, it + can use a raw monitor inside the event callback functions to serialize event processing.
      • Event callback functions that execute JNI's FindClass function to load - classes need to note that FindClass locates the class loader associated + classes need to note that FindClass locates the class loader associated with the current native method. For the purposes of class loading, an event callback that includes a JNI environment as a parameter to the callback will treated as if it is a native call, where the native method @@ -11779,8 +11779,8 @@

      - Some events identify objects with JNI references. - All references + Some events identify objects with JNI references. + All references in events are JNI local references and will become invalid after the event callback returns. Unless stated otherwise, memory referenced by pointers sent in event @@ -11791,13 +11791,13 @@ Events are sent at the time they occur. The specification for each event includes the set of phases in which it can be sent; - if an event triggering activity occurs during another phase, no event - is sent. + if an event triggering activity occurs during another phase, no event + is sent.

      A thread that generates an event does not change its execution status (for example, the event does not cause the thread to be suspended). If an agent wishes the event to result in suspension, then the agent - is responsible for explicitly suspending the thread with + is responsible for explicitly suspending the thread with .

      If an event is enabled in multiple environments, the event will be sent @@ -11810,26 +11810,26 @@

      • If the event requires a capability, that capability must - be added with + be added with .
      • - A callback for the event must be set with + A callback for the event must be set with .
      • The event must be enabled with - . + .
      - In many situations it is possible for multiple events to occur - at the same location in one thread. When this happens, all the events + In many situations it is possible for multiple events to occur + at the same location in one thread. When this happens, all the events are reported through the event callbacks in the order specified in this section.

      - If the current location is at the entry point of a method, the + If the current location is at the entry point of a method, the event is reported before any other event at the current location in the same thread.

      @@ -11839,39 +11839,39 @@ exceptionCatch event is reported before any other event at the current location in the same thread.

      - If a singleStep event or - breakpoint event is triggered at the - current location, the event is defined to occur - immediately before the code at the current location is executed. - These events are reported before any events which are triggered - by the execution of code at the current location in the same - thread (specifically: + If a singleStep event or + breakpoint event is triggered at the + current location, the event is defined to occur + immediately before the code at the current location is executed. + These events are reported before any events which are triggered + by the execution of code at the current location in the same + thread (specifically: exception, fieldAccess, and fieldModification). - If both a step and breakpoint event are triggered for the same thread and + If both a step and breakpoint event are triggered for the same thread and location, the step event is reported before the breakpoint event.

      If the current location is the exit point of a method (that is, the last - location before returning to the caller), the - event and + location before returning to the caller), the + event and the event (if requested) are reported after all other events at the current location in the same - thread. There is no specified ordering of these two events + thread. There is no specified ordering of these two events with respect to each other.

      Co-located events can be triggered during the processing of some other event by the agent at the same location in the same thread. - If such an event, of type y, is triggered during the processing of - an event of type x, and if x - precedes y in the ordering specified above, the co-located event + If such an event, of type y, is triggered during the processing of + an event of type x, and if x + precedes y in the ordering specified above, the co-located event y is reported for the current thread and location. If x does not precede y, y is not reported for the current thread and location. - For example, if a breakpoint is set at the current location + For example, if a breakpoint is set at the current location during the processing of , - that breakpoint will be reported before the thread moves off the current + that breakpoint will be reported before the thread moves off the current location. -

      The following events are never considered to be co-located with +

      The following events are never considered to be co-located with other events.

      • @@ -11887,7 +11887,7 @@ The event callback structure below is used to specify the handler function for events. It is set with the - function. + function. Single step events allow the agent to trace thread execution at the finest granularity allowed by the VM. A single step event is - generated whenever a thread reaches a new location. - Typically, single step events represent the completion of one VM - instruction as defined in . However, some implementations - may define locations differently. In any case the + generated whenever a thread reaches a new location. + Typically, single step events represent the completion of one VM + instruction as defined in . However, some implementations + may define locations differently. In any case the method and location parameters uniquely identify the current location and allow - the mapping to source file and line number when that information is + the mapping to source file and line number when that information is available.

        No single step events are generated from within native methods. @@ -11910,7 +11910,7 @@ - + JNIEnv @@ -11953,14 +11953,14 @@ designated as a breakpoint with . The method and location parameters uniquely identify the current location and allow - the mapping to source file and line number when that information is + the mapping to source file and line number when that information is available. jvmdi - + JNIEnv @@ -12000,18 +12000,18 @@ id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63"> Field access events are generated whenever a thread accesses - a field that was designated as a watchpoint + a field that was designated as a watchpoint with . - The method and location + The method and location parameters uniquely identify the current location and allow - the mapping to source file and line number when that information is - available. + the mapping to source file and line number when that information is + available. jvmdi - + JNIEnv @@ -12070,18 +12070,18 @@ id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64"> Field modification events are generated whenever a thread modifies - a field that was designated as a watchpoint + a field that was designated as a watchpoint with . - The method and location + The method and location parameters uniquely identify the current location and allow - the mapping to source file and line number when that information is - available. + the mapping to source file and line number when that information is + available. jvmdi - + JNIEnv @@ -12151,25 +12151,25 @@ - Frame pop events are generated upon exit from a single method + Frame pop events are generated upon exit from a single method in a single frame as specified in a call to . This is true whether termination is caused by executing its return instruction - or by throwing an exception to its caller + or by throwing an exception to its caller (see ). - However, frame pops caused by the + However, frame pops caused by the function are not reported.

        The location reported by - identifies the executable location in the returning method, - immediately prior to the return. + identifies the executable location in the returning method, + immediately prior to the return. jvmdi - + JNIEnv @@ -12209,24 +12209,24 @@ - Method entry events are generated upon entry of Java + Method entry events are generated upon entry of Java programming language methods (including native methods).

        The location reported by identifies the initial executable location in - the method. + the method.

        Enabling method entry or exit events will significantly degrade performance on many platforms and is thus not advised for performance critical usage (such as profiling). - Bytecode instrumentation should be + Bytecode instrumentation should be used in these cases. jvmdi - + JNIEnv @@ -12259,25 +12259,25 @@ - Method exit events are generated upon exit from Java + Method exit events are generated upon exit from Java programming language methods (including native methods). This is true whether termination is caused by executing its return instruction - or by throwing an exception to its caller + or by throwing an exception to its caller (see ).

        The method field uniquely identifies the - method being entered or exited. The frame field provides + method being entered or exited. The frame field provides access to the stack frame for the method.

        The location reported by - identifies the executable location in the returning method - immediately prior to the return. + identifies the executable location in the returning method + immediately prior to the return.

        Enabling method entry or exit events will significantly degrade performance on many platforms and is thus not advised for performance critical usage (such as profiling). - Bytecode instrumentation should be + Bytecode instrumentation should be used in these cases. jvmdi @@ -12322,7 +12322,7 @@ The return value of the method being exited. - Undefined and should not be used if + Undefined and should not be used if is true. @@ -12333,18 +12333,18 @@ - A Native Method Bind event is sent when a VM binds a + A Native Method Bind event is sent when a VM binds a Java programming language native method - to the address of a function that implements the native method. + to the address of a function that implements the native method. This will occur when the native method is called for the first time and also occurs when the JNI function RegisterNatives is called. This event allows the bind to be redirected to an agent-specified - proxy function. + proxy function. This event is not sent when the native method is unbound. - Typically, this proxy function will need to be specific to a + Typically, this proxy function will need to be specific to a particular method or, to handle the general case, automatically - generated assembly code, since after instrumentation code is - executed the function at the original binding + generated assembly code, since after instrumentation code is + executed the function at the original binding address will usually be invoked. The original binding can be restored or the redirection changed by use of the JNI function RegisterNatives. @@ -12363,7 +12363,7 @@ The JNI environment of the event (current) thread - Will be NULL if sent during the primordial + Will be NULL if sent during the primordial phase. @@ -12407,7 +12407,7 @@ id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58"> Exception events are generated whenever an exception is first detected - in a Java programming language method. + in a Java programming language method. Where "exception" means any java.lang.Throwable. The exception may have been thrown by a Java programming language or native method, but in the case of native methods, the event is not generated @@ -12416,20 +12416,20 @@ no exception event is generated.

        The method and location - parameters uniquely identify the current location + parameters uniquely identify the current location (where the exception was detected) and allow - the mapping to source file and line number when that information is + the mapping to source file and line number when that information is available. The exception field identifies the thrown exception object. The catch_method and catch_location identify the location of the catch clause, if any, that handles the thrown exception. If there is no such catch clause, each field is set to 0. There is no guarantee that the thread will ever reach this catch clause. If there are native methods on the call stack - between the throw location and the catch clause, the exception may + between the throw location and the catch clause, the exception may be reset by one of those native methods. Similarly, exceptions that are reported as uncaught (catch_klass et al. set to 0) may in fact be caught by native code. - Agents can check for these occurrences by monitoring + Agents can check for these occurrences by monitoring events. Note that finally clauses are implemented as catch and re-throw. Therefore they will be reported in the catch location. @@ -12438,7 +12438,7 @@ - + JNIEnv @@ -12505,18 +12505,18 @@ Where "exception" means any java.lang.Throwable. If the exception is caught in a Java programming language method, the event is generated when the catch clause is reached. If the exception is caught in a native - method, the event is generated as soon as control is returned to a Java programming language + method, the event is generated as soon as control is returned to a Java programming language method. Exception catch events are generated for any exception for which a throw was detected in a Java programming language method. Note that finally clauses are implemented as catch and re-throw. Therefore they will generate exception catch events.

        The method and location - parameters uniquely identify the current location - and allow the mapping to source file and line number when that information is - available. For exceptions caught in a Java programming language method, the + parameters uniquely identify the current location + and allow the mapping to source file and line number when that information is + available. For exceptions caught in a Java programming language method, the exception object identifies the exception object. Exceptions - caught in native methods are not necessarily available by the time the + caught in native methods are not necessarily available by the time the exception catch is reported, so the exception field is set to NULL. @@ -12524,7 +12524,7 @@ - + JNIEnv @@ -12570,11 +12570,11 @@ id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start"> Thread start events are generated by a new thread before its initial - method executes. + method executes.

        A thread may be listed in the array returned by - before its thread start event is generated. + before its thread start event is generated. It is possible for other events to be generated on a thread before its thread start event.

        @@ -12583,7 +12583,7 @@ jvmdi - + JNIEnv @@ -12602,14 +12602,14 @@ + id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start"> Thread end events are generated by a terminating thread - after its initial method has finished execution. + after its initial method has finished execution.

        A thread may be listed in the array returned by - after its thread end event is generated. + after its thread end event is generated. No events are generated on a thread after its thread end event.

        @@ -12618,7 +12618,7 @@ jvmdi - + JNIEnv @@ -12641,15 +12641,15 @@ A class load event is generated when a class is first loaded. The order of class load events generated by a particular thread are guaranteed - to match the order of class loading within that thread. + to match the order of class loading within that thread. Array class creation does not generate a class load event. - The creation of a primitive class (for example, java.lang.Integer.TYPE) + The creation of a primitive class (for example, java.lang.Integer.TYPE) does not generate a class load event.

        This event is sent at an early stage in loading the class. As a result the class should be used carefully. Note, for example, that methods and fields are not yet loaded, so queries for methods, - fields, subclasses, and so on will not give correct results. + fields, subclasses, and so on will not give correct results. See "Loading of Classes and Interfaces" in the Java Language Specification. For most purposes the event will @@ -12658,7 +12658,7 @@ jvmdi - + JNIEnv @@ -12687,7 +12687,7 @@ id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57"> A class unload event is generated when the class is about to be unloaded. - Class unload events take place during garbage collection and must be + Class unload events take place during garbage collection and must be handled extremely carefully. The garbage collector holds many locks and has suspended all other threads, so the event handler cannot depend on the ability to acquire any locks. The class unload event handler should @@ -12704,7 +12704,7 @@ jvmdi - + JNIEnv @@ -12733,16 +12733,16 @@ id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56"> A class prepare event is generated when class preparation is complete. - At this point, class fields, methods, and implemented interfaces are - available, and no code from the class has been executed. Since array - classes never have fields or methods, class prepare events are not - generated for them. Class prepare events are not generated for - primitive classes (for example, java.lang.Integer.TYPE). + At this point, class fields, methods, and implemented interfaces are + available, and no code from the class has been executed. Since array + classes never have fields or methods, class prepare events are not + generated for them. Class prepare events are not generated for + primitive classes (for example, java.lang.Integer.TYPE). jvmdi - + JNIEnv @@ -12771,14 +12771,14 @@ This event is sent when the VM obtains class file data, but before it constructs - the in-memory representation for that class. - This event is also sent when the class is being modified by the + the in-memory representation for that class. + This event is also sent when the class is being modified by the function or the function, called in any environment. The agent can instrument the existing class file data sent by the VM to include profiling/debugging hooks. - See the description of + See the description of bytecode instrumentation for usage information.

        @@ -12788,28 +12788,28 @@ can_generate_all_class_hook_events are enabled then this event may be sent in the primordial phase. - Otherwise, this event may be sent before the VM is initialized (the start + Otherwise, this event may be sent before the VM is initialized (the start phase). Some classes might not be compatible with the function (eg. ROMized classes or implementation defined classes) and this event will not be generated for these classes.

        - The agent must allocate the space for the modified + The agent must allocate the space for the modified class file data buffer - using the memory allocation function + using the memory allocation function because the VM is responsible for freeing the new class file data buffer using .

        - If the agent wishes to modify the class file, it must set + If the agent wishes to modify the class file, it must set new_class_data to point to the newly instrumented class file data buffer and set - new_class_data_len to the length of that + new_class_data_len to the length of that buffer before returning from this call. If no modification is desired, the agent simply does not set new_class_data. If multiple agents have enabled this event the results are chained. That is, if - new_class_data has been set, it becomes the + new_class_data has been set, it becomes the class_data for the next agent.

        When handling a class load in the live phase, then the @@ -12827,13 +12827,13 @@

      • retransformation incapable - environments, in the + environments, in the order in which they were created
      • retransformation capable - environments, in the + environments, in the order in which they were created
      @@ -12869,7 +12869,7 @@ - The class loader loading the class. + The class loader loading the class. NULL if the bootstrap class loader. @@ -12972,7 +12972,7 @@ with other events, but the preceding events should be handled carefully, if at all, because the VM has not completed its initialization. The thread start event for the - main application thread is guaranteed not to occur until after the + main application thread is guaranteed not to occur until after the handler for the VM initialization event returns.

      In the case of VM start-up failure, this event will not be sent. @@ -13001,7 +13001,7 @@ - The VM death event notifies the agent of the termination of the VM. + The VM death event notifies the agent of the termination of the VM. No events will occur after the VMDeath event.

      In the case of VM start-up failure, this event will not be sent. @@ -13032,7 +13032,7 @@ followed by a new CompiledMethodLoad event. Note that a single method may have multiple compiled forms, and that this event will be sent for each form. - Note also that several methods may be inlined into a single + Note also that several methods may be inlined into a single address range, and that this event will be sent for each method.

      These events can be sent after their initial occurrence with @@ -13049,7 +13049,7 @@ - Corresponding location. See + Corresponding location. See for the meaning of location. @@ -13095,7 +13095,7 @@ jvmtiAddrLocationMap Map from native addresses to location. - The native address range of each entry is from + The native address range of each entry is from to start_address-1 of the next entry. NULL if mapping information cannot be supplied. @@ -13104,10 +13104,10 @@ - VM-specific compilation information. + VM-specific compilation information. The referenced compile information is managed by the VM and must not depend on the agent for collection. - A VM implementation defines the content and lifetime + A VM implementation defines the content and lifetime of the information. @@ -13119,9 +13119,9 @@ Sent when a compiled method is unloaded from memory. This event might not be sent on the thread which performed the unload. - This event may be sent sometime after the unload occurs, but + This event may be sent sometime after the unload occurs, but will be sent before the memory is reused - by a newly generated compiled method. This event may be sent after + by a newly generated compiled method. This event may be sent after the class is unloaded. jvmpi @@ -13139,7 +13139,7 @@ Compiled method being unloaded. - For identification of the compiled method only -- the class + For identification of the compiled method only -- the class may be unloaded and therefore the method should not be used as an argument to further JNI or functions. @@ -13148,7 +13148,7 @@ Address where compiled method code was loaded. - For identification of the compiled method only -- + For identification of the compiled method only -- the space may have been reclaimed. @@ -13236,7 +13236,7 @@ - JNI local reference to the thread + JNI local reference to the thread attempting to enter the monitor @@ -13367,28 +13367,28 @@ since="1.1"> Sent when a VM resource needed by a running application has been exhausted. - Except as required by the optional capabilities, the set of resources + Except as required by the optional capabilities, the set of resources which report exhaustion is implementation dependent.

      The following bit flags define the properties of the resource exhaustion: - After this event returns, the VM will throw a java.lang.OutOfMemoryError. - + - The VM was unable to allocate memory from the Java + The VM was unable to allocate memory from the Java platform heap. The heap is the runtime data area from which memory for all class instances and arrays are allocated. - + The VM was unable to create a thread. - + new @@ -13398,7 +13398,7 @@ heap. - Can generate events when the VM is unable to + Can generate events when the VM is unable to create a thread. @@ -13416,8 +13416,8 @@ Flags defining the properties of the of resource exhaustion - as specified by the - Resource + as specified by the + Resource Exhaustion Flags. @@ -13440,16 +13440,16 @@ - Sent when a method causes the virtual machine to allocate an + Sent when a method causes the virtual machine to allocate an Object visible to Java programming language code and the allocation is not detectable by other intrumentation mechanisms. Generally object allocation should be detected by instrumenting the bytecodes of allocating methods. Object allocation generated in native code by JNI function - calls should be detected using + calls should be detected using JNI function interception. - Some methods might not have associated bytecodes and are not - native methods, they instead are executed directly by the + Some methods might not have associated bytecodes and are not + native methods, they instead are executed directly by the VM. These methods should send this event. Virtual machines which are incapable of bytecode instrumentation for some or all of their methods can send this event. @@ -13539,7 +13539,7 @@ - A Garbage Collection Start event is sent when a + A Garbage Collection Start event is sent when a garbage collection pause begins. Only stop-the-world collections are reported--that is, collections during which all threads cease to modify the state of the Java virtual machine. @@ -13550,8 +13550,8 @@ specifically allow such use (see the raw monitor, memory management, and environment local storage functions).

      - This event is always sent as a matched pair with - + This event is always sent as a matched pair with + (assuming both events are enabled) and no garbage collection events will occur between them. @@ -13580,11 +13580,11 @@ and the handler for the Garbage Collection Finish event simply notifies the raw monitor

      - This event is always sent as a matched pair with + This event is always sent as a matched pair with (assuming both events are enabled). The most important use of this event is to provide timing information, - and thus additional information is not required. However, + and thus additional information is not required. However, information about the collection which is "free" should be included - what that information is needs to be determined. @@ -13613,7 +13613,7 @@

    - Though this seemed trivial to implement. + Though this seemed trivial to implement. In the RI it appears this will be quite complex. @@ -13659,54 +13659,54 @@ - Holds a Java programming language int. + Holds a Java programming language int. Signed 32 bits. - Holds a Java programming language long. + Holds a Java programming language long. Signed 64 bits. - Holds a Java programming language float. + Holds a Java programming language float. 32 bits. - Holds a Java programming language double. + Holds a Java programming language double. 64 bits. - Holds a Java programming language object. + Holds a Java programming language object. - Holds a Java programming language class. + Holds a Java programming language class. - Is a union of all primitive types and jobject. Thus, holds any Java - programming language value. + Is a union of all primitive types and jobject. Thus, holds any Java + programming language value. - Identifies a Java programming language field. + Identifies a Java programming language field. jfieldIDs returned by functions and events may be safely stored. - Identifies a Java programming language method, initializer, or constructor. + Identifies a Java programming language method, initializer, or constructor. jmethodIDs returned by functions and events may be safely stored. However, if the class is unloaded, they become invalid and must not be used. @@ -13715,7 +13715,7 @@ Pointer to the JNI function table. Pointer to this (JNIEnv *) - is a JNI environment. + is a JNI environment. @@ -13723,9 +13723,9 @@ - The environment pointer. + The environment pointer. See the Function Section. - jvmtiEnv points to the + jvmtiEnv points to the function table pointer. @@ -13744,8 +13744,8 @@ typedef jlong jlocation; - A 64 bit value, representing a monotonically increasing - executable position within a method. + A 64 bit value, representing a monotonically increasing + executable position within a method. -1 indicates a native method. See for the format on a given VM. @@ -13763,10 +13763,10 @@ Holds an error return code. See the Error section for possible values. -typedef enum { - JVMTI_ERROR_NONE = 0, +typedef enum { + JVMTI_ERROR_NONE = 0, JVMTI_ERROR_INVALID_THREAD = 10, - ... + ... } jvmtiError; @@ -13775,13 +13775,13 @@ An identifier for an event type. See the Event section for possible values. - It is guaranteed that future versions of this specification will + It is guaranteed that future versions of this specification will never assign zero as an event type identifier. -typedef enum { - JVMTI_EVENT_SINGLE_STEP = 1, - JVMTI_EVENT_BREAKPOINT = 2, - ... +typedef enum { + JVMTI_EVENT_SINGLE_STEP = 1, + JVMTI_EVENT_BREAKPOINT = 2, + ... } jvmtiEvent; @@ -13793,16 +13793,16 @@ typedef struct { jvmtiEventVMInit VMInit; jvmtiEventVMDeath VMDeath; - ... + ... } jvmtiEventCallbacks; - See event callbacks + See event callbacks for the complete structure.

    Where, for example, the VM initialization callback is defined: typedef void (JNICALL *jvmtiEventVMInit) - (jvmtiEnv *jvmti_env, + (jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread); @@ -13813,8 +13813,8 @@ typedef struct JNINativeInterface_ jniNativeInterface; Typedef for the JNI function table JNINativeInterface - defined in the - + defined in the + JNI Specification. The JNI reference implementation defines this with an underscore. @@ -13826,13 +13826,13 @@ JVMDI requires that the agent suspend threads before calling - certain sensitive functions. JVMPI requires garbage collection to be - disabled before calling certain sensitive functions. + certain sensitive functions. JVMPI requires garbage collection to be + disabled before calling certain sensitive functions. It was suggested that rather than have this requirement, that VM place itself in a suitable state before performing an operation. This makes considerable sense since each VM knows its requirements and can most easily arrange a - safe state. + safe state.

    The ability to externally suspend/resume threads will, of course, remain. The ability to enable/disable garbage collection will not. @@ -13840,19 +13840,19 @@ This issue is resolved--suspend will not be required. The spec has been updated to reflect this. - + There are a variety of approaches to sampling call stacks. The biggest bifurcation is between VM controlled and agent - controlled. + controlled.

    This issue is resolved--agent controlled sampling will be the approach. - + JVMDI represents threads as jthread. JVMPI primarily - uses JNIEnv* to represent threads. + uses JNIEnv* to represent threads.

    The Expert Group has chosen jthread as the representation for threads in . @@ -13863,26 +13863,26 @@ The JNI spec allows an implementation to depend on jclass/jmethodID - pairs, rather than simply a jmethodID, to reference a method. - JVMDI, for consistency, choose the same representation. + pairs, rather than simply a jmethodID, to reference a method. + JVMDI, for consistency, choose the same representation. JVMPI, however, specifies that a jmethodID alone maps to a method. Both of the Sun J2SE virtual machines (Classic and HotSpot) store pointers in jmethodIDs, and as a result, a jmethodID is sufficient. In fact, any JVM implementation that supports JVMPI must have - such a representation. + such a representation. will use jmethodID as a unique representation of a method (no jclass is used). - There should be efficiency gains, particularly in + There should be efficiency gains, particularly in functionality like stack dumping, to this representation.

    Note that fields were not used in JVMPI and that the access profile - of fields differs from methods--for implementation efficiency - reasons, a jclass/jfieldID pair will still be needed for field + of fields differs from methods--for implementation efficiency + reasons, a jclass/jfieldID pair will still be needed for field reference. - Functions return local references. + Functions return local references. @@ -13900,37 +13900,37 @@ - A hint of the percentage of objects that will be tagged would + A hint of the percentage of objects that will be tagged would help the VM pick a good implementation. - How difficult or easy would be to extend the monitor_info category to include + How difficult or easy would be to extend the monitor_info category to include

    -  - current number of monitors 
    -  - enumeration of monitors 
    -  - enumeration of threads waiting on a given monitor 
    +  - current number of monitors
    +  - enumeration of monitors
    +  - enumeration of threads waiting on a given monitor
         
    - The reason for my question is the fact that current get_monitor_info support - requires the agent to specify a given thread to get the info which is probably - OK in the profiling/debugging space, while in the monitoring space the agent - could be watching the monitor list and then decide which thread to ask for - the info. You might ask why is this important for monitoring .... I think it + The reason for my question is the fact that current get_monitor_info support + requires the agent to specify a given thread to get the info which is probably + OK in the profiling/debugging space, while in the monitoring space the agent + could be watching the monitor list and then decide which thread to ask for + the info. You might ask why is this important for monitoring .... I think it can aid in the detection/prediction of application contention caused by hot-locks. - The specification is an evolving document with major, minor, + The specification is an evolving document with major, minor, and micro version numbers. A released version of the specification is uniquely identified by its major and minor version. - The functions, events, and capabilities in this specification + The functions, events, and capabilities in this specification indicate a "Since" value which is the major and minor version in which it was introduced. - The version of the specification implemented by the VM can - be retrieved at runtime with the + The version of the specification implemented by the VM can + be retrieved at runtime with the function. @@ -14024,9 +14024,9 @@ get/set annotation, iterate live objects/heap. Add heap profiling functions place holder added: heap roots. - Heap profiling event added: object free. - Heap profiling event redesigned: vm object allocation. - Heap profiling event placeholders added: garbage collection start/finish. + Heap profiling event added: object free. + Heap profiling event redesigned: vm object allocation. + Heap profiling event placeholders added: garbage collection start/finish. Native method bind event added. @@ -14158,7 +14158,7 @@ One character XML fix. - Change function parameter names to be consistent with + Change function parameter names to be consistent with event parameters (fooBarBaz becomes foo_bar_baz). @@ -14215,8 +14215,8 @@ Define the data type jvmtiEventCallbacks. - Zero length allocations return NULL. - Keep SetAllocationHooks in JVMDI, but remove from . + Zero length allocations return NULL. + Keep SetAllocationHooks in JVMDI, but remove from . Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED. @@ -14234,7 +14234,7 @@ Changes per June 11th Expert Group meeting -- - Overhaul Heap functionality: single callback, + Overhaul Heap functionality: single callback, remove GetHeapRoots, add reachable iterators, and rename "annotation" to "tag". NULL thread parameter on most functions is current @@ -14250,8 +14250,8 @@ Clean up issues sections. Rename GetClassName back to GetClassSignature and fix description. - Add generic signature to GetClassSignature, - GetFieldSignature, GetMethodSignature, and + Add generic signature to GetClassSignature, + GetFieldSignature, GetMethodSignature, and GetLocalVariableTable. Elide EstimateCostOfCapabilities. Clarify that the system property functions operate @@ -14338,7 +14338,7 @@ Split can_get_source_info into can_get_source_file_name, can_get_line_numbers, and can_get_source_debug_extension. PopFrame cannot have a native calling method. - Removed incorrect statement in GetClassloaderClasses + Removed incorrect statement in GetClassloaderClasses (see ). @@ -14370,7 +14370,7 @@ Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT. - Steal java.lang.Runtime.availableProcessors() wording for + Steal java.lang.Runtime.availableProcessors() wording for AvailableProcessors(). Guarantee that zero will never be an event ID. Remove some issues which are no longer issues. @@ -14395,7 +14395,7 @@ Remove the ClassUnload event. - Heap reference iterator callbacks return an enum that + Heap reference iterator callbacks return an enum that allows outgoing object references to be ignored. Allow JNIEnv as a param type to extension events/functions. @@ -14403,23 +14403,23 @@ Fix a typo. - Remove all metadata functions: GetClassMetadata, + Remove all metadata functions: GetClassMetadata, GetFieldMetadata, and GetMethodMetadata. - Mark the functions Allocate. Deallocate, RawMonitor*, - SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage + Mark the functions Allocate. Deallocate, RawMonitor*, + SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage as safe for use in heap callbacks and GC events. - Add pass through opaque user data pointer to heap iterate + Add pass through opaque user data pointer to heap iterate functions and callbacks. In the CompiledMethodUnload event, send the code address. Add GarbageCollectionOccurred event. Add constant pool reference kind. Mark the functions CreateRawMonitor and DestroyRawMonitor as safe for use in heap callbacks and GC events. - Clarify: VMDeath, GetCurrentThreadCpuTimerInfo, + Clarify: VMDeath, GetCurrentThreadCpuTimerInfo, GetThreadCpuTimerInfo, IterateOverReachableObjects, IterateOverObjectsReachableFromObject, GetTime and JVMTI_ERROR_NULL_POINTER. @@ -14434,8 +14434,8 @@ SetEventNotificationMode, add: error attempted inappropriate thread level control. Remove jvmtiExceptionHandlerEntry. - Fix handling of native methods on the stack -- - location_ptr param of GetFrameLocation, remove + Fix handling of native methods on the stack -- + location_ptr param of GetFrameLocation, remove JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation, jvmtiFrameInfo.location, and jlocation. Remove typo (from JVMPI) implying that the MonitorWaited @@ -14456,7 +14456,7 @@ Remove MonitorContendedExit. Added JNIEnv parameter to VMObjectAlloc. - Clarified definition of class_tag and referrer_index + Clarified definition of class_tag and referrer_index parameters to heap callbacks. @@ -14483,13 +14483,13 @@ Require NotifyFramePop to act on suspended threads. - Add capabilities + Add capabilities (can_redefine_any_class - and + and can_generate_all_class_hook_events) - and an error () + >can_generate_all_class_hook_events) + and an error () which allow some classes to be unmodifiable. @@ -14573,11 +14573,11 @@ Bump major.minor version numbers to "1.0". - Clarify interaction between ForceGarbageCollection + Clarify interaction between ForceGarbageCollection and ObjectFree. - Restrict AddToBootstrapClassLoaderSearch and + Restrict AddToBootstrapClassLoaderSearch and SetSystemProperty to the OnLoad phase only. @@ -14604,8 +14604,8 @@ Add "since" version marker. Add AddToSystemClassLoaderSearch. Allow AddToBootstrapClassLoaderSearch be used in live phase. - Fix historic rubbish in the descriptions of the heap_object_callback - parameter of IterateOverHeap and IterateOverInstancesOfClass functions; + Fix historic rubbish in the descriptions of the heap_object_callback + parameter of IterateOverHeap and IterateOverInstancesOfClass functions; disallow NULL for this parameter. Clarify, correct and make consistent: wording about current thread, opaque frames and insufficient number of frames in PopFrame. @@ -14629,19 +14629,19 @@ Allow agents be started in the live phase. - Added paragraph about deploying agents. + Added paragraph about deploying agents. Add specification description to SetNativeMethodPrefix(es). - Better define the conditions on GetConstantPool. + Better define the conditions on GetConstantPool. Break out the GetClassVersionNumber function from GetConstantPool. - Clean-up the references to the VM Spec. + Clean-up the references to the VM Spec. Allow SetNativeMethodPrefix(es) in any phase. - Add clarifications about the impact of redefinition on GetConstantPool. + Add clarifications about the impact of redefinition on GetConstantPool. Various clarifications to SetNativeMethodPrefix(es). @@ -14655,7 +14655,7 @@ Add . Revamp the bytecode instrumentation documentation. - Change to no longer + Change to no longer require the can_redefine_classes capability. @@ -14668,7 +14668,7 @@ Add new heap functionity which supports reporting primitive values, allows setting the referrer tag, and has more powerful filtering: - FollowReferences, IterateThroughHeap, and their associated + FollowReferences, IterateThroughHeap, and their associated callbacks, structs, enums, and constants. @@ -14737,10 +14737,10 @@ Better phrasing. - Match the referrer_index for static fields in Object Reference Callback + Match the referrer_index for static fields in Object Reference Callback with the Reference Implementation (and all other known implementations); that is, make it match the definition for instance fields. - In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover + In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover an invalid thread in the list; and specify that not started threads return empty stacks. @@ -14756,10 +14756,10 @@ Changed spec to return -1 for monitor stack depth for the - implementation which can not determine stack depth. + implementation which can not determine stack depth. - Corrections for readability and accuracy courtesy of Alan Pratt of IBM. + Corrections for readability and accuracy courtesy of Alan Pratt of IBM. List the object relationships reported in FollowReferences. diff -r e271f2b09a39 -r e64b1cb48d6e test/compiler/arraycopy/TestACSameSrcDst.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/compiler/arraycopy/TestACSameSrcDst.java Fri Jun 02 10:37:05 2017 -0400 @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2017, Red Hat, Inc. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8179678 + * @summary ArrayCopy with same src and dst can cause incorrect execution or compiler crash + * + * @run main/othervm -XX:CompileCommand=compileonly,TestACSameSrcDst::test* TestACSameSrcDst + * + */ + +public class TestACSameSrcDst { + + static int test1(int[] src, int[] dst) { + System.arraycopy(src, 5, dst, 0, 10); + // this shouldn't be transformed to src[5] because the copy + // can modify src[5] if src and dst are the same. + return dst[0]; + } + + static int test2(int[] src) { + System.arraycopy(src, 0, src, 0, 10); + // same source and destination. If load from destination is + // transformed to load of source, the compiler performs that + // optimization in an infinite loop. + return src[0]; + } + + static int test3() { + int[] src = new int[15]; + src[5] = 0x42; + System.arraycopy(src, 5, src, 0, 10); + // That load can't bypass the arraycopy + return src[0]; + } + + static int test4() { + int[] src = new int[15]; + System.arraycopy(src, 0, src, 5, 10); + return src[0]; + } + + // The dst[0] load can't bypass the arraycopy. After ArrayCopyNode + // is expanded, C2 looks for a stub call on the control paths of + // the array copy subgraph to decide whether the load's memory + // input can bypass the arraycopy. This test verifies the case of + // a source array that's not declared as an array. + static int test5(Object src, int l, boolean flag) { + int[] dst = new int[10]; + if (flag) { + dst[0] = 0x42; + System.arraycopy(src, 0, dst, 0, l); + return dst[0]; + } + return 0; + } + + public static void main(String[] args) { + int[] array = new int[15]; + for (int i = 0; i < 20000; i++) { + int res; + for (int j = 0; j < array.length; j++) { + array[j] = j; + } + int expected = array[5]; + res = test1(array, array); + if (res != expected) { + throw new RuntimeException("bad result: " + res + " != " + expected); + } + test2(array); + res = test3(); + if (res != 0x42) { + throw new RuntimeException("bad result: " + res + " != " + 0x42); + } + test4(); + for (int j = 0; j < array.length; j++) { + array[j] = j; + } + res = test5(array, 10, (i%2) == 0); + if (res != 0) { + throw new RuntimeException("bad result: " + res + " != " + 0); + } + } + } +}