aboutsummaryrefslogtreecommitdiffstats
path: root/vm_callinfo.h
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-01 16:01:30 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-09 09:52:46 +0900
commit46728557c16be2693c81c7c5ca51ea161ef28f65 (patch)
tree30cb78c0e60d233ff8e24e4b26753bc8ea8f5a67 /vm_callinfo.h
parentdb406daa60c1cc1585dd8a7227a87d45bbd3cb89 (diff)
downloadruby-46728557c16be2693c81c7c5ca51ea161ef28f65.tar.gz
rb_vm_call0: on-stack call info
This changeset reduces the generated binary of rb_vm_call0 from 281 bytes to 211 bytes on my machine. Should reduce GC pressure as well.
Diffstat (limited to 'vm_callinfo.h')
-rw-r--r--vm_callinfo.h37
1 files changed, 21 insertions, 16 deletions
diff --git a/vm_callinfo.h b/vm_callinfo.h
index 7c73194fca..f9ede405b9 100644
--- a/vm_callinfo.h
+++ b/vm_callinfo.h
@@ -251,6 +251,17 @@ vm_ci_markable(const struct rb_callinfo *ci)
}
}
+#define VM_CI_ON_STACK(mid_, flags_, argc_, kwarg_) \
+ (struct rb_callinfo) { \
+ .flags = T_IMEMO | \
+ (imemo_callinfo << FL_USHIFT) | \
+ VM_CALLINFO_NOT_UNDER_GC, \
+ .mid = mid_, \
+ .flag = flags_, \
+ .argc = argc_, \
+ .kwarg = kwarg_, \
+ }
+
typedef VALUE (*vm_call_handler)(
struct rb_execution_context_struct *ec,
struct rb_control_frame_struct *cfp,
@@ -290,22 +301,16 @@ vm_cc_new(VALUE klass,
return cc;
}
-static inline const struct rb_callcache *
-vm_cc_fill(struct rb_callcache *cc,
- VALUE klass,
- const struct rb_callable_method_entry_struct *cme,
- vm_call_handler call)
-{
- struct rb_callcache cc_body = {
- .flags = T_IMEMO | (imemo_callcache << FL_USHIFT) | VM_CALLCACHE_UNMARKABLE,
- .klass = klass,
- .cme_ = cme,
- .call_ = call,
- .aux_.v = 0,
- };
- MEMCPY(cc, &cc_body, struct rb_callcache, 1);
- return cc;
-}
+#define VM_CC_ON_STACK(clazz, call, aux, cme) \
+ (struct rb_callcache) { \
+ .flags = T_IMEMO | \
+ (imemo_callcache << FL_USHIFT) | \
+ VM_CALLCACHE_UNMARKABLE, \
+ .klass = clazz, \
+ .cme_ = cme, \
+ .call_ = call, \
+ .aux_ = aux, \
+ }
static inline bool
vm_cc_class_check(const struct rb_callcache *cc, VALUE klass)