[PATCH] D21612: [compiler-rt] [XRay] Basic initialization and flag definition for XRay runtime

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 27 18:05:40 PDT 2016


eugenis added a subscriber: eugenis.

================
Comment at: compiler-rt/trunk/lib/xray/CMakeLists.txt:45
@@ +44,3 @@
+
+# if(COMPILER_RT_INCLUDE_TESTS)
+#   add_subdirectory(tests)
----------------
Remove this chunk, it can be added later with the tests commit.

================
Comment at: compiler-rt/trunk/lib/xray/xray_init.cc:26
@@ +25,3 @@
+extern "C" {
+extern void __xray_init();
+extern const XRaySledEntry __start_xray_instr_map[] __attribute__((weak));
----------------
I think this extern is unnecessary

================
Comment at: compiler-rt/trunk/lib/xray/xray_init.cc:36
@@ +35,3 @@
+// /proc/curproc/map and make sure that we're able to get it. We signal failure
+// via a global atomic boolean to indicate whether we've initialized properly.
+//
----------------
Is it unimplemented in this revision? /proc/xx/maps may be inaccessible under sandbox, would dl_iterate_phdr work for this?

================
Comment at: compiler-rt/trunk/lib/xray/xray_interface.cc:65
@@ +64,3 @@
+  // instrumentation map.
+  __xray::XRaySledMap InstrMap = XRayInstrMap.load(std::memory_order_acquire);
+  if (InstrMap.Entries == 0)
----------------
Does it need to be atomic at all? It looks like you are already synchronized on XRayPatching.

================
Comment at: compiler-rt/trunk/lib/xray/xray_interface.cc:67
@@ +66,3 @@
+  if (InstrMap.Entries == 0)
+    return XRayPatchingStatus::NOT_INITIALIZED;
+
----------------
Do you need to reset XRayPatching to false? Also in multiple places below.

================
Comment at: compiler-rt/trunk/lib/xray/xray_interface.cc:74
@@ +73,3 @@
+  uint64_t CurFun = 0;
+  for (std::size_t I = 0; I < InstrMap.Entries; I++) {
+    auto Sled = InstrMap.Sleds[I];
----------------
out of curiosity, why std:: instead of just "size_t" ?


Repository:
  rL LLVM

https://reviews.llvm.org/D21612





More information about the llvm-commits mailing list