public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Daney <ddaney@avtrex.com>
To: gcc-patches@gcc.gnu.org, java-patches@gcc.gnu.org
Subject: Re: [Patch] 3/3 FFI: Use __builtin_flush_icache() to flush MIPS i-cache.
Date: Thu, 05 Jul 2007 08:34:00 -0000	[thread overview]
Message-ID: <468CA0EA.5010905@avtrex.com> (raw)
In-Reply-To: <4687370E.7090801@avtrex.com>

[-- 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;
 }

  reply	other threads:[~2007-07-05  7:43 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-01  5:01 [Patch] 1/3 Add new builtin __builtin_flush_icache() David Daney
2007-07-01  5:05 ` [Patch] 2/3 MIPS support for " David Daney
2007-07-01 10:56   ` Richard Sandiford
2007-07-05  7:50     ` David Daney
2007-07-05 19:05       ` Richard Sandiford
2007-07-08 20:00         ` David Daney
2007-07-09 19:07           ` Richard Sandiford
2007-07-11  5:45             ` David Daney
2007-07-01  5:11 ` [Patch] 3/3 FFI: Use __builtin_flush_icache() to flush MIPS i-cache David Daney
2007-07-05  8:34   ` David Daney [this message]
2007-07-05 19:08     ` Richard Sandiford
2007-07-11 18:55       ` Tom Tromey
2007-07-01  8:01 ` [Patch] 1/3 Add new builtin __builtin_flush_icache() Paolo Bonzini
2007-07-01 17:51   ` Thiemo Seufer
2007-07-01 18:47   ` David Daney
2007-07-02  5:04     ` Paolo Bonzini
2007-07-03 23:55       ` Mark Mitchell
2007-07-04  7:18         ` Paolo Bonzini
2007-07-04 17:17           ` Mark Mitchell
2007-07-04 17:10         ` David Daney
2007-07-04 17:51           ` Mark Mitchell
2007-07-05  7:36             ` David Daney
2007-07-05 17:59               ` Richard Sandiford
2007-07-05 18:23                 ` David Daney
2007-07-05 19:11                   ` Richard Sandiford
2007-07-06  6:07               ` Mark Mitchell
2007-07-06  6:19                 ` David Daney
2007-07-06 16:39                   ` Mark Mitchell
2007-07-08 19:22                     ` David Daney
2007-07-09 19:04                       ` Richard Sandiford
2007-07-11  2:22                       ` Mark Mitchell
2007-07-11  4:47                         ` David Daney
2007-07-05  9:05 ` [Patch] 4/3 i386 target support for __builtin___clear_cache() David Daney
2007-07-08 20:39   ` David Daney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=468CA0EA.5010905@avtrex.com \
    --to=ddaney@avtrex.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=java-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).