From afb02bbe92e55f877d50ed8705c95a41d541458d Mon Sep 17 00:00:00 2001
From: tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Sat, 1 Dec 2012 02:13:06 +0000
Subject: * variable.c (rb_class_path_no_cache): add a function to get the
 class   path without caching the computed path. Some classes are frozen, and 
  will raise an exception without this.

* probes.d (cmethod-entry, cmethod-return): separate cmethods from
  regular methods to match set trace func.

* probes_helper.h: refactor macros.  Fix probes to avoid calling
  #inspect when profiling.

* insns.def: update for use with new macros.

* vm_eval.c: ditto

* vm_insnhelper.c: ditto

* test/dtrace/test_singleton_function.rb: fix test for new output.

* test/dtrace/test_cmethod.rb: test the cmethod probes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
---
 insns.def | 44 ++++++++++++++++++--------------------------
 1 file changed, 18 insertions(+), 26 deletions(-)

(limited to 'insns.def')

diff --git a/insns.def b/insns.def
index e9716f4d0f..c4918961ce 100644
--- a/insns.def
+++ b/insns.def
@@ -843,32 +843,24 @@ trace
 {
     rb_event_flag_t flag = (rb_event_flag_t)nf;
 
-    if (RUBY_DTRACE_METHOD_ENTRY_ENABLED()) {
-        if (flag == RUBY_EVENT_CALL || flag == RUBY_EVENT_C_CALL) {
-          VALUE klass;
-          ID called_id;
-
-          rb_thread_method_id_and_class(th, &called_id, &klass);
-
-          RUBY_DTRACE_METHOD_ENTRY(
-                  RSTRING_PTR(rb_inspect(klass)),
-                  rb_id2name(called_id),
-                  rb_sourcefile(),
-                  rb_sourceline());
-        }
-    }
-    if (RUBY_DTRACE_METHOD_RETURN_ENABLED()) {
-        if (flag == RUBY_EVENT_RETURN || flag == RUBY_EVENT_C_RETURN) {
-          VALUE klass;
-          ID called_id;
-
-          rb_thread_method_id_and_class(th, &called_id, &klass);
-
-          RUBY_DTRACE_METHOD_RETURN(
-                  RSTRING_PTR(rb_inspect(klass)),
-                  rb_id2name(called_id),
-                  rb_sourcefile(),
-                  rb_sourceline());
+    if (RUBY_DTRACE_METHOD_ENTRY_ENABLED() ||
+        RUBY_DTRACE_METHOD_RETURN_ENABLED() ||
+        RUBY_DTRACE_CMETHOD_ENTRY_ENABLED() ||
+        RUBY_DTRACE_CMETHOD_RETURN_ENABLED()) {
+
+        switch(flag) {
+          case RUBY_EVENT_CALL:
+            RUBY_DTRACE_METHOD_ENTRY_HOOK(th, 0, 0);
+            break;
+          case RUBY_EVENT_C_CALL:
+            RUBY_DTRACE_CMETHOD_ENTRY_HOOK(th, 0, 0);
+            break;
+          case RUBY_EVENT_RETURN:
+            RUBY_DTRACE_METHOD_RETURN_HOOK(th, 0, 0);
+            break;
+          case RUBY_EVENT_C_RETURN:
+            RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, 0, 0);
+            break;
         }
     }
 
-- 
cgit v1.2.3

