Signed-off-by: Tomek Grabiec <[email protected]>
---
include/lib/buffer.h | 1 +
jit/emit.c | 9 ++-------
lib/buffer.c | 12 +++++++++++-
3 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/include/lib/buffer.h b/include/lib/buffer.h
index 6a59e78..60a3d23 100644
--- a/include/lib/buffer.h
+++ b/include/lib/buffer.h
@@ -23,6 +23,7 @@ struct buffer {
struct buffer_operations *ops;
};
+struct buffer *alloc_exec_buffer(void);
struct buffer *__alloc_buffer(struct buffer_operations *);
struct buffer *alloc_buffer(void);
void free_buffer(struct buffer *);
diff --git a/jit/emit.c b/jit/emit.c
index 1a45a1f..c62f1b5 100644
--- a/jit/emit.c
+++ b/jit/emit.c
@@ -152,11 +152,6 @@ static void emit_resolution_blocks(struct basic_block *bb,
struct buffer *buf)
}
}
-static struct buffer_operations exec_buf_ops = {
- .expand = NULL,
- .free = NULL,
-};
-
int emit_machine_code(struct compilation_unit *cu)
{
unsigned long frame_size;
@@ -164,7 +159,7 @@ int emit_machine_code(struct compilation_unit *cu)
struct buffer *buf;
int err = 0;
- buf = __alloc_buffer(&exec_buf_ops);
+ buf = alloc_exec_buffer();
if (!buf)
return warn("out of memory"), -ENOMEM;
@@ -220,7 +215,7 @@ struct jit_trampoline *alloc_jit_trampoline(void)
memset(trampoline, 0, sizeof(*trampoline));
- trampoline->objcode = __alloc_buffer(&exec_buf_ops);
+ trampoline->objcode = alloc_exec_buffer();
if (!trampoline->objcode)
goto failed;
diff --git a/lib/buffer.c b/lib/buffer.c
index 2e94dc5..1da5257 100644
--- a/lib/buffer.c
+++ b/lib/buffer.c
@@ -10,10 +10,20 @@
#include <stdlib.h>
#include <string.h>
+static struct buffer_operations exec_buf_ops = {
+ .expand = NULL,
+ .free = NULL,
+};
+
+struct buffer *alloc_exec_buffer(void)
+{
+ return __alloc_buffer(&exec_buf_ops);
+}
+
struct buffer *__alloc_buffer(struct buffer_operations *ops)
{
struct buffer *buf;
-
+
buf = malloc(sizeof *buf);
if (!buf)
return NULL;
--
1.6.0.6
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel