On 10/02/2015 03:06 PM, Torvald Riegel wrote:
On Fri, 2015-10-02 at 14:13 -0400, Jason Merrill wrote:
The patch also doesn't attempt to do anything about the library.  The
second patch sets transaction_safe on various built-ins, but without the
library support this just means references to undefined symbols.

For some of the builtins, we already have functions in the libitm ABI:
malloc and free, memcpy, memmove, memset.  See libitm/libitm.h.  Can you
transform those same as is already done for the respective C functions?

Ah, I hadn't been aware of the existing transformation via find_tm_replacement_function. If we're doing that, maybe we don't need to mess with these builtins.

Other builtins should probably just transaction_pure: abort, I believe,
and I guess the math functions too (although I haven't thought about FP
exceptions at all so far).

Some math functions can set errno and check the global rounding mode, so I think they'll need some special handling. I agree that the ones that aren't using ATTR_MATHFN_* can probably be marked transaction_pure.

For other builtins, I guess we should either map them to the
transactional variants of the respective C functions if we support those
already (but the builtins might not change errno whether the C functions
might do), or extend the libitm ABI with more _ITM_ functions.
If we just need the builtins for libstdc++, just making the builtins
tm_safe might be easier.

Thoughts?

I'm thinking about the built-ins mostly for their effect on other declarations of the functions; marking builtin abort as tm_pure means that a user declaration of abort is also considered tm_pure. I'm not thinking so much about calls to __builtin_*.

The
third patch is a beginning of libstdc++ support, which may or may not be
useful to Jonathan or Torvald in completing that support.

I'd at least need guidance from Jon how to best integrate the
annotations, and how to best ship transaction variants in libstdc++ (eg,
do they go into a separate library because of TS vs. libstdc++?)
I can add transactional versions for anything that the compiler doesn't
take care of when provided with the source code.  But I think those
cases should be rather rare.

I agree, I was thinking that the main bits left are some SFINAE trickery for functions that say they are transaction_safe if the operations they call are also transaction_safe, and Makefile tweaks to build any necessary bits with -fgnu-tm.

Jason

Reply via email to