Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Issue 9328042: Move the thread local functions to the Thread class in runtime/platform (Closed)

Created:
8 years, 10 months ago by Søren Gjesse
Modified:
8 years, 10 months ago
Reviewers:
siva
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Move the thread local functions to the Thread class in runtime/platform This gets rid of all the platform specific isolate_*.h and isolate_*.cc files. R=asiva@google.com BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=3982

Patch Set 1 #

Patch Set 2 : Fixed Windows build #

Patch Set 3 : Reverted unintentional change #

Total comments: 14

Patch Set 4 : Addressed review comments from asiva@ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+177 lines, -215 lines) Patch
M runtime/platform/thread.h View 1 2 3 1 chunk +9 lines, -0 lines 0 comments Download
M runtime/platform/thread_linux.h View 1 2 3 1 chunk +20 lines, -0 lines 0 comments Download
M runtime/platform/thread_linux.cc View 1 2 3 1 chunk +26 lines, -0 lines 0 comments Download
M runtime/platform/thread_macos.h View 1 2 3 1 chunk +20 lines, -0 lines 0 comments Download
M runtime/platform/thread_macos.cc View 1 2 3 1 chunk +26 lines, -0 lines 0 comments Download
M runtime/platform/thread_win.h View 1 2 3 1 chunk +20 lines, -0 lines 0 comments Download
M runtime/platform/thread_win.cc View 1 2 3 1 chunk +30 lines, -0 lines 0 comments Download
M runtime/vm/isolate.h View 4 chunks +7 lines, -11 lines 0 comments Download
M runtime/vm/isolate.cc View 1 2 3 1 chunk +19 lines, -0 lines 0 comments Download
D runtime/vm/isolate_linux.h View 1 chunk +0 lines, -27 lines 0 comments Download
D runtime/vm/isolate_linux.cc View 1 chunk +0 lines, -42 lines 0 comments Download
D runtime/vm/isolate_macos.h View 1 chunk +0 lines, -27 lines 0 comments Download
D runtime/vm/isolate_macos.cc View 1 chunk +0 lines, -42 lines 0 comments Download
D runtime/vm/isolate_win.h View 1 chunk +0 lines, -27 lines 0 comments Download
D runtime/vm/isolate_win.cc View 1 chunk +0 lines, -33 lines 0 comments Download
M runtime/vm/vm_sources.gypi View 1 chunk +0 lines, -6 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Søren Gjesse
8 years, 10 months ago (2012-02-06 15:34:50 UTC) #1
siva
LGTM with some comments. http://codereview.chromium.org/9328042/diff/4001/runtime/platform/thread.h File runtime/platform/thread.h (right): http://codereview.chromium.org/9328042/diff/4001/runtime/platform/thread.h#newcode32 runtime/platform/thread.h:32: static ThreadLocalKey kInvalidThreadLocal; data field ...
8 years, 10 months ago (2012-02-06 19:29:37 UTC) #2
Søren Gjesse
8 years, 10 months ago (2012-02-07 09:13:59 UTC) #3
Thanks for the review.

I haved checked the generated code and Thread::GetThreadLocal is inlined now.

http://codereview.chromium.org/9328042/diff/4001/runtime/platform/thread.h
File runtime/platform/thread.h (right):

http://codereview.chromium.org/9328042/diff/4001/runtime/platform/thread.h#ne...
runtime/platform/thread.h:32: static ThreadLocalKey kInvalidThreadLocal;
On 2012/02/06 19:29:37, asiva wrote:
> data field is clubbed in with functions, shouldn't this be listed first?
> 
> Also should we call the field kUnsetThreadlocalKey?
> or if you want to stick with Invalid make it
> kInvalidThreadlocalKey so that it is obvious that the key is invalid not the
> thread local value.

Moved field and changed name to kUnsetThreadlocalKey.

http://codereview.chromium.org/9328042/diff/4001/runtime/platform/thread_linu...
File runtime/platform/thread_linux.cc (right):

http://codereview.chromium.org/9328042/diff/4001/runtime/platform/thread_linu...
runtime/platform/thread_linux.cc:111: int result = pthread_key_create(&key,
NULL);
On 2012/02/06 19:29:37, asiva wrote:
> ASSERT(key != kInvalidThreadLocal);

Done.

http://codereview.chromium.org/9328042/diff/4001/runtime/platform/thread_linu...
runtime/platform/thread_linux.cc:127: }
On 2012/02/06 19:29:37, asiva wrote:
> Can this be defined in the header file so that it gets inlined the way it is
> now.

Added a class ThreadInlineImpl to platform specific .h files with static method
for GetThreadLocal. We could consider just moving all of class Thread to the
platform specific .h files.

http://codereview.chromium.org/9328042/diff/4001/runtime/platform/thread_maco...
File runtime/platform/thread_macos.cc (right):

http://codereview.chromium.org/9328042/diff/4001/runtime/platform/thread_maco...
runtime/platform/thread_macos.cc:95: int result = pthread_key_create(&key,
NULL);
On 2012/02/06 19:29:37, asiva wrote:
> ASSERT(key != kInvalidThreadLocal);

Done.

http://codereview.chromium.org/9328042/diff/4001/runtime/platform/thread_maco...
runtime/platform/thread_macos.cc:111: }
On 2012/02/06 19:29:37, asiva wrote:
> Inline this method in the header so that there is no perf degradation.

Done.

http://codereview.chromium.org/9328042/diff/4001/runtime/vm/isolate_linux.cc
File runtime/vm/isolate_linux.cc (left):

http://codereview.chromium.org/9328042/diff/4001/runtime/vm/isolate_linux.cc#...
runtime/vm/isolate_linux.cc:22: // isolate specific information a single pthread
key is sufficient.
On 2012/02/06 19:29:37, asiva wrote:
> This comment has been lost now.

Copied to isolate.cc where isolate_key is defined. Changed "pthread" to "thread
local"

http://codereview.chromium.org/9328042/diff/4001/runtime/vm/isolate_macos.cc
File runtime/vm/isolate_macos.cc (left):

http://codereview.chromium.org/9328042/diff/4001/runtime/vm/isolate_macos.cc#...
runtime/vm/isolate_macos.cc:22: // isolate specific information a single pthread
key is sufficient.
On 2012/02/06 19:29:37, asiva wrote:
> Ditto, comment lost.

Ditto, now in isolate.cc.

Powered by Google App Engine
This is Rietveld 408576698