Skip to content

Commit

Permalink
RJIT: Fix -Wshorten-64-to-32
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Mar 13, 2023
1 parent 45fdc18 commit 07d3af2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rjit_c.c
Expand Up @@ -239,7 +239,7 @@ rjit_record_exit_stack(const VALUE *exit_pc)

// If yjit_raw_samples is less than or equal to the current length of the samples
// we might have seen this stack trace previously.
int prev_stack_len_index = RARRAY_LEN(rb_rjit_raw_samples) - samples_length;
int prev_stack_len_index = (int)RARRAY_LEN(rb_rjit_raw_samples) - samples_length;
VALUE prev_stack_len_obj;
if (RARRAY_LEN(rb_rjit_raw_samples) >= samples_length && FIXNUM_P(prev_stack_len_obj = RARRAY_AREF(rb_rjit_raw_samples, prev_stack_len_index))) {
int prev_stack_len = NUM2INT(prev_stack_len_obj);
Expand Down Expand Up @@ -268,7 +268,7 @@ rjit_record_exit_stack(const VALUE *exit_pc)

// If we know we've seen this stack before, increment the counter by 1.
if (seen_already) {
int prev_idx = RARRAY_LEN(rb_rjit_raw_samples) - 1;
int prev_idx = (int)RARRAY_LEN(rb_rjit_raw_samples) - 1;
int prev_count = NUM2INT(RARRAY_AREF(rb_rjit_raw_samples, prev_idx));
int new_count = prev_count + 1;

Expand Down Expand Up @@ -299,7 +299,7 @@ rjit_record_exit_stack(const VALUE *exit_pc)

// Push the current line onto the yjit_line_samples Vec. This
// points to the line in insns.def.
int line = RARRAY_LEN(rb_rjit_line_samples) - 1;
int line = (int)RARRAY_LEN(rb_rjit_line_samples) - 1;
rb_ary_push(rb_rjit_line_samples, INT2NUM(line));

// Push number of times seen onto the stack, which is 1
Expand Down Expand Up @@ -350,7 +350,7 @@ rjit_add_frame(VALUE hash, VALUE frame)
static VALUE
rjit_exit_traces(void)
{
int samples_len = RARRAY_LEN(rb_rjit_raw_samples);
int samples_len = (int)RARRAY_LEN(rb_rjit_raw_samples);
RUBY_ASSERT(samples_len == RARRAY_LEN(rb_rjit_line_samples));

VALUE result = rb_hash_new();
Expand Down

0 comments on commit 07d3af2

Please sign in to comment.