diff options
author | Peter Zhu <peter@peterzhu.ca> | 2022-07-11 10:09:39 -0400 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2022-07-15 09:21:07 -0400 |
commit | 7424ea184f9d67c1c7f3ee97494ed3bd1aa60833 (patch) | |
tree | 822838e39d81cd2785c970cb45a86854823af6fe /mjit_compile.c | |
parent | 7fda741f6e67b809b08423f0d4e903c078da2eed (diff) | |
download | ruby-7424ea184f9d67c1c7f3ee97494ed3bd1aa60833.tar.gz |
Implement Objects on VWA
This commit implements Objects on Variable Width Allocation. This allows
Objects with more ivars to be embedded (i.e. contents directly follow the
object header) which improves performance through better cache locality.
Diffstat (limited to 'mjit_compile.c')
-rw-r--r-- | mjit_compile.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mjit_compile.c b/mjit_compile.c index 66deaa9a65..2c7996c258 100644 --- a/mjit_compile.c +++ b/mjit_compile.c @@ -353,12 +353,16 @@ mjit_compile_body(FILE *f, const rb_iseq_t *iseq, struct compile_status *status) // Generate merged ivar guards first if needed if (!status->compile_info->disable_ivar_cache && status->merge_ivar_guards_p) { fprintf(f, " if (UNLIKELY(!(RB_TYPE_P(GET_SELF(), T_OBJECT) && (rb_serial_t)%"PRI_SERIALT_PREFIX"u == RCLASS_SERIAL(RBASIC(GET_SELF())->klass) &&", status->ivar_serial); +#if USE_RVARGC + fprintf(f, "%"PRIuSIZE" < ROBJECT_NUMIV(GET_SELF())", status->max_ivar_index); // index < ROBJECT_NUMIV(obj) +#else if (status->max_ivar_index >= ROBJECT_EMBED_LEN_MAX) { fprintf(f, "%"PRIuSIZE" < ROBJECT_NUMIV(GET_SELF())", status->max_ivar_index); // index < ROBJECT_NUMIV(obj) && !RB_FL_ANY_RAW(obj, ROBJECT_EMBED) } else { fprintf(f, "ROBJECT_EMBED_LEN_MAX == ROBJECT_NUMIV(GET_SELF())"); // index < ROBJECT_NUMIV(obj) && RB_FL_ANY_RAW(obj, ROBJECT_EMBED) } +#endif fprintf(f, "))) {\n"); fprintf(f, " goto ivar_cancel;\n"); fprintf(f, " }\n"); |