< prev index next >

src/share/vm/prims/jvmtiEnv.cpp

Print this page




  29 #include "classfile/modules.hpp"
  30 #include "classfile/systemDictionary.hpp"
  31 #include "classfile/vmSymbols.hpp"
  32 #include "interpreter/bytecodeStream.hpp"
  33 #include "interpreter/interpreter.hpp"
  34 #include "jvmtifiles/jvmtiEnv.hpp"
  35 #include "logging/log.hpp"
  36 #include "logging/logConfiguration.hpp"
  37 #include "memory/resourceArea.hpp"
  38 #include "memory/universe.inline.hpp"
  39 #include "oops/instanceKlass.hpp"
  40 #include "oops/objArrayOop.inline.hpp"
  41 #include "oops/oop.inline.hpp"
  42 #include "prims/jniCheck.hpp"
  43 #include "prims/jvm_misc.hpp"
  44 #include "prims/jvmtiAgentThread.hpp"
  45 #include "prims/jvmtiClassFileReconstituter.hpp"
  46 #include "prims/jvmtiCodeBlobEvents.hpp"
  47 #include "prims/jvmtiExtensions.hpp"
  48 #include "prims/jvmtiGetLoadedClasses.hpp"

  49 #include "prims/jvmtiImpl.hpp"
  50 #include "prims/jvmtiManageCapabilities.hpp"
  51 #include "prims/jvmtiRawMonitor.hpp"
  52 #include "prims/jvmtiRedefineClasses.hpp"
  53 #include "prims/jvmtiTagMap.hpp"
  54 #include "prims/jvmtiThreadState.inline.hpp"
  55 #include "prims/jvmtiUtil.hpp"
  56 #include "runtime/arguments.hpp"
  57 #include "runtime/deoptimization.hpp"
  58 #include "runtime/interfaceSupport.hpp"
  59 #include "runtime/javaCalls.hpp"
  60 #include "runtime/jfieldIDWorkaround.hpp"
  61 #include "runtime/osThread.hpp"
  62 #include "runtime/reflectionUtils.hpp"
  63 #include "runtime/signature.hpp"
  64 #include "runtime/thread.inline.hpp"
  65 #include "runtime/timerTrace.hpp"
  66 #include "runtime/vframe.hpp"
  67 #include "runtime/vmThread.hpp"
  68 #include "services/threadService.hpp"


1941 // heap_object_callback - pre-checked for NULL
1942 // user_data - NULL is a valid value, must be checked
1943 jvmtiError
1944 JvmtiEnv::IterateOverInstancesOfClass(oop k_mirror, jvmtiHeapObjectFilter object_filter, jvmtiHeapObjectCallback heap_object_callback, const void* user_data) {
1945   if (java_lang_Class::is_primitive(k_mirror)) {
1946     // DO PRIMITIVE CLASS PROCESSING
1947     return JVMTI_ERROR_NONE;
1948   }
1949   Klass* k_oop = java_lang_Class::as_Klass(k_mirror);
1950   if (k_oop == NULL) {
1951     return JVMTI_ERROR_INVALID_CLASS;
1952   }
1953   Thread *thread = Thread::current();
1954   HandleMark hm(thread);
1955   KlassHandle klass (thread, k_oop);
1956   TraceTime t("IterateOverInstancesOfClass", TRACETIME_LOG(Debug, jvmti, objecttagging));
1957   JvmtiTagMap::tag_map_for(this)->iterate_over_heap(object_filter, klass, heap_object_callback, user_data);
1958   return JVMTI_ERROR_NONE;
1959 } /* end IterateOverInstancesOfClass */
1960 


































1961 
1962   //
1963   // Local Variable functions
1964   //
1965 
1966 // Threads_lock NOT held, java_thread not protected by lock
1967 // java_thread - pre-checked
1968 // java_thread - unchecked
1969 // depth - pre-checked as non-negative
1970 // value_ptr - pre-checked for NULL
1971 jvmtiError
1972 JvmtiEnv::GetLocalObject(JavaThread* java_thread, jint depth, jint slot, jobject* value_ptr) {
1973   JavaThread* current_thread = JavaThread::current();
1974   // rm object is created to clean up the javaVFrame created in
1975   // doit_prologue(), but after doit() is finished with it.
1976   ResourceMark rm(current_thread);
1977 
1978   VM_GetOrSetLocal op(java_thread, current_thread, depth, slot);
1979   VMThread::execute(&op);
1980   jvmtiError err = op.result();




  29 #include "classfile/modules.hpp"
  30 #include "classfile/systemDictionary.hpp"
  31 #include "classfile/vmSymbols.hpp"
  32 #include "interpreter/bytecodeStream.hpp"
  33 #include "interpreter/interpreter.hpp"
  34 #include "jvmtifiles/jvmtiEnv.hpp"
  35 #include "logging/log.hpp"
  36 #include "logging/logConfiguration.hpp"
  37 #include "memory/resourceArea.hpp"
  38 #include "memory/universe.inline.hpp"
  39 #include "oops/instanceKlass.hpp"
  40 #include "oops/objArrayOop.inline.hpp"
  41 #include "oops/oop.inline.hpp"
  42 #include "prims/jniCheck.hpp"
  43 #include "prims/jvm_misc.hpp"
  44 #include "prims/jvmtiAgentThread.hpp"
  45 #include "prims/jvmtiClassFileReconstituter.hpp"
  46 #include "prims/jvmtiCodeBlobEvents.hpp"
  47 #include "prims/jvmtiExtensions.hpp"
  48 #include "prims/jvmtiGetLoadedClasses.hpp"
  49 #include "prims/jvmtiHeapTransition.hpp"
  50 #include "prims/jvmtiImpl.hpp"
  51 #include "prims/jvmtiManageCapabilities.hpp"
  52 #include "prims/jvmtiRawMonitor.hpp"
  53 #include "prims/jvmtiRedefineClasses.hpp"
  54 #include "prims/jvmtiTagMap.hpp"
  55 #include "prims/jvmtiThreadState.inline.hpp"
  56 #include "prims/jvmtiUtil.hpp"
  57 #include "runtime/arguments.hpp"
  58 #include "runtime/deoptimization.hpp"
  59 #include "runtime/interfaceSupport.hpp"
  60 #include "runtime/javaCalls.hpp"
  61 #include "runtime/jfieldIDWorkaround.hpp"
  62 #include "runtime/osThread.hpp"
  63 #include "runtime/reflectionUtils.hpp"
  64 #include "runtime/signature.hpp"
  65 #include "runtime/thread.inline.hpp"
  66 #include "runtime/timerTrace.hpp"
  67 #include "runtime/vframe.hpp"
  68 #include "runtime/vmThread.hpp"
  69 #include "services/threadService.hpp"


1942 // heap_object_callback - pre-checked for NULL
1943 // user_data - NULL is a valid value, must be checked
1944 jvmtiError
1945 JvmtiEnv::IterateOverInstancesOfClass(oop k_mirror, jvmtiHeapObjectFilter object_filter, jvmtiHeapObjectCallback heap_object_callback, const void* user_data) {
1946   if (java_lang_Class::is_primitive(k_mirror)) {
1947     // DO PRIMITIVE CLASS PROCESSING
1948     return JVMTI_ERROR_NONE;
1949   }
1950   Klass* k_oop = java_lang_Class::as_Klass(k_mirror);
1951   if (k_oop == NULL) {
1952     return JVMTI_ERROR_INVALID_CLASS;
1953   }
1954   Thread *thread = Thread::current();
1955   HandleMark hm(thread);
1956   KlassHandle klass (thread, k_oop);
1957   TraceTime t("IterateOverInstancesOfClass", TRACETIME_LOG(Debug, jvmti, objecttagging));
1958   JvmtiTagMap::tag_map_for(this)->iterate_over_heap(object_filter, klass, heap_object_callback, user_data);
1959   return JVMTI_ERROR_NONE;
1960 } /* end IterateOverInstancesOfClass */
1961 
1962 // Start the sampler.
1963 jvmtiError
1964 JvmtiEnv::StartHeapSampling(jint monitoring_rate, jint max_storage) {
1965   if (monitoring_rate < 0) {
1966     return JVMTI_ERROR_ILLEGAL_ARGUMENT;
1967   }
1968 
1969   fprintf(stderr, "Initializing\n");
1970   HeapThreadTransition htt(Thread::current());
1971   HeapMonitoring::initialize_profiling(monitoring_rate, max_storage);
1972   return JVMTI_ERROR_NONE;
1973 } /* end StartHeapSampling */
1974 
1975 // Get the currently live sampled allocations.
1976 jvmtiError
1977 JvmtiEnv::GetLiveTraces(jvmtiStackTraces *stack_traces) {
1978   HeapThreadTransition htt(Thread::current());
1979   if (stack_traces == NULL) {
1980     return JVMTI_ERROR_ILLEGAL_ARGUMENT;
1981   }
1982 
1983   HeapMonitoring::get_live_traces(stack_traces);
1984   return JVMTI_ERROR_NONE;
1985 } /* end GetLiveTraces */
1986 
1987 // Release sampled traces.
1988 jvmtiError
1989 JvmtiEnv::ReleaseTraces(jvmtiStackTraces *stack_traces) {
1990   if (stack_traces == NULL) {
1991     return JVMTI_ERROR_NONE;
1992   }
1993   HeapMonitoring::release_traces(stack_traces);
1994   return JVMTI_ERROR_NONE;
1995 } /* end ReleaseTraces */
1996 
1997   //
1998   // Local Variable functions
1999   //
2000 
2001 // Threads_lock NOT held, java_thread not protected by lock
2002 // java_thread - pre-checked
2003 // java_thread - unchecked
2004 // depth - pre-checked as non-negative
2005 // value_ptr - pre-checked for NULL
2006 jvmtiError
2007 JvmtiEnv::GetLocalObject(JavaThread* java_thread, jint depth, jint slot, jobject* value_ptr) {
2008   JavaThread* current_thread = JavaThread::current();
2009   // rm object is created to clean up the javaVFrame created in
2010   // doit_prologue(), but after doit() is finished with it.
2011   ResourceMark rm(current_thread);
2012 
2013   VM_GetOrSetLocal op(java_thread, current_thread, depth, slot);
2014   VMThread::execute(&op);
2015   jvmtiError err = op.result();


< prev index next >