fmt: change to work with Go
Escape analysis code in Go requires that we
restore fmt flags after a fmtprint/fmtvprint.
This change aligns fmtprint and fmtvprint
with http://codereview.appspot.com/5129057.
Hello nix-dev@googlegroups.com (cc: rminnich@gmail.com, john@jfloren.net, 0intro@gmail.com), I'd like you to review this change to https://code.google.com/p/nix-os/
13 years, 9 months ago
(2012-04-11 19:18:37 UTC)
#1
On Wed Apr 11 18:56:22 EDT 2012, nemo@lsub.org wrote: > Before accepting things because "they ...
13 years, 9 months ago
(2012-04-11 23:03:17 UTC)
#4
On Wed Apr 11 18:56:22 EDT 2012, nemo@lsub.org wrote:
> Before accepting things because "they are required for go", I'd like to
> see a working go port.
>
> I understand changes have to be made to make it work, but, before we know the
> port works, I think that "required for go" is not enough (at least for me) to
lgtm a change.
>
> Of course, if the change improves things, that's a different issue.
+1.
- erik
Francisco J Ballesteros <nemo@lsub.org> once said: > Before accepting things because "they are required for ...
13 years, 9 months ago
(2012-04-12 13:41:21 UTC)
#5
Francisco J Ballesteros <nemo@lsub.org> once said:
> Before accepting things because "they are required for go", I'd like to
> see a working go port.
I've just updated my repo with all pending CLs
that make Go work on Nix, including Akshat's
tsemacquire changes. You can get it here:
https://bitbucket.org/ality/go
Anthony
P.S.
If you want to build on vx32 you'll need to patch
in this diff (relative to Ron's repo):
diff -r 17a064eed9c2 src/libvx32/emu.c
--- a/src/libvx32/emu.c Mon May 30 10:09:22 2011 +0200
+++ b/src/libvx32/emu.c Thu Apr 12 06:40:13 2012 -0700
@@ -744,6 +744,7 @@
switch (*inp++) {
// No-operand insns
+ case 0x90: // PAUSE (not really a REP instruction)
case 0xa4: case 0xa5: case 0xa6: case 0xa7: // MOVS, CMPS
case 0xaa: case 0xab: // STOS
case 0xac: case 0xad: case 0xae: case 0xaf: // LODS, SCAS
@@ -813,6 +814,8 @@
// No additional operand
case 0xc8: case 0xc9: case 0xca: case 0xcb: // BSWAP
case 0xcc: case 0xcd: case 0xce: case 0xcf:
+ case 0x31: // RDTSC (this should be emulated)
+ case 0x77: // EMMS
goto notrans;
// General EA operands
@@ -830,6 +833,7 @@
case 0x54: case 0x55: case 0x56: case 0x57: // ANDPS etc.
case 0x58: case 0x59: case 0x5a: case 0x5b: // ADDPS etc.
case 0x5c: case 0x5d: case 0x5e: case 0x5f: // SUBPS etc.
+ case 0x6f: case 0x7f: // MOVQ
case 0xa3: // BT Ev,Gv
case 0xab: // BTS Ev,Gv
case 0xaf: // IMUL Gv,Ev
@@ -857,6 +861,7 @@
case 0x17: // MOVHPS Mq,Vps
case 0x2b: // MOVNTPS
case 0xc3: // MOVNTI Md,Gd
+ case 0xc7: // CMPXCHG8B Mq
if (EA_MOD(*inp) == 3) // Mem-only
goto invalid;
inp = xscan_rm(inp);
Anthony
PTAL. http://codereview.appspot.com/6005053/diff/7008/sys/man/2/fmtinstall File sys/man/2/fmtinstall (left): http://codereview.appspot.com/6005053/diff/7008/sys/man/2/fmtinstall#oldcode269 sys/man/2/fmtinstall:269: However, these functions clear the width, precision, and ...
13 years, 9 months ago
(2012-04-12 22:03:41 UTC)
#8
On 12 April 2012 15:07, erik quanstrom <quanstro@quanstro.net> wrote: >> Or, "These functions will preserve ...
13 years, 9 months ago
(2012-04-12 22:13:41 UTC)
#10
On 12 April 2012 15:07, erik quanstrom <quanstro@quanstro.net> wrote:
>> Or, "These functions will preserve width, precision, and flags."
>
> that sounds very good.
Will resubmit with this, then (didn't add it yet).
>>
http://codereview.appspot.com/6005053/diff/7008/sys/src/ape/lib/fmt/fmtprint.c
>>
http://codereview.appspot.com/6005053/diff/7008/sys/src/ape/lib/fmt/fmtprint....
>> sys/src/ape/lib/fmt/fmtprint.c:32: n = fmtvprint(f, fmt, va);
>> On 2012/04/12 20:11:51, quanstro wrote:
>> > just call dofmt
>> Then we have to push/pop f->args and check the return value of dofmt;
>> same stuff that fmtvprint already does. Should we avoid code duplication
>> here, or not?
>
> since you moved the flag saving & restoring to _fmtdispatch,
> isn't all this extra code in fmtvprint redundant?
In fmtvprint? I just submitted a new patchset (#6), which removes
the pushing/popping of width, prec, and flags. Would you rather
that f->args was saved in the fmtdispatch code as well?
Thanks,
Akshat
Issue 6005053: code review 6005053: fmt: change to work with Go
(Closed)
Created 13 years, 9 months ago by akumar
Modified 12 years, 11 months ago
Reviewers: nix-dev_googlegroups.com, quanstro, nemo_lsub.org, ality, 0intro
Base URL:
Comments: 8