summaryrefslogtreecommitdiff
path: root/yjit_core.c
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>2021-11-18 10:44:31 -0500
committerGitHub <noreply@github.com>2021-11-18 10:44:31 -0500
commitcdebf57ec670f35cf07460778e40f6801050ffb5 (patch)
treec279524b6e949311aef31fbf9acc1533d5abb58e /yjit_core.c
parentf3dcb4bbf7253690abba02e64a051390c55237cb (diff)
Add --yjit-no-type-prop so we can test YJIT without type propagation (#5135)
* Add --yjit-no-type-prop so we can test YJIT without type propagation * Fix typo in command line option * Leave just two test workflows enable for YJIT
Notes
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
Diffstat (limited to 'yjit_core.c')
-rw-r--r--yjit_core.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/yjit_core.c b/yjit_core.c
index 8d9c267908..a395285e1c 100644
--- a/yjit_core.c
+++ b/yjit_core.c
@@ -26,6 +26,11 @@ Return a pointer to the new stack top
static x86opnd_t
ctx_stack_push_mapping(ctx_t *ctx, temp_type_mapping_t mapping)
{
+ // If type propagation is disabled, store no types
+ if (rb_yjit_opts.no_type_prop) {
+ mapping.type = TYPE_UNKNOWN;
+ }
+
// Keep track of the type and mapping of the value
if (ctx->stack_size < MAX_TEMP_TYPES) {
ctx->temp_mapping[ctx->stack_size] = mapping.mapping;
@@ -80,6 +85,7 @@ ctx_stack_push_local(ctx_t *ctx, size_t local_idx)
(temp_mapping_t){ .kind = TEMP_LOCAL, .idx = local_idx },
TYPE_UNKNOWN
};
+
return ctx_stack_push_mapping(ctx, mapping);
}
@@ -165,7 +171,6 @@ static int type_diff(val_type_t src, val_type_t dst);
(dest) = (src); \
} while (false)
-
/**
Upgrade (or "learn") the type of an instruction operand
This value must be compatible and at least as specific as the previously known type.
@@ -175,6 +180,10 @@ propagated back to its source.
static void
ctx_upgrade_opnd_type(ctx_t *ctx, insn_opnd_t opnd, val_type_t type)
{
+ // If type propagation is disabled, store no types
+ if (rb_yjit_opts.no_type_prop)
+ return;
+
if (opnd.is_self) {
UPGRADE_TYPE(ctx->self_type, type);
return;
@@ -249,6 +258,10 @@ ctx_set_opnd_mapping(ctx_t *ctx, insn_opnd_t opnd, temp_type_mapping_t type_mapp
RUBY_ASSERT(opnd.idx < ctx->stack_size);
int stack_idx = ctx->stack_size - 1 - opnd.idx;
+ // If type propagation is disabled, store no types
+ if (rb_yjit_opts.no_type_prop)
+ return;
+
// If outside of tracked range, do nothing
if (stack_idx >= MAX_TEMP_TYPES)
return;
@@ -265,6 +278,10 @@ Set the type of a local variable
static void
ctx_set_local_type(ctx_t *ctx, size_t idx, val_type_t type)
{
+ // If type propagation is disabled, store no types
+ if (rb_yjit_opts.no_type_prop)
+ return;
+
if (idx >= MAX_LOCAL_TYPES)
return;