[compiler-rt] r355539 - [NFC][TSan][libdispatch] Rename tsan_block_context_t -> block_context_t

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 6 11:27:10 PST 2019


Author: yln
Date: Wed Mar  6 11:27:10 2019
New Revision: 355539

URL: http://llvm.org/viewvc/llvm-project?rev=355539&view=rev
Log:
[NFC][TSan][libdispatch] Rename tsan_block_context_t -> block_context_t

'tsan_' part of the struct name is redundant since we are already inside
the __tsan namespace.

Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_libdispatch.cc

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_libdispatch.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_libdispatch.cc?rev=355539&r1=355538&r2=355539&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_libdispatch.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_libdispatch.cc Wed Mar  6 11:27:10 2019
@@ -40,7 +40,7 @@ typedef struct {
   bool submitted_synchronously;
   bool is_barrier_block;
   uptr non_queue_sync_object;
-} tsan_block_context_t;
+} block_context_t;
 
 // The offsets of different fields of the dispatch_queue_t structure, exported
 // by libdispatch.dylib.
@@ -84,13 +84,11 @@ static dispatch_queue_t GetTargetQueueFr
   return tq;
 }
 
-static tsan_block_context_t *AllocContext(ThreadState *thr, uptr pc,
-                                          dispatch_queue_t queue,
-                                          void *orig_context,
-                                          dispatch_function_t orig_work) {
-  tsan_block_context_t *new_context =
-      (tsan_block_context_t *)user_alloc_internal(thr, pc,
-                                                  sizeof(tsan_block_context_t));
+static block_context_t *AllocContext(ThreadState *thr, uptr pc,
+                                     dispatch_queue_t queue, void *orig_context,
+                                     dispatch_function_t orig_work) {
+  block_context_t *new_context =
+      (block_context_t *)user_alloc_internal(thr, pc, sizeof(block_context_t));
   new_context->queue = queue;
   new_context->orig_context = orig_context;
   new_context->orig_work = orig_work;
@@ -109,7 +107,7 @@ static tsan_block_context_t *AllocContex
   bool serial_task = context->is_barrier_block || is_queue_serial
 
 static void dispatch_sync_pre_execute(ThreadState *thr, uptr pc,
-                                      tsan_block_context_t *context) {
+                                      block_context_t *context) {
   uptr submit_sync = (uptr)context;
   Acquire(thr, pc, submit_sync);
 
@@ -124,7 +122,7 @@ static void dispatch_sync_pre_execute(Th
 }
 
 static void dispatch_sync_post_execute(ThreadState *thr, uptr pc,
-                                       tsan_block_context_t *context) {
+                                       block_context_t *context) {
   uptr submit_sync = (uptr)context;
   if (context->submitted_synchronously) Release(thr, pc, submit_sync);
 
@@ -140,7 +138,7 @@ static void dispatch_sync_post_execute(T
 
 static void dispatch_callback_wrap(void *param) {
   SCOPED_INTERCEPTOR_RAW(dispatch_callback_wrap);
-  tsan_block_context_t *context = (tsan_block_context_t *)param;
+  block_context_t *context = (block_context_t *)param;
 
   dispatch_sync_pre_execute(thr, pc, context);
 
@@ -170,7 +168,7 @@ static void invoke_and_release_block(voi
     SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_START();                           \
     dispatch_block_t heap_block = Block_copy(block);                         \
     SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_END();                             \
-    tsan_block_context_t *new_context =                                      \
+    block_context_t *new_context =                                           \
         AllocContext(thr, pc, q, heap_block, &invoke_and_release_block);     \
     new_context->is_barrier_block = barrier;                                 \
     Release(thr, pc, (uptr)new_context);                                     \
@@ -183,7 +181,7 @@ static void invoke_and_release_block(voi
   TSAN_INTERCEPTOR(void, name, dispatch_queue_t q,                           \
                    DISPATCH_NOESCAPE dispatch_block_t block) {               \
     SCOPED_TSAN_INTERCEPTOR(name, q, block);                                 \
-    tsan_block_context_t new_context = {                                     \
+    block_context_t new_context = {                                          \
         q, block, &invoke_block, false, true, barrier, 0};                   \
     Release(thr, pc, (uptr)&new_context);                                    \
     SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_START();                           \
@@ -196,7 +194,7 @@ static void invoke_and_release_block(voi
   TSAN_INTERCEPTOR(void, name, dispatch_queue_t q, void *context, \
                    dispatch_function_t work) {                    \
     SCOPED_TSAN_INTERCEPTOR(name, q, context, work);              \
-    tsan_block_context_t *new_context =                           \
+    block_context_t *new_context =                                \
         AllocContext(thr, pc, q, context, work);                  \
     new_context->is_barrier_block = barrier;                      \
     Release(thr, pc, (uptr)new_context);                          \
@@ -209,7 +207,7 @@ static void invoke_and_release_block(voi
   TSAN_INTERCEPTOR(void, name, dispatch_queue_t q, void *context,             \
                    dispatch_function_t work) {                                \
     SCOPED_TSAN_INTERCEPTOR(name, q, context, work);                          \
-    tsan_block_context_t new_context = {                                      \
+    block_context_t new_context = {                                           \
         q, context, work, false, true, barrier, 0};                           \
     Release(thr, pc, (uptr)&new_context);                                     \
     SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_START();                            \
@@ -237,7 +235,7 @@ TSAN_INTERCEPTOR(void, dispatch_after, d
   SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_START();
   dispatch_block_t heap_block = Block_copy(block);
   SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_END();
-  tsan_block_context_t *new_context =
+  block_context_t *new_context =
       AllocContext(thr, pc, queue, heap_block, &invoke_and_release_block);
   Release(thr, pc, (uptr)new_context);
   SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_START();
@@ -375,7 +373,7 @@ TSAN_INTERCEPTOR(void, dispatch_group_no
     block();
   });
   SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_END();
-  tsan_block_context_t *new_context =
+  block_context_t *new_context =
       AllocContext(thr, pc, q, heap_block, &invoke_and_release_block);
   new_context->is_barrier_block = true;
   Release(thr, pc, (uptr)new_context);
@@ -393,7 +391,7 @@ TSAN_INTERCEPTOR(void, dispatch_source_s
   if (handler == nullptr)
     return REAL(dispatch_source_set_event_handler)(source, nullptr);
   dispatch_queue_t q = GetTargetQueueFromSource(source);
-  __block tsan_block_context_t new_context = {
+  __block block_context_t new_context = {
       q, handler, &invoke_block, false, false, false, 0 };
   dispatch_block_t new_handler = Block_copy(^(void) {
     new_context.orig_context = handler;  // To explicitly capture "handler".
@@ -422,7 +420,7 @@ TSAN_INTERCEPTOR(void, dispatch_source_s
   if (handler == nullptr)
     return REAL(dispatch_source_set_cancel_handler)(source, nullptr);
   dispatch_queue_t q = GetTargetQueueFromSource(source);
-  __block tsan_block_context_t new_context = {
+  __block block_context_t new_context = {
       q, handler, &invoke_block, false, false, false, 0};
   dispatch_block_t new_handler = Block_copy(^(void) {
     new_context.orig_context = handler;  // To explicitly capture "handler".
@@ -453,7 +451,7 @@ TSAN_INTERCEPTOR(void, dispatch_source_s
   if (handler == nullptr)
     return REAL(dispatch_source_set_registration_handler)(source, nullptr);
   dispatch_queue_t q = GetTargetQueueFromSource(source);
-  __block tsan_block_context_t new_context = {
+  __block block_context_t new_context = {
       q, handler, &invoke_block, false, false, false, 0};
   dispatch_block_t new_handler = Block_copy(^(void) {
     new_context.orig_context = handler;  // To explicitly capture "handler".
@@ -529,7 +527,7 @@ TSAN_INTERCEPTOR(dispatch_data_t, dispat
   SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_START();
   dispatch_block_t heap_block = Block_copy(destructor);
   SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_END();
-  tsan_block_context_t *new_context =
+  block_context_t *new_context =
       AllocContext(thr, pc, q, heap_block, &invoke_and_release_block);
   uptr submit_sync = (uptr)new_context;
   Release(thr, pc, submit_sync);
@@ -544,7 +542,7 @@ typedef void (^cleanup_handler_t)(int er
 TSAN_INTERCEPTOR(void, dispatch_read, dispatch_fd_t fd, size_t length,
                  dispatch_queue_t q, fd_handler_t h) {
   SCOPED_TSAN_INTERCEPTOR(dispatch_read, fd, length, q, h);
-  __block tsan_block_context_t new_context = {
+  __block block_context_t new_context = {
       q, nullptr, &invoke_block, false, false, false, 0};
   fd_handler_t new_h = Block_copy(^(dispatch_data_t data, int error) {
     new_context.orig_context = ^(void) {
@@ -561,7 +559,7 @@ TSAN_INTERCEPTOR(void, dispatch_read, di
 TSAN_INTERCEPTOR(void, dispatch_write, dispatch_fd_t fd, dispatch_data_t data,
                  dispatch_queue_t q, fd_handler_t h) {
   SCOPED_TSAN_INTERCEPTOR(dispatch_write, fd, data, q, h);
-  __block tsan_block_context_t new_context = {
+  __block block_context_t new_context = {
       q, nullptr, &invoke_block, false, false, false, 0};
   fd_handler_t new_h = Block_copy(^(dispatch_data_t data, int error) {
     new_context.orig_context = ^(void) {
@@ -578,7 +576,7 @@ TSAN_INTERCEPTOR(void, dispatch_write, d
 TSAN_INTERCEPTOR(void, dispatch_io_read, dispatch_io_t channel, off_t offset,
                  size_t length, dispatch_queue_t q, dispatch_io_handler_t h) {
   SCOPED_TSAN_INTERCEPTOR(dispatch_io_read, channel, offset, length, q, h);
-  __block tsan_block_context_t new_context = {
+  __block block_context_t new_context = {
       q, nullptr, &invoke_block, false, false, false, 0};
   dispatch_io_handler_t new_h =
       Block_copy(^(bool done, dispatch_data_t data, int error) {
@@ -597,7 +595,7 @@ TSAN_INTERCEPTOR(void, dispatch_io_write
                  dispatch_data_t data, dispatch_queue_t q,
                  dispatch_io_handler_t h) {
   SCOPED_TSAN_INTERCEPTOR(dispatch_io_write, channel, offset, data, q, h);
-  __block tsan_block_context_t new_context = {
+  __block block_context_t new_context = {
       q, nullptr, &invoke_block, false, false, false, 0};
   dispatch_io_handler_t new_h =
       Block_copy(^(bool done, dispatch_data_t data, int error) {
@@ -615,7 +613,7 @@ TSAN_INTERCEPTOR(void, dispatch_io_write
 TSAN_INTERCEPTOR(void, dispatch_io_barrier, dispatch_io_t channel,
                  dispatch_block_t barrier) {
   SCOPED_TSAN_INTERCEPTOR(dispatch_io_barrier, channel, barrier);
-  __block tsan_block_context_t new_context = {
+  __block block_context_t new_context = {
       nullptr, nullptr, &invoke_block, false, false, false, 0};
   new_context.non_queue_sync_object = (uptr)channel;
   new_context.is_barrier_block = true;
@@ -635,7 +633,7 @@ TSAN_INTERCEPTOR(dispatch_io_t, dispatch
                  dispatch_fd_t fd, dispatch_queue_t q, cleanup_handler_t h) {
   SCOPED_TSAN_INTERCEPTOR(dispatch_io_create, type, fd, q, h);
   __block dispatch_io_t new_channel = nullptr;
-  __block tsan_block_context_t new_context = {
+  __block block_context_t new_context = {
       q, nullptr, &invoke_block, false, false, false, 0};
   cleanup_handler_t new_h = Block_copy(^(int error) {
     {
@@ -660,7 +658,7 @@ TSAN_INTERCEPTOR(dispatch_io_t, dispatch
   SCOPED_TSAN_INTERCEPTOR(dispatch_io_create_with_path, type, path, oflag, mode,
                           q, h);
   __block dispatch_io_t new_channel = nullptr;
-  __block tsan_block_context_t new_context = {
+  __block block_context_t new_context = {
       q, nullptr, &invoke_block, false, false, false, 0};
   cleanup_handler_t new_h = Block_copy(^(int error) {
     {
@@ -685,7 +683,7 @@ TSAN_INTERCEPTOR(dispatch_io_t, dispatch
                  cleanup_handler_t h) {
   SCOPED_TSAN_INTERCEPTOR(dispatch_io_create_with_io, type, io, q, h);
   __block dispatch_io_t new_channel = nullptr;
-  __block tsan_block_context_t new_context = {
+  __block block_context_t new_context = {
       q, nullptr, &invoke_block, false, false, false, 0};
   cleanup_handler_t new_h = Block_copy(^(int error) {
     {




More information about the llvm-commits mailing list