From 24b4d09394561b23f88c11741236fa43c5d7112d Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sun, 2 Sep 2018 21:56:36 +0200 Subject: [PATCH] Improve compute_mcode allocation logic * libguile/jit.c (compute_mcode): Move up some assertions before using them to allocate. --- libguile/jit.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libguile/jit.c b/libguile/jit.c index 469f85bf9..57a634ebe 100644 --- a/libguile/jit.c +++ b/libguile/jit.c @@ -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; /* ? */