Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(12917)

Issue 5708043: Improve GoogleOnceInit() in Protocol Buffers. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 2 months ago by pliard1
Modified:
12 years ago
Reviewers:
Jisi Liu, pliard
CC:
thakis, joth, ajwong, digit, kenton
Base URL:
http://protobuf.googlecode.com/svn/trunk
Visibility:
Public.

Description

Improve GoogleOnceInit() in Protocol Buffers. It is based on V8's new CallOnce(): http://codereview.chromium.org/9447052/. This patch includes the following changes: - POD (no static initializer generated) and faster implementation on Windows. - GoogleOnceInit() can now take an additional parameter which is forwarded to the function provided by the user. This patch is part of the static initializers removal initiative. BUG=351

Patch Set 1 #

Total comments: 8

Patch Set 2 : Fix comment. #

Patch Set 3 : Address Pherl and Kenton comments #

Patch Set 4 : Fix typo. #

Patch Set 5 : Add non-thread-safe implementation #

Patch Set 6 : Fix build on Windows #

Patch Set 7 : Remove support for recursive calls #

Patch Set 8 : Remove no longer needed GetThreadID(). #

Total comments: 20

Patch Set 9 : Revert GoogleOnce interface change. #

Patch Set 10 : Use a pointer for GoogleOnceInit's last argument. #

Patch Set 11 : Add comment about futex(). #

Unified diffs Side-by-side diffs Delta from patch set Stats (+98 lines, -63 lines) Patch
M src/google/protobuf/stubs/once.h View 1 2 3 4 5 6 7 8 9 2 chunks +53 lines, -29 lines 0 comments Download
M src/google/protobuf/stubs/once.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +45 lines, -34 lines 0 comments Download

Messages

Total messages: 27
pliard1
12 years, 2 months ago (2012-02-28 14:07:00 UTC) #1
Jisi Liu
Thanks for the change! http://codereview.appspot.com/5708043/diff/1/src/google/protobuf/stubs/once.h File src/google/protobuf/stubs/once.h (right): http://codereview.appspot.com/5708043/diff/1/src/google/protobuf/stubs/once.h#newcode59 src/google/protobuf/stubs/once.h:59: // * This implementation supports ...
12 years, 2 months ago (2012-02-28 18:22:24 UTC) #2
kenton
FYI Can we now get rid of the GOOGLE_PROTOBUF_DECLARE_ONCE macro and instead match the syntax ...
12 years, 2 months ago (2012-02-28 19:18:50 UTC) #3
pliard1
I updated the interface to match the internal code. Once my Windows VM is ready, ...
12 years, 2 months ago (2012-02-29 11:17:43 UTC) #4
pliard1
On 2012/02/29 11:17:43, pliard1 wrote: > I updated the interface to match the internal code. ...
12 years, 2 months ago (2012-02-29 14:36:45 UTC) #5
pliard1
On 2012/02/29 14:36:45, pliard1 wrote: > On 2012/02/29 11:17:43, pliard1 wrote: > > I updated ...
12 years, 2 months ago (2012-02-29 18:19:30 UTC) #6
Jisi Liu
http://codereview.appspot.com/5708043/diff/1/src/google/protobuf/stubs/once.h File src/google/protobuf/stubs/once.h (right): http://codereview.appspot.com/5708043/diff/1/src/google/protobuf/stubs/once.h#newcode59 src/google/protobuf/stubs/once.h:59: // * This implementation supports recursive calls (rather than ...
12 years, 1 month ago (2012-03-01 19:24:11 UTC) #7
pliard1
http://codereview.appspot.com/5708043/diff/1/src/google/protobuf/stubs/once.h File src/google/protobuf/stubs/once.h (right): http://codereview.appspot.com/5708043/diff/1/src/google/protobuf/stubs/once.h#newcode59 src/google/protobuf/stubs/once.h:59: // * This implementation supports recursive calls (rather than ...
12 years, 1 month ago (2012-03-02 11:08:14 UTC) #8
kenton
Unfortunately I think it's going to be hard sell to either change google3's GoogleOnce or ...
12 years, 1 month ago (2012-03-02 20:00:45 UTC) #9
pliard
Avoiding recursive calls in the initialization code means making sure that we don't have any ...
12 years, 1 month ago (2012-03-05 11:10:45 UTC) #10
pliard
I will remove support for recursive calls so that we can already benefit from this ...
12 years, 1 month ago (2012-03-05 15:28:34 UTC) #11
pliard1
On 2012/03/05 15:28:34, pliard wrote: > I will remove support for recursive calls so that ...
12 years, 1 month ago (2012-03-05 15:49:24 UTC) #12
kenton
FYI Assuming default instances are initialized first, why would extensions introduce cycles at all? Each ...
12 years, 1 month ago (2012-03-05 19:49:05 UTC) #13
pliard
I was initially a bit skeptical about the fact that default instances were guaranteed to ...
12 years, 1 month ago (2012-03-06 10:57:15 UTC) #14
pliard
Can we submit this CL (or complete its review) while the main one is being ...
12 years, 1 month ago (2012-03-15 15:01:43 UTC) #15
kenton
> uint64 tid; // Used to handle recursive calls. That should be removed now, right? ...
12 years, 1 month ago (2012-03-15 21:14:51 UTC) #16
Jisi Liu
On Thu, Mar 15, 2012 at 2:14 PM, Kenton Varda <kenton@google.com> wrote: > > uint64 ...
12 years, 1 month ago (2012-03-15 21:17:05 UTC) #17
pliard1
On 2012/03/15 21:17:05, Pherl Liu wrote: > On Thu, Mar 15, 2012 at 2:14 PM, ...
12 years, 1 month ago (2012-03-16 09:08:47 UTC) #18
Jisi Liu
http://codereview.appspot.com/5708043/diff/28001/src/google/protobuf/compiler/cpp/cpp_file.cc File src/google/protobuf/compiler/cpp/cpp_file.cc (right): http://codereview.appspot.com/5708043/diff/28001/src/google/protobuf/compiler/cpp/cpp_file.cc#newcode451 src/google/protobuf/compiler/cpp/cpp_file.cc:451: "::google::protobuf::GoogleOnceType protobuf_AssignDescriptors_once_ =\n" reserve the macro so we don't ...
12 years, 1 month ago (2012-03-21 00:33:26 UTC) #19
kenton
The new code (without the macro) ought to be a closer match to what is ...
12 years, 1 month ago (2012-03-21 00:46:24 UTC) #20
Jisi Liu
Yes, that would be easier. (remove one sed command) It will introduce less code conflict ...
12 years, 1 month ago (2012-03-21 00:56:57 UTC) #21
kenton
The header comment says users should not include once.h, so I am not worried about ...
12 years, 1 month ago (2012-03-21 01:02:23 UTC) #22
pliard1
I reverted the changes that I made a few patch sets ago to match the ...
12 years, 1 month ago (2012-03-22 11:06:59 UTC) #23
Jisi Liu
LGTM Fine. I guess we can put a comment about the choice to use futex ...
12 years, 1 month ago (2012-03-24 01:13:58 UTC) #24
kenton
FYI FWIW, I think futex() is too platform-specific and too subtle to be worth trying ...
12 years, 1 month ago (2012-03-24 01:32:12 UTC) #25
pliard1
On 2012/03/24 01:32:12, kenton wrote: > FYI > > FWIW, I think futex() is too ...
12 years, 1 month ago (2012-03-26 09:02:40 UTC) #26
kenton
12 years, 1 month ago (2012-03-26 19:16:52 UTC) #27
LGTM

Only briefly skimmed the code; mostly trusting Pherl's review.

On Mon, Mar 26, 2012 at 2:02 AM, <pliard@chromium.org> wrote:

> On 2012/03/24 01:32:12, kenton wrote:
>
>> FYI
>>
>
>  FWIW, I think futex() is too platform-specific and too subtle to be
>>
> worth
>
>> trying to use here, unless we observe a real need.
>>
>
>  On Fri, Mar 23, 2012 at 6:13 PM, <mailto:liujisi@google.com> wrote:
>>
>
>  > LGTM
>> >
>> > Fine. I guess we can put a comment about the choice to use futex for
>> > linux.
>> >
>> >
>>
>
> http://codereview.appspot.com/****5708043/%3Chttp://**
>
codereview.appspot.com/**5708043/<http://codereview.appspot.com/**5708043/%3Chttp://codereview.appspot.com/5708043/>
> >
>
>> >
>>
>
> Thanks for the review!
>
> I added a comment about futex(). I'm also waiting for your LGTM Kenton
> before I submit that.
>
> Cheers,
> Philippe.
>
>
http://codereview.appspot.com/**5708043/<http://codereview.appspot.com/5708043/>
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b