ruby-changes:2455
From: ko1@a...
Date: 16 Nov 2007 16:29:59 +0900
Subject: [ruby-changes:2455] shugo - Ruby:r13946 (trunk): * include/ruby/ruby.h: added some declarations for event hooks.
shugo 2007-11-16 16:29:44 +0900 (Fri, 16 Nov 2007)
New Revision: 13946
Modified files:
trunk/ChangeLog
trunk/include/ruby/ruby.h
trunk/lib/profile.rb
trunk/vm_core.h
Log:
* include/ruby/ruby.h: added some declarations for event hooks.
* lib/profile.rb: set VM::InstructionSequence.compile_option.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/ruby.h?r1=13946&r2=13945
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13946&r2=13945
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/profile.rb?r1=13946&r2=13945
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/vm_core.h?r1=13946&r2=13945
Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h (revision 13945)
+++ include/ruby/ruby.h (revision 13946)
@@ -940,6 +940,36 @@
#define HAVE_NATIVETHREAD
int is_ruby_native_thread(void);
+#define RUBY_EVENT_NONE 0x00
+#define RUBY_EVENT_LINE 0x01
+#define RUBY_EVENT_CLASS 0x02
+#define RUBY_EVENT_END 0x04
+#define RUBY_EVENT_CALL 0x08
+#define RUBY_EVENT_RETURN 0x10
+#define RUBY_EVENT_C_CALL 0x20
+#define RUBY_EVENT_C_RETURN 0x40
+#define RUBY_EVENT_RAISE 0x80
+#define RUBY_EVENT_ALL 0xff
+#define RUBY_EVENT_VM 0x100
+#define RUBY_EVENT_SWITCH 0x200
+
+typedef unsigned int rb_event_flag_t;
+typedef void (*rb_event_hook_func_t)(rb_event_flag_t, VALUE data, VALUE, ID, VALUE klass);
+
+typedef struct rb_event_hook_struct {
+ rb_event_flag_t flag;
+ rb_event_hook_func_t func;
+ VALUE data;
+ struct rb_event_hook_struct *next;
+} rb_event_hook_t;
+
+void rb_thread_add_event_hook(rb_thread_t *th, rb_event_hook_func_t func,
+ rb_event_flag_t events, VALUE data);
+void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events,
+ VALUE data);
+int rb_thread_remove_event_hook(rb_thread_t *th, rb_event_hook_func_t func);
+int rb_remove_event_hook(rb_event_hook_func_t func);
+
#if defined(__cplusplus)
#if 0
{ /* satisfy cc-mode */
Index: ChangeLog
===================================================================
--- ChangeLog (revision 13945)
+++ ChangeLog (revision 13946)
@@ -1,3 +1,9 @@
+Fri Nov 16 16:26:57 2007 Shugo Maeda <shugo@r...>
+
+ * include/ruby/ruby.h: added some declarations for event hooks.
+
+ * lib/profile.rb: set VM::InstructionSequence.compile_option.
+
Fri Nov 16 11:16:41 2007 Nobuyoshi Nakada <nobu@r...>
* lib/yaml/rubytypes.rb (String#is_binary_data?): use Integer#fdiv.
Index: vm_core.h
===================================================================
--- vm_core.h (revision 13945)
+++ vm_core.h (revision 13946)
@@ -275,29 +275,6 @@
typedef struct rb_iseq_struct rb_iseq_t;
-#define RUBY_EVENT_NONE 0x00
-#define RUBY_EVENT_LINE 0x01
-#define RUBY_EVENT_CLASS 0x02
-#define RUBY_EVENT_END 0x04
-#define RUBY_EVENT_CALL 0x08
-#define RUBY_EVENT_RETURN 0x10
-#define RUBY_EVENT_C_CALL 0x20
-#define RUBY_EVENT_C_RETURN 0x40
-#define RUBY_EVENT_RAISE 0x80
-#define RUBY_EVENT_ALL 0xff
-#define RUBY_EVENT_VM 0x100
-#define RUBY_EVENT_SWITCH 0x200
-
-typedef unsigned int rb_event_flag_t;
-typedef void (*rb_event_hook_func_t)(rb_event_flag_t, VALUE data, VALUE, ID, VALUE klass);
-
-typedef struct rb_event_hook_struct {
- rb_event_flag_t flag;
- rb_event_hook_func_t func;
- VALUE data;
- struct rb_event_hook_struct *next;
-} rb_event_hook_t;
-
#define GetVMPtr(obj, ptr) \
GetCoreDataFromValue(obj, rb_vm_t, ptr)
Index: lib/profile.rb
===================================================================
--- lib/profile.rb (revision 13945)
+++ lib/profile.rb (revision 13946)
@@ -1,5 +1,9 @@
require 'profiler'
+VM::InstructionSequence.compile_option = {
+ :trace_instruction => true,
+ :specialized_instruction => false
+}
END {
Profiler__::print_profile(STDERR)
}
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml