summaryrefslogtreecommitdiff
path: root/yjit_core.h
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2021-10-01 18:38:39 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:42 -0400
commitf6da559d5b88981000d4c575b6384f59d30dec22 (patch)
tree00fab354584931dd6f88dc275c26260c17259379 /yjit_core.h
parent25eed2848344f19385b39daaac8ca5eef79f9466 (diff)
Put YJIT into a single compilation unit
For upstreaming, we want functions we export either prefixed with "rb_" or made static. Historically we haven't been following this rule, so we were "leaking" a lot of symbols as `make leak-globals` would tell us. This change unifies everything YJIT into a single compilation unit, yjit.o, and makes everything unprefixed static to pass `make leak-globals`. This manual "unified build" setup is similar to that of vm.o. Having everything in one compilation unit allows static functions to be visible across YJIT files and removes the need for declarations in headers in some cases. Unnecessary declarations were removed. Other changes of note: - switched to MJIT_SYMBOL_EXPORT_BEGIN which indicates stuff as being off limits for native extensions - the first include of each YJIT file is change to be "internal.h" - undefined MAP_STACK before explicitly redefining it since it collide's with a definition in system headers. Consider renaming?
Diffstat (limited to 'yjit_core.h')
-rw-r--r--yjit_core.h56
1 files changed, 4 insertions, 52 deletions
diff --git a/yjit_core.h b/yjit_core.h
index 7577d030d2..385bf05f29 100644
--- a/yjit_core.h
+++ b/yjit_core.h
@@ -97,7 +97,10 @@ typedef struct yjit_temp_mapping
} temp_mapping_t;
STATIC_ASSERT(temp_mapping_size, sizeof(temp_mapping_t) == 1);
-// By default, temps are just temps on the stack
+// By default, temps are just temps on the stack.
+// Name conflict with an mmap flag. This is a struct instance,
+// so the compiler will check for wrong usage.
+#undef MAP_STACK
#define MAP_STACK ( (temp_mapping_t) { 0 } )
// Temp value is actually self
@@ -300,55 +303,4 @@ typedef struct JITState
} jitstate_t;
-// Context object methods
-x86opnd_t ctx_sp_opnd(ctx_t* ctx, int32_t offset_bytes);
-x86opnd_t ctx_stack_push_mapping(ctx_t* ctx, temp_type_mapping_t mapping);
-x86opnd_t ctx_stack_push(ctx_t* ctx, val_type_t type);
-x86opnd_t ctx_stack_push_self(ctx_t* ctx);
-x86opnd_t ctx_stack_push_local(ctx_t* ctx, size_t local_idx);
-x86opnd_t ctx_stack_pop(ctx_t* ctx, size_t n);
-x86opnd_t ctx_stack_opnd(ctx_t* ctx, int32_t idx);
-val_type_t ctx_get_opnd_type(const ctx_t* ctx, insn_opnd_t opnd);
-void ctx_upgrade_opnd_type(ctx_t* ctx, insn_opnd_t opnd, val_type_t type);
-void ctx_set_local_type(ctx_t* ctx, size_t idx, val_type_t type);
-void ctx_clear_local_types(ctx_t* ctx);
-int ctx_diff(const ctx_t* src, const ctx_t* dst);
-int type_diff(val_type_t src, val_type_t dst);
-val_type_t yjit_type_of_value(VALUE val);
-const char *yjit_type_name(val_type_t type);
-
-temp_type_mapping_t ctx_get_opnd_mapping(const ctx_t* ctx, insn_opnd_t opnd);
-void ctx_set_opnd_mapping(ctx_t* ctx, insn_opnd_t opnd, temp_type_mapping_t type_mapping);
-
-block_t* find_block_version(blockid_t blockid, const ctx_t* ctx);
-block_t* gen_block_version(blockid_t blockid, const ctx_t* ctx, rb_execution_context_t *ec);
-uint8_t* gen_entry_point(const rb_iseq_t *iseq, uint32_t insn_idx, rb_execution_context_t *ec);
-void yjit_free_block(block_t *block);
-rb_yjit_block_array_t yjit_get_version_array(const rb_iseq_t *iseq, unsigned idx);
-
-void gen_branch(
- jitstate_t* jit,
- const ctx_t* src_ctx,
- blockid_t target0,
- const ctx_t* ctx0,
- blockid_t target1,
- const ctx_t* ctx1,
- branchgen_fn gen_fn
-);
-
-void gen_direct_jump(
- jitstate_t* jit,
- const ctx_t* ctx,
- blockid_t target0
-);
-
-void defer_compilation(
- jitstate_t* jit,
- ctx_t* cur_ctx
-);
-
-void invalidate_block_version(block_t* block);
-
-void yjit_init_core(void);
-
#endif // #ifndef YJIT_CORE_H