[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] libjit ChangeLog jit/jit-internal.h jit/jit-fun...
From: |
Aleksey Demakov |
Subject: |
[dotgnu-pnet-commits] libjit ChangeLog jit/jit-internal.h jit/jit-fun... |
Date: |
Tue, 22 Aug 2006 20:55:31 +0000 |
CVSROOT: /sources/dotgnu-pnet
Module name: libjit
Changes by: Aleksey Demakov <avd> 06/08/22 20:55:31
Modified files:
. : ChangeLog
jit : jit-internal.h jit-function.c jit-rules-x86.c
Log message:
allocate redirector and indirector buffers in the executable code cache
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libjit/ChangeLog?cvsroot=dotgnu-pnet&r1=1.254&r2=1.255
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-internal.h?cvsroot=dotgnu-pnet&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-function.c?cvsroot=dotgnu-pnet&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-rules-x86.c?cvsroot=dotgnu-pnet&r1=1.36&r2=1.37
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/ChangeLog,v
retrieving revision 1.254
retrieving revision 1.255
diff -u -b -r1.254 -r1.255
--- ChangeLog 22 Aug 2006 18:02:55 -0000 1.254
+++ ChangeLog 22 Aug 2006 20:55:25 -0000 1.255
@@ -1,11 +1,13 @@
-2006-08-22 Klaus treichel <address@hidden>
-
- * jit/jit-alloc.c: Use mmap and munmap to allocate executable memory
- where available because memory allocated with malloc is not executable
- on some archs/distros.
-
2006-08-23 Aleksey Demakov <address@hidden>
+ * jit/jit-internal.h (struct _jit_function): change the type of
+ redirector and indirector fields from char array to pointer.
+ * jit/jit-function.c (jit_function_create): allocate the redirector
+ and indirector buffers in the code cache. Call jit_flush_exec on
+ these buffers.
+ * jit/jit-rules-x86.c (_jit_gen_redirector): ifdef out as this
+ function is not used with the x86 backend.
+
* jit/jit-reg-alloc.c: improve handling of three-address op codes.
Now the dest register may re-use one of the input registers while
previously it was always assigned to a separate register. Also
@@ -17,6 +19,12 @@
ops for x86 as three-address. Adjust IREM ops so that they work
correctly together with the latest allocator changes.
+2006-08-22 Klaus Treichel <address@hidden>
+
+ * jit/jit-alloc.c: Use mmap and munmap to allocate executable memory
+ where available because memory allocated with malloc is not executable
+ on some archs/distros.
+
2006-08-21 Thomas Cort <address@hidden>
* jit/jit-rules-alpha.c jit/jit-gen-alpha.h: Add macros for
int to fp and fp to int conversions. Use _jit_pad_bufer.
Index: jit/jit-internal.h
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-internal.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- jit/jit-internal.h 14 Aug 2006 19:21:19 -0000 1.24
+++ jit/jit-internal.h 22 Aug 2006 20:55:31 -0000 1.25
@@ -401,13 +401,13 @@
#ifdef jit_redirector_size
/* Buffer that contains the redirector for this function.
Redirectors are used to support on-demand compilation */
- unsigned char redirector[jit_redirector_size];
+ unsigned char *redirector;
#endif
#ifdef jit_indirector_size
/* Buffer that contains the indirector for this function.
The indirector is used to jump either to the function
redirector or the compiled function itself. */
- unsigned char indirector[jit_indirector_size];
+ unsigned char *indirector;
#endif
};
Index: jit/jit-function.c
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-function.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- jit/jit-function.c 3 Jun 2006 13:39:53 -0000 1.20
+++ jit/jit-function.c 22 Aug 2006 20:55:31 -0000 1.21
@@ -46,6 +46,9 @@
jit_function_t jit_function_create(jit_context_t context, jit_type_t signature)
{
jit_function_t func;
+#if defined(jit_redirector_size) || defined(jit_indirector_size)
+ jit_cache_t cache;
+#endif
/* Allocate memory for the function and clear it */
func = jit_cnew(struct _jit_function);
@@ -54,6 +57,46 @@
return 0;
}
+#if defined(jit_redirector_size) || defined(jit_indirector_size)
+ /* TODO: if the function is destroyed the redirector and indirector
memory
+ is leaked */
+
+ /* We need the cache lock while we are allocating redirector and
indirector */
+ jit_mutex_lock(&(context->cache_lock));
+
+ /* Get the method cache */
+ cache = _jit_context_get_cache(context);
+ if(!cache)
+ {
+ jit_mutex_unlock(&(context->cache_lock));
+ jit_free(func);
+ return 0;
+ }
+
+# if defined(jit_redirector_size)
+ /* Allocate redirector buffer */
+ func->redirector = _jit_cache_alloc_no_method(cache,
jit_redirector_size, 1);
+ if(!func->redirector)
+ {
+ jit_mutex_unlock(&(context->cache_lock));
+ jit_free(func);
+ return 0;
+ }
+# endif
+# if defined(jit_indirector_size)
+ /* Allocate indirector buffer */
+ func->indirector = _jit_cache_alloc_no_method(cache,
jit_indirector_size, 1);
+ if(!func->indirector)
+ {
+ jit_mutex_unlock(&(context->cache_lock));
+ jit_free(func);
+ return 0;
+ }
+# endif
+
+ jit_mutex_unlock(&(context->cache_lock));
+#endif
+
/* Initialize the function block */
func->context = context;
func->signature = jit_type_copy(signature);
@@ -65,9 +108,11 @@
func->entry_point = _jit_create_redirector
(func->redirector, (void *)_jit_function_compile_on_demand,
func, jit_type_get_abi(signature));
+ jit_flush_exec(func->redirector, jit_redirector_size);
# if defined(jit_indirector_size)
func->closure_entry = _jit_create_indirector
(func->indirector, (void**) &(func->entry_point));
+ jit_flush_exec(func->indirector, jit_indirector_size);
# else
func->closure_entry = func->entry_point;
# endif
Index: jit/jit-rules-x86.c
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-rules-x86.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- jit/jit-rules-x86.c 2 Jul 2006 23:01:24 -0000 1.36
+++ jit/jit-rules-x86.c 22 Aug 2006 20:55:31 -0000 1.37
@@ -377,6 +377,11 @@
gen->posn.ptr = inst;
}
+#if 0
+/*
+ * The x86 backend does not need this function because it uses
+ * _jit_create_indirector() instead.
+ */
void *_jit_gen_redirector(jit_gencode_t gen, jit_function_t func)
{
void *ptr, *entry;
@@ -390,6 +395,7 @@
x86_jump_mem(gen->posn.ptr, ptr);
return entry;
}
+#endif
/*
* Setup or teardown the x86 code output process.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] libjit ChangeLog jit/jit-internal.h jit/jit-fun...,
Aleksey Demakov <=