diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-14 20:59:21 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-14 20:59:21 +0000 |
commit | c4457e03c665a48f1d953fbbe4499b65e7b1149b (patch) | |
tree | 496075643b1a70ab381c6c1b3c4bbdc70e0fee3e /vm_insnhelper.h | |
parent | 8f08e61bad1d745dc7a10ff216ad5ca2e92b3ded (diff) | |
download | ruby-c4457e03c665a48f1d953fbbe4499b65e7b1149b.tar.gz |
* vm_insnhelper.h CI_SET_FASTPATH: introduce new macro
`CI_SET_FASTPATH(ci, func)'. This macro set `ci->call' as `func'.
`func' (ci->call) is called at the last of `send'
(and `invokesuper') instruction.
`CI_SET_FASTPATH' does not set `ci->call' when the method
(stored in `ci->me') is `protected'.
* vm_insnhelper.c (vm_call_method): use `CI_SET_FASTPATH'.
After several checking (visibility, argc checking), the result of
checking can be reused until re-definition of this method
with inline method cache.
Note that this optimization is now experimental.
If you find any problem about it, please tell us.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.h')
-rw-r--r-- | vm_insnhelper.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/vm_insnhelper.h b/vm_insnhelper.h index c6b2fbefdb..7e111d1b1e 100644 --- a/vm_insnhelper.h +++ b/vm_insnhelper.h @@ -200,6 +200,13 @@ enum vm_regan_acttype { } \ } while (0) +/* set fastpath when cached method is *NOT* protected + * because inline method cache does not care about receiver. + */ +#define CI_SET_FASTPATH(ci, func) do { \ + if (!(((ci)->me->flag & NOEX_MASK) & NOEX_PROTECTED)) ((ci)->call = (func)); \ +} while (0) + #define GET_BLOCK_PTR() ((rb_block_t *)(GC_GUARDED_PTR_REF(GET_LEP()[0]))) /**********************************************************/ |