1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 14:00:21 +02:00

Improve compute_mcode allocation logic

* libguile/jit.c (compute_mcode): Move up some assertions before using
  them to allocate.
This commit is contained in:
Andy Wingo 2018-09-02 21:56:36 +02:00
parent 162e313311
commit 24b4d09394

View file

@ -4466,15 +4466,16 @@ compute_mcode (scm_thread *thread, uint32_t *entry_ip,
j->start = (const uint32_t *) (((char *)data) + data->start);
j->end = (const uint32_t *) (((char *)data) + data->end);
j->entry = entry_ip;
j->op_attrs = malloc ((j->end - j->start) * sizeof (*j->op_attrs));
ASSERT (j->op_attrs);
j->labels = malloc ((j->end - j->start) * sizeof (*j->labels));
ASSERT (j->labels);
ASSERT (j->start < j->end);
ASSERT (j->start <= j->entry);
ASSERT (j->entry < j->end);
j->op_attrs = malloc ((j->end - j->start) * sizeof (*j->op_attrs));
ASSERT (j->op_attrs);
j->labels = malloc ((j->end - j->start) * sizeof (*j->labels));
ASSERT (j->labels);
j->frame_size = -1;
j->hooks_enabled = 0; /* ? */