Keyboard Shortcuts

File
u :up to issue
m :publish + mail comments
M :edit review message
j / k :jump to file after / before current file
J / K :jump to next file with a comment after / before current file
Side-by-side diff
i :toggle intra-line diffs
e :expand all comments
c :collapse all comments
s :toggle showing all comments
n / p :next / previous diff chunk or comment
N / P :next / previous comment
<Up> / <Down> :next / previous line
<Enter> :respond to / edit current comment
d :mark current comment as done
Issue
u :up to list of issues
m :publish + mail comments
j / k :jump to patch after / before current patch
o / <Enter> :open current patch in side-by-side view
i :open current patch in unified diff view
Issue List
j / k :jump to issue after / before current issue
o / <Enter> :open current issue
# : close issue
Comment/message editing
<Ctrl> + s or <Ctrl> + Enter :save comment
<Esc> :cancel edit
Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(7)
Issues Repositories Search
Open Issues | Closed Issues | All Issues | Sign in with your Google Account to create issues and add comments

Issue 4813043: code review 4813043: runtime: fix memclr and impove memcopy.

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 5 months ago by zhai
Modified:
14 years, 5 months ago
Reviewers:
rsc
CC:
golang-dev, r, r2, dsymonds, rsc
Visibility:
Public.
runtime: fix memclr and impove memcopy.

Patch Set 1 #

Patch Set 2 : diff -r a4c2e46af9b2 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r a4c2e46af9b2 https://go.googlecode.com/hg/ #

Created: 14 years, 5 months ago
Download [raw] [tar.bz2]
Unified diffs Side-by-side diffs Delta from patch set Stats (+13 lines, -12 lines) Patch
M src/pkg/runtime/386/asm.s View 1 1 chunk +5 lines, -1 line 0 comments Download
M src/pkg/runtime/amd64/asm.s View 1 1 chunk +5 lines, -1 line 0 comments Download
M src/pkg/runtime/runtime.c View 1 1 chunk +3 lines, -10 lines 0 comments Download
Total messages: 13
|
zhai
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
14 years, 5 months ago (2011年07月21日 12:26:18 UTC) #1
Hello golang-dev@googlegroups.com,
I'd like you to review this change to
https://go.googlecode.com/hg/ 
Sign in to reply to this message.
r
Have you seen a bug that this fixes?
14 years, 5 months ago (2011年07月22日 05:44:53 UTC) #2
Have you seen a bug that this fixes?
Sign in to reply to this message.
zhai
On Fri, Jul 22, 2011 at 1:44 PM, <r@golang.org> wrote: > Have you seen a ...
14 years, 5 months ago (2011年07月22日 08:20:41 UTC) #3
On Fri, Jul 22, 2011 at 1:44 PM, <r@golang.org> wrote:
> Have you seen a bug that this fixes?
Please look at the memclr. if argument count == 1, it clear 8 bytes on
amd64, or 4 bytes on 386.
Not sure it's intend to do so.
Sign in to reply to this message.
r2
On 22/07/2011, at 6:20 PM, zhai wrote: > On Fri, Jul 22, 2011 at 1:44 ...
14 years, 5 months ago (2011年07月22日 09:49:24 UTC) #4
On 22/07/2011, at 6:20 PM, zhai wrote:
> On Fri, Jul 22, 2011 at 1:44 PM, <r@golang.org> wrote:
> Have you seen a bug that this fixes?
> Please look at the memclr. if argument count == 1, it clear 8 bytes on amd64,
or 4 bytes on 386.
> Not sure it's intend to do so.
If you're not sure, why do you want to fix it?
-rob
Sign in to reply to this message.
r2
Let me put it another way. Do you have a test that fails before this ...
14 years, 5 months ago (2011年07月22日 10:13:25 UTC) #5
Let me put it another way. Do you have a test that fails before this fix and
succeeds after it? Semantic changes to core libraries are not lightly made.
-rob
Sign in to reply to this message.
dsymonds
On Fri, Jul 22, 2011 at 6:20 PM, zhai <qyzhai@gmail.com> wrote: > Please look at ...
14 years, 5 months ago (2011年07月22日 14:20:01 UTC) #6
On Fri, Jul 22, 2011 at 6:20 PM, zhai <qyzhai@gmail.com> wrote:
> Please look at the memclr. if argument count == 1, it clear 8 bytes on
> amd64, or 4 bytes on 386.
In addition to Rob's comments, I think you've got this around the
wrong way. The current amd64 code has
 MOVQ	16(SP), CX // puts the count in CX
 SHRQ	3,ドル CX // count >> 3
That means that, for count=1, CX will hold zero, so the "REP; STOSQ"
will not write anything. In effect, the existing memclr under-clears
but never over-clears.
Dave.
Sign in to reply to this message.
zhai
On Fri, Jul 22, 2011 at 6:13 PM, Rob 'Commander' Pike <r@google.com> wrote: > Let ...
14 years, 5 months ago (2011年07月22日 16:57:17 UTC) #7
On Fri, Jul 22, 2011 at 6:13 PM, Rob 'Commander' Pike <r@google.com> wrote:
> Let me put it another way. Do you have a test that fails before this fix
> and succeeds after it? Semantic changes to core libraries are not lightly
> made.
I have not found any tests fails before this "fix", the memset(memclr) is
just a little not reasonable to me,I found it some days ago, and hesitate a
while before send a changeset.
I hope it will avoid some bugs in the future.
sorry for my poor english.
Sign in to reply to this message.
zhai
> > If you're not sure, why do you want to fix it? > > ...
14 years, 5 months ago (2011年07月22日 17:50:26 UTC) #8
>
> If you're not sure, why do you want to fix it?
>
> -rob
>
I mean "is it intended to do so?"
Sign in to reply to this message.
rsc
the existing code overclears. it clears up to the next word boundary. but it is ...
14 years, 5 months ago (2011年07月23日 00:57:58 UTC) #9
the existing code overclears.
it clears up to the next word boundary.
but it is only called from places where
that is okay.
this CL replaces a C byte-clearing loop
in a context where that is not okay with a
call to memclr, so it also fixes memclr
not to overclear, or else the switch would
not be okay.
everything about this CL looks good to me.
Sign in to reply to this message.
zhai
> > so it also fixes memclr > not to overclear, or else the switch ...
14 years, 5 months ago (2011年07月23日 03:50:17 UTC) #10
>
> so it also fixes memclr
> not to overclear, or else the switch would
> not be okay.
>
It still pass all tests without changing the memclr asm code on 386.
Sign in to reply to this message.
dsymonds
Oh, duh. Somehow I completely missed the ADDQ 7,ドル CX Yes, the existing one does ...
14 years, 5 months ago (2011年07月23日 03:52:36 UTC) #11
Oh, duh. Somehow I completely missed the
 ADDQ	7,ドル CX
Yes, the existing one does overclear.
Serves me right for reading assembly code after midnight.
Dave.
Sign in to reply to this message.
rsc
LGTM Don't seem to be any more objections, so submitting...
14 years, 5 months ago (2011年07月23日 19:45:01 UTC) #12
LGTM
Don't seem to be any more objections, so submitting...
Sign in to reply to this message.
rsc
*** Submitted as http://code.google.com/p/go/source/detail?r=79cb8647dd5a *** runtime: replace byte-at-a-time zeroing loop with memclr R=golang-dev, r, r, ...
14 years, 5 months ago (2011年07月23日 19:47:04 UTC) #13
*** Submitted as http://code.google.com/p/go/source/detail?r=79cb8647dd5a ***
runtime: replace byte-at-a-time zeroing loop with memclr
R=golang-dev, r, r, dsymonds, rsc
CC=golang-dev
http://codereview.appspot.com/4813043
Committer: Russ Cox <rsc@golang.org>
Sign in to reply to this message.
|
This is Rietveld f62528b

AltStyle によって変換されたページ (->オリジナル) /