[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] libjit/jit jit-apply-arm.h jit-apply-arm.c
From: |
Aleksey Demakov |
Subject: |
[dotgnu-pnet-commits] libjit/jit jit-apply-arm.h jit-apply-arm.c |
Date: |
Sat, 07 Feb 2009 16:15:59 +0000 |
CVSROOT: /sources/dotgnu-pnet
Module name: libjit
Changes by: Aleksey Demakov <avd> 09/02/07 16:15:58
Modified files:
jit : jit-apply-arm.h jit-apply-arm.c
Log message:
integrate mikyt's arm apply patch
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-apply-arm.h?cvsroot=dotgnu-pnet&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-apply-arm.c?cvsroot=dotgnu-pnet&r1=1.3&r2=1.4
Patches:
Index: jit-apply-arm.h
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-apply-arm.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- jit-apply-arm.h 24 Jan 2008 20:12:50 -0000 1.2
+++ jit-apply-arm.h 7 Feb 2009 16:15:58 -0000 1.3
@@ -36,4 +36,39 @@
*/
#define jit_redirector_size 128
+/*
+ * The number of bytes that are needed for a indirector stub.
+ * This includes any extra bytes that are needed for alignment.
+ */
+#define jit_indirector_size 24
+
+/*
+ * We should pad unused code space with NOP's.
+ */
+#define jit_should_pad 1
+
+/*
+ * Defines the alignment for the stack pointer at a public interface.
+ * As of the "Procedure Call Standard for the ARM Architecture" (AAPCS release
2.07)
+ * SP mod 8 = 0
+ * must always be true at every public interface (function calls, etc)
+ */
+#define JIT_SP_ALIGN_PUBLIC 8
+
+/*
+ * Redefine jit_builtin_apply in order to correctly align the stack pointer
+ * to JIT_SP_ALING_PUBLIC bytes before calling __builtin_apply to execute the
+ * jit-compiled function
+ */
+#define jit_builtin_apply(func,args,size,return_float,return_buf)
\
+do { \
+ register void *sp asm("sp"); \
+ while(((unsigned int)sp) % JIT_SP_ALIGN_PUBLIC != 0) \
+ { \
+ sp=(void *)(((unsigned int) sp)+1); \
+ } \
+ (return_buf) = __builtin_apply \
+ ((void (*)())(func), (args), (size)); \
+} while (0)
+
#endif /* _JIT_APPLY_ARM_H */
Index: jit-apply-arm.c
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-apply-arm.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- jit-apply-arm.c 24 Jan 2008 20:12:50 -0000 1.3
+++ jit-apply-arm.c 7 Feb 2009 16:15:58 -0000 1.4
@@ -97,4 +97,47 @@
return (void *)buf;
}
+/**
+ * Creates the indirector, that is the trampoline that permits the Just In
Time
+ * compilation of a method the first time that it is executed and its direct
execution
+ * the following times
+ */
+void *_jit_create_indirector(unsigned char *buf, void **entry)
+{
+ arm_inst_buf inst;
+ void *start = (void *)buf;
+
+ /* Initialize the instruction buffer */
+ arm_inst_buf_init(inst, buf, buf + jit_indirector_size);
+
+ //Load the content of memory at address "entry", that is, the entry
point of the function
+ arm_mov_reg_imm(inst,ARM_WORK,entry);
+ arm_mov_reg_membase(inst,ARM_WORK,ARM_WORK,0,4);
+
+ /* Jump to the entry point. */
+ arm_mov_reg_reg(inst, ARM_PC, ARM_WORK);
+
+ /* Flush the cache lines that we just wrote */
+ jit_flush_exec(buf, ((unsigned char *)(inst.current)) - buf);
+
+ return start;
+}
+
+void _jit_pad_buffer(unsigned char *buf, int len)
+{
+ arm_inst_buf inst;
+
+ /* Initialize the instruction buffer */
+ arm_inst_buf_init(inst, buf, buf + len*4);
+ while(len > 0)
+ {
+ /* Traditional arm NOP */
+ arm_nop(inst);
+ --len;
+ }
+
+ /* Flush the cache lines that we just wrote */
+ jit_flush_exec(buf, ((unsigned char *)(inst.current)) - buf);
+}
+
#endif /* arm */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] libjit/jit jit-apply-arm.h jit-apply-arm.c,
Aleksey Demakov <=