1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ujit_iface.h
Alan Wu 57977ba30d uJIT: Implement opt_getinlinecache
* ujit: implement opt_getinlinecache

Aggressively bet that writes to constants don't happen and invalidate
all opt_getinlinecache blocks on any and all constant writes.

Use alignment padding on block_t to track this assumption. No change to
sizeof(block_t).

* Fix compile warnings when not RUBY_DEBUG
* Fix reversed condition
* Switch to st_table to keep track of assumptions

Co-authored-by: Aaron Patterson <aaron.patterson@gmail.com>
Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
2021-10-20 18:19:30 -04:00

47 lines
1.5 KiB
C

//
// These are definitions uJIT uses to interface with the CRuby codebase,
// but which are only used internally by uJIT.
//
#ifndef UJIT_IFACE_H
#define UJIT_IFACE_H 1
#include "stddef.h"
#include "stdint.h"
#include "stdbool.h"
#include "internal.h"
#include "ruby/internal/attr/nodiscard.h"
#include "vm_core.h"
#include "vm_callinfo.h"
#include "builtin.h"
#include "ujit_core.h"
#ifndef rb_callcache
struct rb_callcache;
#define rb_callcache rb_callcache
#endif
RUBY_EXTERN struct rb_ujit_options rb_ujit_opts;
RUBY_EXTERN int64_t rb_ujit_exec_insns_count;
RUBY_EXTERN int64_t rb_compiled_iseq_count;
void cb_write_pre_call_bytes(codeblock_t* cb);
void cb_write_post_call_bytes(codeblock_t* cb);
void map_addr2insn(void *code_ptr, int insn);
int opcode_at_pc(const rb_iseq_t *iseq, const VALUE *pc);
void check_cfunc_dispatch(VALUE receiver, struct rb_call_data *cd, void *callee, rb_callable_method_entry_t *compile_time_cme);
bool cfunc_needs_frame(const rb_method_cfunc_t *cfunc);
void assume_method_lookup_stable(const struct rb_callcache *cc, const rb_callable_method_entry_t *cme, block_t* block);
RBIMPL_ATTR_NODISCARD() bool assume_single_ractor_mode(block_t *block);
RBIMPL_ATTR_NODISCARD() bool assume_stable_global_constant_state(block_t *block);
// this function *must* return passed exit_pc
const VALUE *rb_ujit_count_side_exit_op(const VALUE *exit_pc);
void ujit_unlink_method_lookup_dependency(block_t *block);
void ujit_block_assumptions_free(block_t *block);
#endif // #ifndef UJIT_IFACE_H