code review 6643046: runtime: sizeclass in MSpan should be int32. (issue 6643046)

62 views
Skip to first unread message

dio...@gmail.com

unread,
Oct 10, 2012, 10:22:33 PM10/10/12
to golan...@googlegroups.com, golan...@googlegroups.com, r...@golang.org, re...@codereview-hr.appspotmail.com
Reviewers: golang-dev_googlegroups.com,

Message:
Hello golan...@googlegroups.com (cc: golan...@googlegroups.com,
r...@golang.org),

I'd like you to review this change to
https://code.google.com/p/go/


Description:
runtime: sizeclass in MSpan should be int32.

Please review this at http://codereview.appspot.com/6643046/

Affected files:
M src/pkg/runtime/malloc.h


Index: src/pkg/runtime/malloc.h
===================================================================
--- a/src/pkg/runtime/malloc.h
+++ b/src/pkg/runtime/malloc.h
@@ -358,7 +358,7 @@
uintptr npages; // number of pages in span
MLink *freelist; // list of free objects
uint32 ref; // number of allocated objects in this span
- uint32 sizeclass; // size class
+ int32 sizeclass; // size class
uintptr elemsize; // computed from sizeclass or from npages
uint32 state; // MSpanInUse etc
int64 unusedsince; // First time spotted by GC in MSpanFree state


minux

unread,
Oct 11, 2012, 1:21:20 AM10/11/12
to re...@codereview-hr.appspotmail.com, dio...@gmail.com, r...@golang.org, golan...@googlegroups.com

any explanations?

Jingcheng Zhang

unread,
Oct 11, 2012, 2:30:48 AM10/11/12
to minux, r...@golang.org, re...@codereview-hr.appspotmail.com, golan...@googlegroups.com

All sizeclass in runrime are int32. I suspect this uint32 sizeclass is a neglect.

在 2012-10-11 PM1:21,"minux" <minu...@gmail.com>写道:

any explanations?

Dave Cheney

unread,
Oct 11, 2012, 3:23:37 AM10/11/12
to Jingcheng Zhang, minux, r...@golang.org, re...@codereview-hr.appspotmail.com, golan...@googlegroups.com
On the contrary, I think this is the only one that is correct. How can you have something that is -5 bytes big?

dio...@gmail.com

unread,
Oct 11, 2012, 3:44:44 AM10/11/12
to golan...@googlegroups.com, minu...@gmail.com, da...@cheney.net, golan...@googlegroups.com, r...@golang.org, re...@codereview-hr.appspotmail.com
"sizeclass" is different with "size". It is the class of size, not the
size itself. There are currently 61 sizeclasses (through an enum value
NumSizeClasses) defined for allocation.

On 2012/10/11 07:23:47, dfc wrote:
> On the contrary, I think this is the only one that is correct. How can
you have
> something that is -5 bytes big?

> On 11/ can10/2012, at 17:30, Jingcheng Zhang <mailto:dio...@gmail.com>
wrote:

> > All sizeclass in runrime are int32. I suspect this uint32 sizeclass
is a
> neglect.
> >
> > 在 2012-10-11 PM1:21,"minux" <minu...@gmail.com>写道:
> >> any explanations?



http://codereview.appspot.com/6643046/

minux

unread,
Oct 11, 2012, 12:35:40 PM10/11/12
to dio...@gmail.com, golan...@googlegroups.com, minu...@gmail.com, da...@cheney.net, r...@golang.org, re...@codereview-hr.appspotmail.com
LGTM, will wait for others' opinion before submit.

Have you signed the CLA as described at

dio...@gmail.com

unread,
Oct 11, 2012, 10:24:50 PM10/11/12
to golan...@googlegroups.com, minu...@gmail.com, da...@cheney.net, golan...@googlegroups.com, r...@golang.org, re...@codereview-hr.appspotmail.com
Just signed it, the page said it would process my submission shortly,
not sure whether it is completed now.
http://codereview.appspot.com/6643046/

r...@golang.org

unread,
Oct 16, 2012, 1:17:19 PM10/16/12
to dio...@gmail.com, golan...@googlegroups.com, minu...@gmail.com, da...@cheney.net, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
It's hard to get excited about this but okay.


https://codereview.appspot.com/6643046/
Reply all
Reply to author
Forward
0 new messages