What is a legacy function?

What is a legacy function?

Ritratto di jiaq

Arelegacy functions all the functions that are not marked with any annotations? Here is a simple program:

#include 
using namespace std;
int foo(int a){
return a+3;
}
int main()
{
int a=0;
__tm_atomic{
a++;
a=foo(a);
__tm_abort;
}
cout<}

When I compile this program in Windows, it causes error like:


User abort function is called inside an irrevocable transaction


So it seems it applies the rules on page7 of the manual and treats foo as legacy function.


However, if I compile this program in Linux, no error occurs. And it makes me think the compiler applies the rules in Table3 of the manual and performes a serialzed execution?


So what is this foo? A legacy function or just a function not marked with any annotation in Table3?



btw, is there any way I can know whether a transaction is under serialized execution?As I was wondering if the transaction is serialized due to the unmarked foo, I looked into itm.log and doesn't find anything serialized. I was doing this all under Linux.

3 post / 0 new
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione
Ritratto di James Cownie (Intel)

Arelegacy functions all the functions that are not marked with any annotations?


Yes.


When I compile this program in Windows, it causes error like:


User abort function is called inside an irrevocable transaction


So it seems it applies the rules on page7 of the manual and treats foo as legacy function.


Correct, the execution has been serialized to allow the irrevocable execution of foo, and you cannot therefore abort after that.


However, if I compile this program in Linux, no error occurs. And it makes me think the compiler applies the rules in Table3 of the manual and performes a serialzed execution?


I think you are seeing the same bug here that you reported in your other post.


btw, is there any way I can know whether a transaction is under serialized execution?


We do not currently provide a function to let you discover the execution mode. As a general principle it seems wrong to have behavior which depends on the execution mode.

Ritratto di Ravi Narayanaswamy (Intel)

If the definition of the legacy functions are seen before the call, they could be inlined and hence implicitly inherit the tm_callable attribute. On linux the call to function foo is inlined and not so on Windows.

Accedere per lasciare un commento.