[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GCC_JIT_BINARY_OP_LOGICAL_AND eager or lazy? and GCCJIT vs GNU C semantics....



Hello David and list,

I a a bit confused by the document.... Is

GCC_JIT_BINARY_OP_LOGICAL_AND a lazy operation like in C, or is it eager? It is documented as

   Logical AND; analogous to:

   (EXPR_A)  &&  (EXPR_B)

   in C.

So I guess that it is lazy. In other words, if EXPR_A is non-null, EXPR_B is not even evaluated....

But I am not sure.... Perhaps we should state the laziness in the documentation.

Also, do we have a ternary conditional operator, like Cond?Then:Else in C? Apparently not and that surprises me if GCC_JIT_BINARY_OP_LOGICAL_AND is lazy like && is in C.

At last, do we have a comma operator?

Or do we have a statement-expr like thing? https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html

All these could be useful in a Scheme like client (for BEGIN in Scheme, or PROGN in Lisp) using GCCJIT. Of course, this can be avoided by forcing the GCCJIT client to emit much lower-level things. But in that case, we should not even admit a function call as a gcc_jit_rvalue... (and restrict function calls to be the last statement of basic blocks).

My implicit feeling (but I might be very wrong) is that everything which is expressible in GNU C (this includes most GCC language extension of C) for GCC should be easily (and "naturally") done in GCCJIT, but perhaps I don't understand the philosophy of GCCJIT yet.... I'm implicitly wishing that the semantics of programs built with GCCJIT would be very close to the semantics of GCC GNU C language (i.e. gcc -std=gnuc11....) Then, it might be the case that we don't have any way to declare a thread local variable, or atomic variables....

Cheers.

--
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***