< 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"
  69 #include "utilities/exceptions.hpp"
  70 #include "utilities/preserveException.hpp"
  71 
  72 
  73 #define FIXLATER 0 // REMOVE this when completed.
  74 
  75  // FIXLATER: hook into JvmtiTrace
  76 #define TraceJVMTICalls false
  77 


1930 
1931 
1932 // k_mirror - may be primitive, this must be checked
1933 // heap_object_callback - pre-checked for NULL
1934 // user_data - NULL is a valid value, must be checked
1935 jvmtiError
1936 JvmtiEnv::IterateOverInstancesOfClass(oop k_mirror, jvmtiHeapObjectFilter object_filter, jvmtiHeapObjectCallback heap_object_callback, const void* user_data) {
1937   if (java_lang_Class::is_primitive(k_mirror)) {
1938     // DO PRIMITIVE CLASS PROCESSING
1939     return JVMTI_ERROR_NONE;
1940   }
1941   Klass* klass = java_lang_Class::as_Klass(k_mirror);
1942   if (klass == NULL) {
1943     return JVMTI_ERROR_INVALID_CLASS;
1944   }
1945   TraceTime t("IterateOverInstancesOfClass", TRACETIME_LOG(Debug, jvmti, objecttagging));
1946   JvmtiTagMap::tag_map_for(this)->iterate_over_heap(object_filter, klass, heap_object_callback, user_data);
1947   return JVMTI_ERROR_NONE;
1948 } /* end IterateOverInstancesOfClass */
1949 

































































1950 
1951   //
1952   // Local Variable functions
1953   //
1954 
1955 // Threads_lock NOT held, java_thread not protected by lock
1956 // java_thread - pre-checked
1957 // java_thread - unchecked
1958 // depth - pre-checked as non-negative
1959 // value_ptr - pre-checked for NULL
1960 jvmtiError
1961 JvmtiEnv::GetLocalObject(JavaThread* java_thread, jint depth, jint slot, jobject* value_ptr) {
1962   JavaThread* current_thread = JavaThread::current();
1963   // rm object is created to clean up the javaVFrame created in
1964   // doit_prologue(), but after doit() is finished with it.
1965   ResourceMark rm(current_thread);
1966 
1967   VM_GetOrSetLocal op(java_thread, current_thread, depth, slot);
1968   VMThread::execute(&op);
1969   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/heapMonitoring.hpp"
  60 #include "runtime/interfaceSupport.hpp"
  61 #include "runtime/javaCalls.hpp"
  62 #include "runtime/jfieldIDWorkaround.hpp"
  63 #include "runtime/osThread.hpp"
  64 #include "runtime/reflectionUtils.hpp"
  65 #include "runtime/signature.hpp"
  66 #include "runtime/thread.inline.hpp"
  67 #include "runtime/timerTrace.hpp"
  68 #include "runtime/vframe.hpp"
  69 #include "runtime/vmThread.hpp"
  70 #include "services/threadService.hpp"
  71 #include "utilities/exceptions.hpp"
  72 #include "utilities/preserveException.hpp"
  73 
  74 
  75 #define FIXLATER 0 // REMOVE this when completed.
  76 
  77  // FIXLATER: hook into JvmtiTrace
  78 #define TraceJVMTICalls false
  79 


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


< prev index next >