[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 02/03: Improve compute_mcode allocation logic
From: |
Andy Wingo |
Subject: |
[Guile-commits] 02/03: Improve compute_mcode allocation logic |
Date: |
Mon, 3 Sep 2018 12:32:13 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit 24b4d09394561b23f88c11741236fa43c5d7112d
Author: Andy Wingo <address@hidden>
Date: Sun Sep 2 21:56:36 2018 +0200
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 469f85b..57a634e 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; /* ? */