You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by mc...@apache.org on 2008/03/05 08:11:35 UTC
svn commit: r633781 - in /harmony/enhanced/drlvm/trunk/vm/vmcore:
include/vm_log.h src/jvmti/jvmti_method.cpp
Author: mcfirst
Date: Tue Mar 4 23:11:34 2008
New Revision: 633781
URL: http://svn.apache.org/viewvc?rev=633781&view=rev
Log:
Applying patch from HARMONY-5487 [drlvm][logging] add operator<<(method) to VM logging system
Modified:
harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_log.h
harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_method.cpp
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_log.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_log.h?rev=633781&r1=633780&r2=633781&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_log.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_log.h Tue Mar 4 23:11:34 2008
@@ -35,8 +35,8 @@
*/
/**
-* The convenience method for logging VM Strings.
-*/
+ * The convenience method for logging VM Strings.
+ */
inline LoggerString& operator<<(LoggerString& log, const String* str) {
if (str) {
log << str->bytes;
@@ -59,8 +59,24 @@
}
/**
-* The convenience method for logging Method instances.
-*/
+ * The convenience method for logging jboolean values.
+ */
+inline LoggerString& operator<<(LoggerString& log, const jboolean b) {
+ if (b == JNI_FALSE) {
+ log << "false";
+ } else if (b == JNI_TRUE) {
+ log << "true";
+ } else {
+ log << "(jboolean) " << ((unsigned) b);
+ }
+
+ return log;
+}
+
+
+/**
+ * The convenience method for logging Method handles.
+ */
inline LoggerString& operator<<(LoggerString& log, const Class_Member* m) {
if (m) {
log << m->get_class() << "."
@@ -74,8 +90,15 @@
}
/**
-* The convenience method for logging managed objects.
-*/
+ * The convenience method for logging JNI method IDs.
+ */
+inline LoggerString& operator<<(LoggerString& log, const jmethodID m) {
+ return log << reinterpret_cast<const Method*>(m);
+}
+
+/**
+ * The convenience method for logging managed objects.
+ */
inline LoggerString& operator<<(LoggerString& log, /*const*/ ManagedObject* object) {
assert(!hythread_is_suspend_enabled());
if (object) {
@@ -87,8 +110,8 @@
}
/**
-* The convenience method for logging JNI object handles.
-*/
+ * The convenience method for logging JNI object handles.
+ */
inline LoggerString& operator<<(LoggerString& log, const jobject jobj) {
hythread_suspend_disable();
if (jobj) {
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_method.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_method.cpp?rev=633781&r1=633780&r2=633781&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_method.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_method.cpp Tue Mar 4 23:11:34 2008
@@ -30,6 +30,7 @@
#include "object_handles.h"
#include "jvmti_utils.h"
#include "cxxlog.h"
+#include "vm_log.h"
#include "jvmti_interface.h"
#include "suspend_checker.h"
@@ -117,7 +118,7 @@
jmethodID method,
jclass* declaring_class_ptr)
{
- TRACE2("jvmti.method", "GetMethodDeclaringClass called");
+ TRACE2("jvmti.method", "GetMethodDeclaringClass called for " << method);
SuspendEnabledChecker sec;
/*
* Check given env & current phase.
@@ -559,7 +560,7 @@
jmethodID method,
jboolean* is_native_ptr)
{
- TRACE2("jvmti.method", "IsMethodNative called");
+ TRACE2("jvmti.method", "IsMethodNative called for " << method);
SuspendEnabledChecker sec;
/*
* Check given env & current phase.
@@ -582,6 +583,7 @@
}
*is_native_ptr = (jboolean)(reinterpret_cast<Method*>(method)->is_native()?JNI_TRUE:JNI_FALSE);
+ TRACE2("jvmti.method", "IsMethodNative(" << method << ") = " << *is_native_ptr);
return JVMTI_ERROR_NONE;
}
@@ -644,7 +646,7 @@
jmethodID method,
jboolean* is_obsolete_ptr)
{
- TRACE2("jvmti.method", "IsMethodObsolete called");
+ TRACE2("jvmti.method", "IsMethodObsolete called for " << method);
SuspendEnabledChecker sec;
/*
* Check given env & current phase.
@@ -671,6 +673,7 @@
*/
*is_obsolete_ptr = JNI_FALSE;
+ TRACE2("jvmti.method", "IsMethodObsolete(" << method << ") = " << *is_obsolete_ptr);
return JVMTI_ERROR_NONE;
} // jvmtiIsMethodObsolete