public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch] 3/3 FFI: Use __builtin_flush_icache() to flush MIPS i-cache.
       [not found] <468734D3.3020908@avtrex.com>
@ 2007-07-01  5:11 ` David Daney
  2007-07-05  7:43   ` David Daney
  0 siblings, 1 reply; 4+ messages in thread
From: David Daney @ 2007-07-01  5:11 UTC (permalink / raw)
  To: gcc-patches, java-patches

[-- Attachment #1: Type: text/plain, Size: 847 bytes --]

This is the third and final part of the __builtin_flush_icache patch.
It replaces the hard coded library call to cacheflush() in the MIPS
ffi_prep_closure_loc with a call to __builtin_flush_icache();

For targets that support user-space i-cache flushing (mips32r2), this
will eliminate a system call from the ffi closure preparation path.
On all other targets the generated code is the same as before.

Bootstrapped and tested on x86_64-unknown-linux-gnu all default
languages with no regressions.

Also tested on:
 x86_64 cross to mipsel-linux --with-arch=mips32
 i686   cross to mipsel-linux --with-arch=mips32r2

with no regressions.

OK to commit?

libffi/:
2007-06-30  David Daney  <ddaney@avtrex.com>

    * src/mips/ffi.c: Don't include sys/cachectl.h.
    (ffi_prep_closure_loc): Use __builtin_flush_icache() instead of
    cacheflush().


[-- Attachment #2: flush-cache3.diff --]
[-- Type: text/x-patch, Size: 617 bytes --]

Index: src/mips/ffi.c
===================================================================
--- src/mips/ffi.c	(revision 125997)
+++ src/mips/ffi.c	(working copy)
@@ -27,7 +27,6 @@
 #include <ffi_common.h>
 
 #include <stdlib.h>
-#include <sys/cachectl.h>
 
 #if _MIPS_SIM == _ABIN32
 #define FIX_ARGP \
@@ -525,8 +524,7 @@ ffi_prep_closure_loc (ffi_closure *closu
   closure->fun = fun;
   closure->user_data = user_data;
 
-  /* XXX this is available on Linux, but anything else? */
-  cacheflush (codeloc, FFI_TRAMPOLINE_SIZE, ICACHE);
+  __builtin_flush_icache(codeloc, FFI_TRAMPOLINE_SIZE);
 
   return FFI_OK;
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch] 3/3 FFI: Use __builtin_flush_icache() to flush MIPS i-cache.
  2007-07-01  5:11 ` [Patch] 3/3 FFI: Use __builtin_flush_icache() to flush MIPS i-cache David Daney
@ 2007-07-05  7:43   ` David Daney
  2007-07-05 18:54     ` Richard Sandiford
  0 siblings, 1 reply; 4+ messages in thread
From: David Daney @ 2007-07-05  7:43 UTC (permalink / raw)
  To: gcc-patches, java-patches

[-- Attachment #1: Type: text/plain, Size: 1016 bytes --]

David Daney wrote:
> This is the third and final part of the __builtin_flush_icache patch.
> It replaces the hard coded library call to cacheflush() in the MIPS
> ffi_prep_closure_loc with a call to __builtin_flush_icache();
>
> For targets that support user-space i-cache flushing (mips32r2), this
> will eliminate a system call from the ffi closure preparation path.
> On all other targets the generated code is the same as before.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu all default
> languages with no regressions.
>
> Also tested on:
> x86_64 cross to mipsel-linux --with-arch=mips32
> i686   cross to mipsel-linux --with-arch=mips32r2
>
> with no regressions.
A new version of the patch.  All that changed is the name of the 
builtin.  It is now __builtin___clear_cache().

Tested as before.

OK to commit:

2007-07-04  David Daney  <ddaney@avtrex.com>

    * src/mips/ffi.c: Don't include sys/cachectl.h.
    (ffi_prep_closure_loc): Use __builtin___clear_cache() instead of
    cacheflush().


[-- Attachment #2: flush-cache3.diff --]
[-- Type: text/x-patch, Size: 974 bytes --]

Index: src/mips/ffi.c
===================================================================
--- src/mips/ffi.c	(revision 125997)
+++ src/mips/ffi.c	(working copy)
@@ -27,7 +27,6 @@
 #include <ffi_common.h>
 
 #include <stdlib.h>
-#include <sys/cachectl.h>
 
 #if _MIPS_SIM == _ABIN32
 #define FIX_ARGP \
@@ -506,6 +505,7 @@ ffi_prep_closure_loc (ffi_closure *closu
   unsigned int *tramp = (unsigned int *) &closure->tramp[0];
   unsigned int fn;
   unsigned int ctx = (unsigned int) codeloc;
+  char *clear_location = (char *) codeloc;
 
 #if defined(FFI_MIPS_O32)
   FFI_ASSERT(cif->abi == FFI_O32 || cif->abi == FFI_O32_SOFT_FLOAT);
@@ -525,8 +525,7 @@ ffi_prep_closure_loc (ffi_closure *closu
   closure->fun = fun;
   closure->user_data = user_data;
 
-  /* XXX this is available on Linux, but anything else? */
-  cacheflush (codeloc, FFI_TRAMPOLINE_SIZE, ICACHE);
+  __builtin___clear_cache(clear_location, clear_location + FFI_TRAMPOLINE_SIZE);
 
   return FFI_OK;
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch] 3/3 FFI: Use __builtin_flush_icache() to flush MIPS i-cache.
  2007-07-05  7:43   ` David Daney
@ 2007-07-05 18:54     ` Richard Sandiford
  2007-07-11 18:12       ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Sandiford @ 2007-07-05 18:54 UTC (permalink / raw)
  To: David Daney; +Cc: gcc-patches, java-patches

David Daney <ddaney@avtrex.com> writes:
> A new version of the patch.  All that changed is the name of the 
> builtin.  It is now __builtin___clear_cache().

Assuming this is considered part of the MIPS target...

>     * src/mips/ffi.c: Don't include sys/cachectl.h.
>     (ffi_prep_closure_loc): Use __builtin___clear_cache() instead of
>     cacheflush().

OK, thanks.

Richard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch] 3/3 FFI: Use __builtin_flush_icache() to flush MIPS i-cache.
  2007-07-05 18:54     ` Richard Sandiford
@ 2007-07-11 18:12       ` Tom Tromey
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2007-07-11 18:12 UTC (permalink / raw)
  To: David Daney; +Cc: gcc-patches, java-patches, rsandifo

>>>>> "Richard" == Richard Sandiford <rsandifo@nildram.co.uk> writes:

Richard> David Daney <ddaney@avtrex.com> writes:
>> A new version of the patch.  All that changed is the name of the 
>> builtin.  It is now __builtin___clear_cache().

Richard> Assuming this is considered part of the MIPS target...

Yes, target maintainers can approve patches to the corresponding
libffi port.

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-07-11 18:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <468734D3.3020908@avtrex.com>
2007-07-01  5:11 ` [Patch] 3/3 FFI: Use __builtin_flush_icache() to flush MIPS i-cache David Daney
2007-07-05  7:43   ` David Daney
2007-07-05 18:54     ` Richard Sandiford
2007-07-11 18:12       ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).