mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Move code into ujit_iface.c
This commit is contained in:
parent
e4c65ec49c
commit
f761e9ee64
3 changed files with 20 additions and 5 deletions
|
@ -14,7 +14,6 @@
|
|||
#include "ujit_codegen.h"
|
||||
#include "ujit_asm.h"
|
||||
#include "ujit_utils.h"
|
||||
#include "ujit_hooks.inc"
|
||||
|
||||
// Code generation function signature
|
||||
typedef bool (*codegen_fn)(codeblock_t* cb, codeblock_t* ocb, ctx_t* ctx);
|
||||
|
@ -34,8 +33,7 @@ static codeblock_t* ocb = NULL;
|
|||
static void
|
||||
ujit_gen_entry(codeblock_t* cb)
|
||||
{
|
||||
for (size_t i = 0; i < sizeof(ujit_with_ec_pre_call_bytes); ++i)
|
||||
cb_write_byte(cb, ujit_with_ec_pre_call_bytes[i]);
|
||||
cb_write_pre_call_bytes(cb);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,8 +55,7 @@ ujit_gen_exit(codeblock_t* cb, ctx_t* ctx, VALUE* exit_pc)
|
|||
mov(cb, member_opnd(REG_CFP, rb_control_frame_t, pc), RAX);
|
||||
|
||||
// Write the post call bytes
|
||||
for (size_t i = 0; i < sizeof(ujit_with_ec_post_call_bytes); ++i)
|
||||
cb_write_byte(cb, ujit_with_ec_post_call_bytes[i]);
|
||||
cb_write_post_call_bytes(cb);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
16
ujit_iface.c
16
ujit_iface.c
|
@ -19,6 +19,22 @@ bool rb_ujit_enabled;
|
|||
// Hash table of encoded instructions
|
||||
extern st_table *rb_encoded_insn_data;
|
||||
|
||||
// Write the uJIT entry point pre-call bytes
|
||||
void
|
||||
cb_write_pre_call_bytes(codeblock_t* cb)
|
||||
{
|
||||
for (size_t i = 0; i < sizeof(ujit_with_ec_pre_call_bytes); ++i)
|
||||
cb_write_byte(cb, ujit_with_ec_pre_call_bytes[i]);
|
||||
}
|
||||
|
||||
// Write the uJIT exit post-call bytes
|
||||
void
|
||||
cb_write_post_call_bytes(codeblock_t* cb)
|
||||
{
|
||||
for (size_t i = 0; i < sizeof(ujit_with_ec_post_call_bytes); ++i)
|
||||
cb_write_byte(cb, ujit_with_ec_post_call_bytes[i]);
|
||||
}
|
||||
|
||||
// Keep track of mapping from instructions to generated code
|
||||
// See comment for rb_encoded_insn_data in iseq.c
|
||||
void
|
||||
|
|
|
@ -20,6 +20,8 @@ struct rb_callcache;
|
|||
#define rb_callcache rb_callcache
|
||||
#endif
|
||||
|
||||
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 assume_method_lookup_stable(const struct rb_callcache *cc, const rb_callable_method_entry_t *cme, ctx_t *ctx);
|
||||
|
|
Loading…
Reference in a new issue