RJIT: Make functions in rjit_c.c static

They don't need to be global.
This commit is contained in:
Takashi Kokubun 2023-03-08 23:37:58 -08:00
Родитель 4be224eaf5
Коммит 1a0d3ec4b9
3 изменённых файлов: 28 добавлений и 24 удалений

4
rjit.c
Просмотреть файл

@ -500,6 +500,10 @@ rb_rjit_init(const struct rjit_options *opts)
#endif
}
//
// Primitive for rjit.rb
//
// Same as `RubyVM::RJIT::C.enabled?`, but this is used before rjit_init.
static VALUE
rjit_stats_enabled_p(rb_execution_context_t *ec, VALUE self)

Просмотреть файл

@ -33,14 +33,14 @@
#include <errno.h>
bool
rb_rjit_mark_writable(void *mem_block, uint32_t mem_size)
static bool
rjit_mark_writable(void *mem_block, uint32_t mem_size)
{
return mprotect(mem_block, mem_size, PROT_READ | PROT_WRITE) == 0;
}
void
rb_rjit_mark_executable(void *mem_block, uint32_t mem_size)
static void
rjit_mark_executable(void *mem_block, uint32_t mem_size)
{
// Do not call mprotect when mem_size is zero. Some platforms may return
// an error for it. https://github.com/Shopify/ruby/issues/450
@ -53,16 +53,16 @@ rb_rjit_mark_executable(void *mem_block, uint32_t mem_size)
}
}
VALUE
rb_rjit_optimized_call(VALUE *recv, rb_execution_context_t *ec, int argc, VALUE *argv, int kw_splat, VALUE block_handler)
static VALUE
rjit_optimized_call(VALUE *recv, rb_execution_context_t *ec, int argc, VALUE *argv, int kw_splat, VALUE block_handler)
{
rb_proc_t *proc;
GetProcPtr(recv, proc);
return rb_vm_invoke_proc(ec, proc, argc, argv, kw_splat, block_handler);
}
VALUE
rb_rjit_str_neq_internal(VALUE str1, VALUE str2)
static VALUE
rjit_str_neq_internal(VALUE str1, VALUE str2)
{
return rb_str_eql_internal(str1, str2) == Qtrue ? Qfalse : Qtrue;
}
@ -70,8 +70,8 @@ rb_rjit_str_neq_internal(VALUE str1, VALUE str2)
// The code we generate in gen_send_cfunc() doesn't fire the c_return TracePoint event
// like the interpreter. When tracing for c_return is enabled, we patch the code after
// the C method return to call into this to fire the event.
void
rb_rjit_full_cfunc_return(rb_execution_context_t *ec, VALUE return_value)
static void
rjit_full_cfunc_return(rb_execution_context_t *ec, VALUE return_value)
{
rb_control_frame_t *cfp = ec->cfp;
RUBY_ASSERT_ALWAYS(cfp == GET_EC()->cfp);
@ -97,8 +97,8 @@ rb_rjit_full_cfunc_return(rb_execution_context_t *ec, VALUE return_value)
ec->cfp->sp++;
}
rb_proc_t *
rb_rjit_get_proc_ptr(VALUE procv)
static rb_proc_t *
rjit_get_proc_ptr(VALUE procv)
{
rb_proc_t *proc;
GetProcPtr(procv, proc);

Просмотреть файл

@ -11,16 +11,16 @@ module RubyVM::RJIT # :nodoc: all
#
def rjit_mark_writable
Primitive.cstmt! %{
extern bool rb_rjit_mark_writable(void *mem_block, uint32_t mem_size);
rb_rjit_mark_writable(rb_rjit_mem_block, RJIT_CODE_SIZE);
extern bool rjit_mark_writable(void *mem_block, uint32_t mem_size);
rjit_mark_writable(rb_rjit_mem_block, RJIT_CODE_SIZE);
return Qnil;
}
end
def rjit_mark_executable
Primitive.cstmt! %{
extern void rb_rjit_mark_executable(void *mem_block, uint32_t mem_size);
rb_rjit_mark_executable(rb_rjit_mem_block, RJIT_CODE_SIZE);
extern void rjit_mark_executable(void *mem_block, uint32_t mem_size);
rjit_mark_executable(rb_rjit_mem_block, RJIT_CODE_SIZE);
return Qnil;
}
end
@ -147,8 +147,8 @@ module RubyVM::RJIT # :nodoc: all
def rb_full_cfunc_return
Primitive.cstmt! %{
extern void rb_rjit_full_cfunc_return(rb_execution_context_t *ec, VALUE return_value);
return SIZET2NUM((size_t)rb_rjit_full_cfunc_return);
extern void rjit_full_cfunc_return(rb_execution_context_t *ec, VALUE return_value);
return SIZET2NUM((size_t)rjit_full_cfunc_return);
}
end
@ -177,8 +177,8 @@ module RubyVM::RJIT # :nodoc: all
def rb_str_neq_internal
Primitive.cstmt! %{
extern VALUE rb_rjit_str_neq_internal(VALUE str1, VALUE str2);
return SIZET2NUM((size_t)rb_rjit_str_neq_internal);
extern VALUE rjit_str_neq_internal(VALUE str1, VALUE str2);
return SIZET2NUM((size_t)rjit_str_neq_internal);
}
end
@ -398,8 +398,8 @@ module RubyVM::RJIT # :nodoc: all
def rb_optimized_call
Primitive.cstmt! %{
extern VALUE rb_rjit_optimized_call(VALUE *recv, rb_execution_context_t *ec, int argc, VALUE *argv, int kw_splat, VALUE block_handler);
return SIZET2NUM((size_t)rb_rjit_optimized_call);
extern VALUE rjit_optimized_call(VALUE *recv, rb_execution_context_t *ec, int argc, VALUE *argv, int kw_splat, VALUE block_handler);
return SIZET2NUM((size_t)rjit_optimized_call);
}
end
@ -414,8 +414,8 @@ module RubyVM::RJIT # :nodoc: all
def rb_yjit_get_proc_ptr(proc_addr)
proc_t_addr = Primitive.cstmt! %{
extern rb_proc_t * rb_rjit_get_proc_ptr(VALUE procv);
return SIZET2NUM((size_t)rb_rjit_get_proc_ptr((VALUE)NUM2SIZET(proc_addr)));
extern rb_proc_t * rjit_get_proc_ptr(VALUE procv);
return SIZET2NUM((size_t)rjit_get_proc_ptr((VALUE)NUM2SIZET(proc_addr)));
}
rb_proc_t.new(proc_t_addr)
end