wingo pushed a commit to branch lightning
in repository guile.
commit 95e3fbc8bc674a3d9ab745ae9d0a8ff630016fdf
Author: pcpa <[email protected]>
Date: Sat Sep 14 14:43:05 2013 -0300
Add the new jit_pointer_p predicate interface.
* include/lightning.h, lib/lightning.c: Add the new
jit_pointer_p interface, that returns a boolean value
telling if the pointer argument is inside the jit
code buffer. This is useful to avoid the need to add
extra labels and calls to jit_address to figure bounds
of code buffer, and still keep internal data private.
---
ChangeLog | 9 +++++++++
include/lightning.h | 2 ++
lib/lightning.c | 7 +++++++
3 files changed, 18 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index ec642cc..892de2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-10-14 Paulo Andrade <[email protected]>
+
+ * include/lightning.h, lib/lightning.c: Add the new
+ jit_pointer_p interface, that returns a boolean value
+ telling if the pointer argument is inside the jit
+ code buffer. This is useful to avoid the need to add
+ extra labels and calls to jit_address to figure bounds
+ of code buffer, and still keep internal data private.
+
2013-10-13 Paulo Andrade <[email protected]>
* include/lightning.h, include/lightning/jit_private.h,
diff --git a/include/lightning.h b/include/lightning.h
index 3466c4a..561c559 100644
--- a/include/lightning.h
+++ b/include/lightning.h
@@ -953,6 +953,8 @@ extern jit_node_t *_jit_new_node_pwd(jit_state_t*,
jit_code_t,
#define jit_callee_save_p(u) _jit_callee_save_p(_jit,u)
extern jit_bool_t _jit_callee_save_p(jit_state_t*, jit_int32_t);
+#define jit_pointer_p(u) _jit_pointer_p(_jit,u)
+extern jit_bool_t _jit_pointer_p(jit_state_t*,jit_pointer_t);
#define jit_get_note(n,u,v,w) _jit_get_note(_jit,n,u,v,w)
extern jit_bool_t _jit_get_note(jit_state_t*,jit_pointer_t,char**,char**,int*);
diff --git a/lib/lightning.c b/lib/lightning.c
index 58e7130..817976c 100644
--- a/lib/lightning.c
+++ b/lib/lightning.c
@@ -337,6 +337,13 @@ _jit_callee_save_p(jit_state_t *_jit, jit_int32_t regno)
return (!!(_rvs[regno].spec & jit_class_sav));
}
+extern jit_bool_t
+_jit_pointer_p(jit_state_t *_jit, jit_pointer_t address)
+{
+ return ((jit_uint8_t *)address >= _jit->code.ptr &&
+ (jit_word_t)address < _jit->pc.w);
+}
+
#if __ia64__
void
jit_regset_com(jit_regset_t *u, jit_regset_t *v)