diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-15 21:24:08 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-15 21:24:08 +0000 |
commit | 90a6dce0415f7dc5accc9929d497a8044d9e6067 (patch) | |
tree | 79a8cd99ca279fafc4dbf5f333137458d142e618 /class.c | |
parent | 747487cda7b5a8c893ed8f6b0d7f7498aa434a02 (diff) | |
download | ruby-90a6dce0415f7dc5accc9929d497a8044d9e6067.tar.gz |
* method.h: introduce new method type VM_METHOD_TYPE_CFUNC_FAST.
This method is similar to VM_METHOD_TYPE_CFUNC methods, but
called cfunc without building new frame (does not push new control
frame). If error is occured in cfunc, the backtrace only shows
caller frame and upper.
This kind of methods can be added by rb_define_method_fast().
This feature is similar to specialized instructions (opt_plus, etc),
but more flexible (but a bit slower).
* class.c (rb_define_method_fast): added.
Maybe it will be renamed soon.
* vm_insnhelper.c (vm_call_method): support method type
VM_METHOD_TYPE_CFUNC_FAST.
* proc.c (rb_method_entry_arity): catch up new method type.
* vm_method.c (rb_add_method_cfunc_fast): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
-rw-r--r-- | class.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1254,6 +1254,12 @@ rb_define_method(VALUE klass, const char *name, VALUE (*func)(ANYARGS), int argc } void +rb_define_method_fast(VALUE klass, const char *name, VALUE (*func)(ANYARGS), int argc) +{ + rb_add_method_cfunc_fast(klass, rb_intern(name), func, argc, NOEX_PUBLIC); +} + +void rb_define_protected_method(VALUE klass, const char *name, VALUE (*func)(ANYARGS), int argc) { rb_add_method_cfunc(klass, rb_intern(name), func, argc, NOEX_PROTECTED); |