On Wed, Oct 10, 2012 at 10:11:54AM -0700, Richard Henderson wrote:
> On 10/09/2012 12:56 PM, Aurelien Jarno wrote:
> > +                    if (!(call_flags & (TCG_CALL_NO_WRITE_GLOBALS |
> > +                                        TCG_CALL_NO_READ_GLOBALS))) {
> 
> Code like this would be shorter, and perhaps clearer, by
> 
> > +/* Helper does not read globals (either directly or through an exception). 
> > It
> > +   implies TCG_CALL_NO_WRITE_GLOBALS. */
> > +#define TCG_CALL_NO_READ_GLOBALS    0x0010
> > +/* Helper does not write globals */
> > +#define TCG_CALL_NO_WRITE_GLOBALS   0x0020
> 
> having RG actually include WG, i.e.
> 
> #define TCG_CALL_NO_READ_GLOBALS  0x0030
> 

Agreed. On the other hand, the few lines just above the one your quoted
would be more complicated:

+                    if (!(call_flags & TCG_CALL_NO_READ_GLOBALS)) {
+                        /* globals should be synced to memory */
+                        memset(mem_temps, 1, s->nb_globals);
+                    }

would have to be written:

+                    if (!(call_flags & TCG_CALL_NO_READ_WRITE_GLOBALS) ||
+                        (call_flags & TCG_CALL_WRITE_GLOBALS)) {
+                        /* globals should be synced to memory */
+                        memset(mem_temps, 1, s->nb_globals);
+                    }

Note sure it makes the things clearer, and definitely not shorter.

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurel...@aurel32.net                 http://www.aurel32.net

Reply via email to