guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 01/05: Expose API to bless function pointers


From: Andy Wingo
Subject: [Guile-commits] 01/05: Expose API to bless function pointers
Date: Tue, 21 May 2019 08:21:51 -0400 (EDT)

wingo pushed a commit to branch master
in repository guile.

commit 0518651bfda2f54af3c8fff8274acc7037420bf1
Author: Andy Wingo <address@hidden>
Date:   Tue May 21 14:00:04 2019 +0200

    Expose API to bless function pointers
    
    On ARMv7, we need to set the low bit to indicate that we're in
    thumb-land.
---
 lightening.h            | 2 ++
 lightening/lightening.c | 8 +++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lightening.h b/lightening.h
index 23635a0..32e3e3a 100644
--- a/lightening.h
+++ b/lightening.h
@@ -218,6 +218,8 @@ JIT_API void* jit_end(jit_state_t*, size_t*);
 JIT_API void jit_align(jit_state_t*, unsigned);
 
 JIT_API jit_pointer_t jit_address(jit_state_t*);
+typedef void (*jit_function_pointer_t)();
+JIT_API jit_function_pointer_t jit_address_to_function_pointer(jit_pointer_t);
 JIT_API void jit_patch_here(jit_state_t*, jit_reloc_t);
 JIT_API void jit_patch_there(jit_state_t*, jit_reloc_t, jit_pointer_t);
 
diff --git a/lightening/lightening.c b/lightening/lightening.c
index 97bf294..6d6d5ee 100644
--- a/lightening/lightening.c
+++ b/lightening/lightening.c
@@ -206,6 +206,12 @@ jit_reset(jit_state_t *_jit)
 #endif
 }
 
+jit_function_pointer_t
+jit_address_to_function_pointer(jit_pointer_t p)
+{
+  return bless_function_pointer(p);
+}
+
 void*
 jit_end(jit_state_t *_jit, size_t *length)
 {
@@ -237,7 +243,7 @@ jit_end(jit_state_t *_jit, size_t *length)
   clear_literal_pool(_jit->pool);
 #endif
 
-  return bless_function_pointer(start);
+  return jit_address_to_function_pointer(start);
 }
 
 static int



reply via email to

[Prev in Thread] Current Thread [Next in Thread]