https://codereview.appspot.com/119240043/diff/180001/src/pkg/runtime/print.go File src/pkg/runtime/print.go (right): https://codereview.appspot.com/119240043/diff/180001/src/pkg/runtime/print.go#newcode11 src/pkg/runtime/print.go:11: // these 4 functions are complicated enough that we ...
12 years, 4 months ago
(2014-07-31 00:36:30 UTC)
#2
On Wed, Jul 30, 2014 at 5:36 PM, <bradfitz@golang.org> wrote: > > https://codereview.appspot.com/119240043/diff/180001/src/ > pkg/runtime/print.go ...
12 years, 4 months ago
(2014-07-31 00:55:09 UTC)
#3
On Wed, Jul 30, 2014 at 5:36 PM, <bradfitz@golang.org> wrote:
>
> https://codereview.appspot.com/119240043/diff/180001/src/
> pkg/runtime/print.go
> File src/pkg/runtime/print.go (right):
>
> https://codereview.appspot.com/119240043/diff/180001/src/
> pkg/runtime/print.go#newcode11
> src/pkg/runtime/print.go:11: // these 4 functions are complicated enough
> that we will share
> So all that really moves to Go is the handful of few-line functions
> below? What does that buy you?
>
>
I'm trying to get all the C code off the G stack so that stacks can be
scanned precisely. It's either rewrite the C to Go, or switch to the M
stack before running the C. For the easy stuff I chose the former, for the
tricky stuff I chose the latter.
> https://codereview.appspot.com/119240043/diff/180001/src/
> pkg/runtime/print.go#newcode13
> src/pkg/runtime/print.go:13: var printstring_m byte
> why byte?
>
>
Could be any type, really. The linker resolves the symbol to the start of
the C function. Perhaps we should use a named type for this?
> https://codereview.appspot.com/119240043/diff/180001/src/
> pkg/runtime/print.go#newcode84
> src/pkg/runtime/print.go:84: func printiface(i interface {
> cute
>
> https://codereview.appspot.com/119240043/
>
LGTM On Wed, Jul 30, 2014 at 5:55 PM, Keith Randall <khr@google.com> wrote: > https://codereview.appspot.com/119240043/diff/180001/src/ ...
12 years, 4 months ago
(2014-07-31 00:59:41 UTC)
#4
LGTM
On Wed, Jul 30, 2014 at 5:55 PM, Keith Randall <khr@google.com> wrote:
> https://codereview.appspot.com/119240043/diff/180001/src/
> pkg/runtime/print.go#newcode13
>
src/pkg/runtime/print.go:13: var printstring_m byte
>> why byte?
>>
>>
> Could be any type, really. The linker resolves the symbol to the start of
> the C function. Perhaps we should use a named type for this?
>
>
type knownToLinker uintptr
?
The problem is that "printstring" is called by the compiler. If we called the Go ...
12 years, 4 months ago
(2014-07-31 04:57:39 UTC)
#6
The problem is that "printstring" is called by the compiler. If we called
the Go thing "goprintstring" then we'd have to modify the compiler. So
there's a pile of renamings either way.
I agree that naming conventions need to be better spec'd / cleaned up. In
the end I'd like to end up where all the Go variants will not have "go"
prefixes, they will just be the standard names. C variants will have _c
(or _m) suffixes. The problem is that mid-transition, it's easier to
introduce the new Go variant with a different name so that all the old C
callers remain unchanged. After all the C callers have themselves been
rewritten to Go, then we can delete the C variant and drop the "go" from
the Go variant.
On Wed, Jul 30, 2014 at 9:35 PM, <dave@cheney.net> wrote:
>
> https://codereview.appspot.com/119240043/diff/180001/src/
> pkg/runtime/print.go
> File src/pkg/runtime/print.go (right):
>
> https://codereview.appspot.com/119240043/diff/180001/src/
> pkg/runtime/print.go#newcode18
> src/pkg/runtime/print.go:18: func printstring(s string) {
> the convention (although never spoken aloud) is the go runtime functions
> should be goprintstring, goprintuint, etc.
>
> If that were the case then you wouldn't need the awkwardly named
> printstring_c variants and this changeset would be much smaller.
>
> I don't know if this is a valid comment or a distraction.
>
> https://codereview.appspot.com/119240043/
>
Sure, thanks for your reply. This change builds fine on linux/arm btw. On Thu, Jul ...
12 years, 4 months ago
(2014-07-31 05:03:28 UTC)
#7
Sure, thanks for your reply. This change builds fine on linux/arm btw.
On Thu, Jul 31, 2014 at 2:57 PM, Keith Randall <khr@google.com> wrote:
> The problem is that "printstring" is called by the compiler. If we called
> the Go thing "goprintstring" then we'd have to modify the compiler. So
> there's a pile of renamings either way.
>
> I agree that naming conventions need to be better spec'd / cleaned up. In
> the end I'd like to end up where all the Go variants will not have "go"
> prefixes, they will just be the standard names. C variants will have _c
> (or _m) suffixes. The problem is that mid-transition, it's easier to
> introduce the new Go variant with a different name so that all the old C
> callers remain unchanged. After all the C callers have themselves been
> rewritten to Go, then we can delete the C variant and drop the "go" from
> the Go variant.
>
>
>
> On Wed, Jul 30, 2014 at 9:35 PM, <dave@cheney.net> wrote:
>
>>
>> https://codereview.appspot.com/119240043/diff/180001/src/
>> pkg/runtime/print.go
>> File src/pkg/runtime/print.go (right):
>>
>> https://codereview.appspot.com/119240043/diff/180001/src/
>> pkg/runtime/print.go#newcode18
>> src/pkg/runtime/print.go:18: func printstring(s string) {
>> the convention (although never spoken aloud) is the go runtime functions
>> should be goprintstring, goprintuint, etc.
>>
>> If that were the case then you wouldn't need the awkwardly named
>> printstring_c variants and this changeset would be much smaller.
>>
>> I don't know if this is a valid comment or a distraction.
>>
>> https://codereview.appspot.com/119240043/
>>
>
>
It's not about this CL, but we need something to debug all that new Go ...
12 years, 4 months ago
(2014-07-31 09:15:17 UTC)
#9
It's not about this CL, but we need something to debug all that new Go code in
runtime. I use runtime.printf very extensively. Now we need something like
runtime.goprintf for Go code. printstring/printptr/printhex is not very
convenient option.
On 2014/07/31 09:15:17, dvyukov wrote: > It's not about this CL, but we need something ...
12 years, 4 months ago
(2014-07-31 09:18:49 UTC)
#10
On 2014/07/31 09:15:17, dvyukov wrote:
> It's not about this CL, but we need something to debug all that new Go code in
> runtime. I use runtime.printf very extensively. Now we need something like
> runtime.goprintf for Go code. printstring/printptr/printhex is not very
> convenient option.
wait, print/println builtins will do, right?
Yes, print/println should work for you. There's no explicit format string, but you can do: ...
12 years, 4 months ago
(2014-07-31 20:45:20 UTC)
#11
Yes, print/println should work for you. There's no explicit format string,
but you can do:
println("had problem with value", x, "and value", y)
You'll get the default format for each type. The only thing that will be
annoying is that to print an integer in hex you'll need to cast it to a
pointer.
On Thu, Jul 31, 2014 at 2:18 AM, <dvyukov@google.com> wrote:
> On 2014/07/31 09:15:17, dvyukov wrote:
>
>> It's not about this CL, but we need something to debug all that new Go
>>
> code in
>
>> runtime. I use runtime.printf very extensively. Now we need something
>>
> like
>
>> runtime.goprintf for Go code. printstring/printptr/printhex is not
>>
> very
>
>> convenient option.
>>
>
> wait, print/println builtins will do, right?
>
>
> https://codereview.appspot.com/119240043/
>
Issue 119240043: code review 119240043: runtime: move built-in print routines to go.
(Closed)
Created 12 years, 4 months ago by khr
Modified 12 years, 4 months ago
Reviewers:
Base URL:
Comments: 4