[PATCH] D20913: [asan] add primitives that allow coroutine implementations

Philippe Daouadi via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 11 03:12:27 PDT 2016


blastrock marked 12 inline comments as done.

================
Comment at: lib/asan/asan_thread.cc:127
@@ +126,3 @@
+  if (fiber_switching_)
+    Report("WARNING: starting fiber switch twice\n");
+  if (!fiber_stack_bottom_) {
----------------
blastrock wrote:
> filcab wrote:
> > I'd prefer something like "starting fiber switch while in fiber switch".
> > I'd also make it an assert unless we have actual uses cases of this.
> No use case comes to my mind, I'm ok with making this an assert.
Hm... should I use the default C assert macro? I couldn't find if you have your own macro. Or should I leave the if and the log as they are and just add a Die() call?

================
Comment at: lib/asan/asan_thread.h:137
@@ +136,3 @@
+  };
+  StackBounds GetStackBounds() const;
+
----------------
filcab wrote:
> Remove this. `GetStackBounds` (and the struct) are only used in the .cc file. You can make them have internal linkage there.
I can move the struct in the .cc file, but if I move GetStackBounds(), I must make it friend of AsanThread so that it can access fiber_stack_*. Another solution would be to make it receive all that data as argument, but the prototype would be GetStackBounds(stacktop, stackbottom, fiberstacktop, fiberstackbottom, fiberswitching) (if I keep only two stack in memory as you suggested in your last comment).
What do you prefer?


http://reviews.llvm.org/D20913





More information about the llvm-commits mailing list