1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/yjit_iface.h
Alan Wu f6da559d5b 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?
2021-10-20 18:19:42 -04:00

36 lines
1.1 KiB
C

//
// These are definitions YJIT uses to interface with the CRuby codebase,
// but which are only used internally by YJIT.
//
#ifndef YJIT_IFACE_H
#define YJIT_IFACE_H 1
#include "ruby/internal/config.h"
#include "ruby_assert.h" // for RUBY_DEBUG
#include "yjit.h" // for YJIT_STATS
#include "vm_core.h"
#include "yjit_core.h"
#ifndef YJIT_DEFAULT_CALL_THRESHOLD
# define YJIT_DEFAULT_CALL_THRESHOLD 10
#endif
RUBY_EXTERN struct rb_yjit_options rb_yjit_opts;
static VALUE *yjit_iseq_pc_at_idx(const rb_iseq_t *iseq, uint32_t insn_idx);
static int yjit_opcode_at_pc(const rb_iseq_t *iseq, const VALUE *pc);
static void yjit_print_iseq(const rb_iseq_t *iseq);
// this function *must* return passed exit_pc
static const VALUE *yjit_count_side_exit_op(const VALUE *exit_pc);
static void yjit_unlink_method_lookup_dependency(block_t *block);
static void yjit_block_assumptions_free(block_t *block);
VALUE rb_yjit_code_page_alloc(void);
code_page_t *rb_yjit_code_page_unwrap(VALUE cp_obj);
void rb_yjit_get_cb(codeblock_t *cb, uint8_t *code_ptr);
void rb_yjit_get_ocb(codeblock_t *cb, uint8_t *code_ptr);
#endif // #ifndef YJIT_IFACE_H