1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Add rb_darray_clear() for Kevin. Fix some warnings.

This commit is contained in:
Maxime Chevalier-Boisvert 2021-09-09 15:35:47 -04:00 committed by Alan Wu
parent f380856923
commit 11599e5e1e
2 changed files with 7 additions and 1 deletions

View file

@ -84,6 +84,11 @@
//
#define rb_darray_make(ptr_to_ary, size) rb_darray_make_impl((ptr_to_ary), size, sizeof(**(ptr_to_ary)), sizeof((*(ptr_to_ary))->data[0]))
// Set the size of the array to zero without freeing the backing memory.
// Allows reusing the same array.
//
#define rb_darray_clear(ary) (ary->meta.size = 0)
typedef struct rb_darray_meta {
int32_t size;
int32_t capa;

View file

@ -142,6 +142,7 @@ jit_peek_at_self(jitstate_t *jit, ctx_t *ctx)
return jit->ec->cfp->self;
}
RBIMPL_ATTR_MAYBE_UNUSED()
static VALUE
jit_peek_at_local(jitstate_t *jit, ctx_t *ctx, int n)
{
@ -986,7 +987,7 @@ gen_expandarray(jitstate_t* jit, ctx_t* ctx)
// num is the number of requested values. If there aren't enough in the
// array then we're going to push on nils.
rb_num_t num = (rb_num_t) jit_get_arg(jit, 0);
int num = (int)jit_get_arg(jit, 0);
val_type_t array_type = ctx_get_opnd_type(ctx, OPND_STACK(0));
x86opnd_t array_opnd = ctx_stack_pop(ctx, 1);