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

Issue 153110044: code review 153110044: spec: updated package unsafe (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 6 months ago by gri
Modified:
9 years, 6 months ago
Reviewers:
czaplinski, ken2, khr, iant, rsc, r, minux, mdempsky
CC:
golang-codereviews
Visibility:
Public.

Description

spec: updated package unsafe This is a proposal for changes to package unsafe to make its operations safer under the new garbage collector. Based on discussions w/ khr, issue 7192, and borrowing from a proposal by mdempsky (see issue 7192). Summary of the changes: 1) It is not permitted anymore to convert a uintptr to an unsafe.Pointer. 2) There are two new functions, unsafe.Add and Unsafe.Mask implementing addition to and masking of pointers. Comments: - The 2nd function is called "Mask" rather than say "And" because "Add" and "And" can be easily confused. - Add and Mask take an arbitrary pointer and return a pointer of the same type rather than only unsafe.Pointers. There is no technical reason for not handling arbitrary pointer types, and the hope is that this should reduce conversion clutter in the source. - There's no urgency in implementing this for 1.4 (albeit it should be trivial in a compiler). But we probably want to document it for 1.4. May fix issue 7192.

Patch Set 1 #

Patch Set 2 : diff -r db10387ebca641ad069757fcbba005abf9e69b3f https://code.google.com/p/go/ #

Patch Set 3 : diff -r db10387ebca641ad069757fcbba005abf9e69b3f https://code.google.com/p/go/ #

Patch Set 4 : diff -r db10387ebca641ad069757fcbba005abf9e69b3f https://code.google.com/p/go/ #

Total comments: 4

Patch Set 5 : diff -r a1401fc916b534f2c3de456ede7bbfd86b70bbf2 https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+37 lines, -16 lines) Patch
M doc/go_spec.html View 1 2 3 4 5 chunks +37 lines, -16 lines 0 comments Download

Messages

Total messages: 16
gri
Hello r@golang.org, rsc@golang.org, iant@golang.org, ken@golang.org, khr@golang.org (cc: golang-codereviews@googlegroups.com), I'd like you to review this change ...
9 years, 6 months ago (2014-10-06 22:39:18 UTC) #1
r
An easier place to think about this would be the package docs for unsafe. On ...
9 years, 6 months ago (2014-10-06 22:45:21 UTC) #2
mdempsky
On 2014/10/06 22:39:18, gri wrote: > - Add and Mask take an arbitrary pointer and ...
9 years, 6 months ago (2014-10-06 23:18:14 UTC) #3
gri
On 2014/10/06 23:18:14, mdempsky wrote: > On 2014/10/06 22:39:18, gri wrote: > > - Add ...
9 years, 6 months ago (2014-10-06 23:21:08 UTC) #4
czaplinski
On 2014/10/06 23:21:08, gri wrote: > On 2014/10/06 23:18:14, mdempsky wrote: > > It could ...
9 years, 6 months ago (2014-10-07 13:43:58 UTC) #5
czaplinski
https://codereview.appspot.com/153110044/diff/60001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/153110044/diff/60001/doc/go_spec.html#newcode6205 doc/go_spec.html:6205: unitptr(unsafe.Pointer(unsafe.Mask(p, x))) == uintptr(unsafe.Pointer(p)) & uintptr(x) s/unitptr/uintptr/ https://codereview.appspot.com/153110044/diff/60001/doc/go_spec.html#newcode6236 doc/go_spec.html:6236: ...
9 years, 6 months ago (2014-10-07 13:44:44 UTC) #6
iant
How can we reconcile a change like this with the Go 1 guarantee? Our own ...
9 years, 6 months ago (2014-10-07 14:05:25 UTC) #7
gri
It's ok to convert from unsafe.Pointer to uintptr; it's just not ok to convert back. ...
9 years, 6 months ago (2014-10-07 15:55:25 UTC) #8
r
Please file a ticket. We can return to this topic in the 1.5 cycle. -rob ...
9 years, 6 months ago (2014-10-07 16:07:31 UTC) #9
gri
There's an issue regarding documentation. Happy to file a ticket for this as well, but ...
9 years, 6 months ago (2014-10-07 17:01:30 UTC) #10
gri
https://codereview.appspot.com/153110044/diff/60001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/153110044/diff/60001/doc/go_spec.html#newcode6205 doc/go_spec.html:6205: unitptr(unsafe.Pointer(unsafe.Mask(p, x))) == uintptr(unsafe.Pointer(p)) & uintptr(x) On 2014/10/07 13:44:43, ...
9 years, 6 months ago (2014-10-07 18:44:53 UTC) #11
minux
On Oct 7, 2014 10:05 AM, <iant@golang.org> wrote: > How can we reconcile a change ...
9 years, 6 months ago (2014-10-07 19:36:00 UTC) #12
rsc
I don't believe we should be defining new API at this point in the cycle, ...
9 years, 6 months ago (2014-10-07 19:39:59 UTC) #13
minux
On Oct 7, 2014 11:55 AM, "Robert Griesemer" <gri@golang.org> wrote: > The Go 1 guarantee ...
9 years, 6 months ago (2014-10-07 19:42:21 UTC) #14
gri
Abandoning this approach in favor of documenting status quo; per feedback from internal team discussion.
9 years, 6 months ago (2014-10-08 19:35:29 UTC) #15
gri
9 years, 6 months ago (2014-10-08 19:35:46 UTC) #16
*** Abandoned ***
Sign in to reply to this message.

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