I'll stream a compiler feature demo/update this Saturday in the afternoon sometime, Pacific time ...
I don't understand the question. Why would it need to handle anything in this case?
-
-
So what do you think about?
-
I still have no idea what you are saying here. Registers don't have addresses. The aliasing concern you are talking about does not have much to do with threads. I don't know why you would be looking for a thread-specific solution. Starting a thread is every expensive; trying to
-
optimize something on the level of getting it from a register vs from memory, when you are starting an entire thread, just doesn't make any sense.
End of conversation
New conversation -
-
-
[1] Well, the compiler usually keeps a track of the values stored at registers, so they can share the value of the registers through different procedures. An example will guide you better. Suppose that you have this block of C code:
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
[2] void doit(int* vari) { CallAWindowsProcedure(vari) ; } void main() { int avar =56; doit(&avar) ; } So what happens next if we compile with -O3, is that the compiler will look if the whole program can be optimized, if it doesn't(because there's a call to an extern..
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
[3]..symbol) , then the compiler will check if avar could be optimized to an immediate value in asm(imm32), but it does not because the same as before, the external symbol. So it would probably just store the value 56 at rcx, rdx, or some register, and pass the address of the...
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
[4].... register at other register(following the windows calling conventions) and then call the external symbol, right?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
[5] Now suppose we add the following to the main procedure of before
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
[6] void main() { //it's c++ but whatever int avar = 56; std::thread t ([avar] () CallOtherWindowsProcedure(&avar) ; }) ; ... } Obviously, the compiler would simply store avar at the data section and reference to it in the main and t threads, but it wouldn't be needed
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Since we want a copy of avar on the thread t, we could simply do this instead of allocating 4 bytes at the data section: main: mov eax, 56 ... t_anonymousmethod001: mov eax, 56 ...
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.