summaryrefslogtreecommitdiff
path: root/yjit_codegen.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_codegen.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_codegen.h')
-rw-r--r--yjit_codegen.h14
1 files changed, 3 insertions, 11 deletions
diff --git a/yjit_codegen.h b/yjit_codegen.h
index cbb3640dea..1e87c85393 100644
--- a/yjit_codegen.h
+++ b/yjit_codegen.h
@@ -1,14 +1,6 @@
#ifndef YJIT_CODEGEN_H
#define YJIT_CODEGEN_H 1
-#include "stddef.h"
-#include "yjit_core.h"
-
-// Code blocks we generate code into
-extern codeblock_t *cb;
-extern codeblock_t *ocb;
-extern uint32_t yjit_codepage_frozen_bytes;
-
typedef enum codegen_status {
YJIT_END_BLOCK,
YJIT_KEEP_COMPILING,
@@ -18,10 +10,10 @@ typedef enum codegen_status {
// Code generation function signature
typedef codegen_status_t (*codegen_fn)(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb);
-uint8_t *yjit_entry_prologue(codeblock_t *cb, const rb_iseq_t *iseq);
+static uint8_t *yjit_entry_prologue(codeblock_t *cb, const rb_iseq_t *iseq);
-void yjit_gen_block(block_t *block, rb_execution_context_t *ec);
+static void yjit_gen_block(block_t *block, rb_execution_context_t *ec);
-void yjit_init_codegen(void);
+static void yjit_init_codegen(void);
#endif // #ifndef YJIT_CODEGEN_H