Skip to content

Commit

Permalink
Use rb_darray_make in ujit
Browse files Browse the repository at this point in the history
  • Loading branch information
XrXr committed Feb 17, 2021
1 parent 693cf67 commit 07b4567
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ujit_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,12 @@ add_block_version(blockid_t blockid, block_t* block)
// Ensure ujit_blocks is initialized for this iseq
if (rb_darray_size(body->ujit_blocks) == 0) {
// Initialize ujit_blocks to be as wide as body->iseq_encoded
// TODO: add resize API for dary
while ((unsigned)rb_darray_size(body->ujit_blocks) < body->iseq_size) {
(void)rb_darray_append(&body->ujit_blocks, NULL);
int32_t casted = (int32_t)body->iseq_size;
if ((unsigned)casted != body->iseq_size) {
rb_bug("iseq too large");
}
if (!rb_darray_make(&body->ujit_blocks, casted)) {
rb_bug("allocation failed");
}

// First block compiled for this iseq
Expand Down

0 comments on commit 07b4567

Please sign in to comment.