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

Issue 12895043: code review 12895043: runtime: make SetFinalizer(x, f) accept any f for which... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 7 months ago by rsc
Modified:
11 years, 7 months ago
Reviewers:
dvyukov
CC:
dvyukov, bradfitz, peted, golang-dev
Visibility:
Public.

Description

runtime: make SetFinalizer(x, f) accept any f for which f(x) is valid Originally the requirement was f(x) where f's argument is exactly x's type. CL 11858043 relaxed the requirement in a non-standard way: f's argument must be exactly x's type or interface{}. If we're going to relax the requirement, it should be done in a way consistent with the rest of Go. This CL allows f's argument to have any type for which x is assignable; that's the same requirement the compiler would impose if compiling f(x) directly. Fixes issue 5368.

Patch Set 1 #

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

Total comments: 9

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

Unified diffs Side-by-side diffs Delta from patch set Stats (+98 lines, -63 lines) Patch
M src/pkg/runtime/extern.go View 1 2 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/runtime/iface.c View 1 1 chunk +10 lines, -0 lines 0 comments Download
M src/pkg/runtime/malloc.h View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M src/pkg/runtime/malloc.goc View 1 4 chunks +15 lines, -6 lines 0 comments Download
M src/pkg/runtime/mfinal.c View 1 2 9 chunks +10 lines, -6 lines 0 comments Download
M src/pkg/runtime/mfinal_test.go View 1 1 chunk +40 lines, -43 lines 0 comments Download
M src/pkg/runtime/mgc0.c View 1 2 5 chunks +17 lines, -4 lines 0 comments Download
M src/pkg/runtime/runtime.h View 1 2 2 chunks +1 line, -2 lines 0 comments Download
M src/pkg/runtime/type.h View 1 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 10
rsc
Hello dvyukov (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go/
11 years, 7 months ago (2013-08-13 21:30:29 UTC) #1
bradfitz
https://codereview.appspot.com/12895043/diff/3001/src/pkg/runtime/malloc.goc File src/pkg/runtime/malloc.goc (right): https://codereview.appspot.com/12895043/diff/3001/src/pkg/runtime/malloc.goc#newcode768 src/pkg/runtime/malloc.goc:768: if(fint == obj.type) { can't put this into an ...
11 years, 7 months ago (2013-08-13 21:46:35 UTC) #2
peted
On 2013/08/13 21:46:35, bradfitz wrote: > https://codereview.appspot.com/12895043/diff/3001/src/pkg/runtime/malloc.goc > File src/pkg/runtime/malloc.goc (right): > > https://codereview.appspot.com/12895043/diff/3001/src/pkg/runtime/malloc.goc#newcode768 > ...
11 years, 7 months ago (2013-08-14 03:08:27 UTC) #3
dvyukov
Other than my confusion with definitions, the code looks good https://codereview.appspot.com/12895043/diff/3001/src/pkg/runtime/malloc.goc File src/pkg/runtime/malloc.goc (right): https://codereview.appspot.com/12895043/diff/3001/src/pkg/runtime/malloc.goc#newcode770 ...
11 years, 7 months ago (2013-08-14 09:27:48 UTC) #4
rsc
https://codereview.appspot.com/12895043/diff/3001/src/pkg/runtime/malloc.goc File src/pkg/runtime/malloc.goc (right): https://codereview.appspot.com/12895043/diff/3001/src/pkg/runtime/malloc.goc#newcode770 src/pkg/runtime/malloc.goc:770: } else if(fint->kind == KindPtr && (fint->x == nil ...
11 years, 7 months ago (2013-08-14 14:37:38 UTC) #5
dvyukov
On 2013/08/14 14:37:38, rsc wrote: > https://codereview.appspot.com/12895043/diff/3001/src/pkg/runtime/malloc.goc > File src/pkg/runtime/malloc.goc (right): > > https://codereview.appspot.com/12895043/diff/3001/src/pkg/runtime/malloc.goc#newcode770 > ...
11 years, 7 months ago (2013-08-14 16:35:00 UTC) #6
dvyukov
LGTM with test for unnamed identical types and minor fixes
11 years, 7 months ago (2013-08-14 16:35:47 UTC) #7
rsc
actually, there is already a test for unnamed identical types: *int and *int.
11 years, 7 months ago (2013-08-14 16:54:26 UTC) #8
dvyukov
On Wed, Aug 14, 2013 at 8:54 PM, Russ Cox <rsc@golang.org> wrote: > actually, there ...
11 years, 7 months ago (2013-08-14 17:10:33 UTC) #9
rsc
11 years, 7 months ago (2013-08-14 18:55:51 UTC) #10
*** Submitted as https://code.google.com/p/go/source/detail?r=f95838c0a419 ***

runtime: make SetFinalizer(x, f) accept any f for which f(x) is valid

Originally the requirement was f(x) where f's argument is
exactly x's type.

CL 11858043 relaxed the requirement in a non-standard
way: f's argument must be exactly x's type or interface{}.

If we're going to relax the requirement, it should be done
in a way consistent with the rest of Go. This CL allows f's
argument to have any type for which x is assignable;
that's the same requirement the compiler would impose
if compiling f(x) directly.

Fixes issue 5368.

R=dvyukov, bradfitz, pieter
CC=golang-dev
https://codereview.appspot.com/12895043
Sign in to reply to this message.

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