[PATCH] Generalize stackdepot.

Dmitry Vyukov dvyukov at google.com
Wed May 21 01:44:03 PDT 2014


================
Comment at: lib/msan/msan.cc:566
@@ -519,1 +565,3 @@
+    bool inserted = ChainedOriginDepotPut(idx, Origin::kStackRoot, &id);
+    CHECK(inserted); // All first time stack origins are unique.
     *id_ptr = id;
----------------
Evgeniy Stepanov wrote:
> Dmitry Vyukov wrote:
> > Isn't it subject to races? What if two threads trigger this alloca for the first time?
> Yeah, we may have duplicate entries for stack origins.
> 
Then remove the CHECK.

================
Comment at: lib/msan/msan_allocator.cc:108
@@ -107,1 +107,3 @@
+      ChainedOriginDepotPut(stack_id, Origin::kHeapRoot, &id);
+      __msan_set_origin(allocated, size, Origin(id, 1).raw_id());
     }
----------------
Evgeniy Stepanov wrote:
> Dmitry Vyukov wrote:
> > Origin(id, 1)
> > can't we start depth from 0 here? that would enlarge the maximum chain depth by 1.
> The idea here is to reserve depth value of 0 for unlimited history length for this single origin. Not sure we need that, but adding it later would reduce max history length by 1 and may break existing users.
> 
Ack.

http://reviews.llvm.org/D3790






More information about the llvm-commits mailing list