From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <23d08c32941ef86be9e751700edf48b0@coraid.com> References: <5fc4ecdb1523a9dbda1829df0018500a@proxima.alt.za> <20131202183901.Horde.so34A23woqwLYjKomWz6Ag1@ssl.eumx.net> <74126e01b30ebb946afb3adcd8705e01@coraid.com> <20131202212426.0730342a@zinc.9fans.fr> <23d08c32941ef86be9e751700edf48b0@coraid.com> Date: Mon, 2 Dec 2013 15:26:06 -0800 Message-ID: From: Skip Tavakkolian To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=089e013cba6210eaa104ec9581dd Subject: Re: [9fans] Go and 21-bit runes (and a bit of Go status) Topicbox-Message-UUID: 8ed927d0-ead8-11e9-9d60-3106f5b1d025 --089e013cba6210eaa104ec9581dd Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable At a high level it is about excess baggage that needs to be carried to provide a familiar environment for either language. Python needs Posix, so we have to carry its APE baggage, whereas Go brings its own Plan9-ish baggage (?[cl], lib9, libbio, etc.) and you'll need to give it some hooks to hang them on. To the best of my knowledge, until now the following are the changes to Plan 9 and/or Go to support Go on Plan 9. Do these seem onerous? 1. Addition of TSEMACQUIRE system call. Does it have other applications? 2. Use of Go's libbio, rather than Plan 9's. Alternatively libbio on Plan 9 can be changed. It's not clear to me why this would be a bad thing. 3. Modifications to 8g to get around an 8c bug (for the curious, see the test case from Anthony that reproduces it, below). Go team accepted the patch to get around this, even though it is a bug in Plan 9's 8c. 4. modification to get around having to use runtime=B7memmove in runtime=B7sighandler (for the curious, this is because runtime=B7memmove uses SSE MOVOU instructions, which touch XMM registers). * Repro for Plan 9 8c bug: unsigned long long x; int f(int); void test(void) { int a; a =3D f(a-x+a); } On Mon, Dec 2, 2013 at 1:51 PM, erik quanstrom wr= ote: > On Mon Dec 2 16:08:20 EST 2013, skip.tavakkolian@gmail.com wrote: > > wait! so, you had to make changes to Plan 9 to support Python? :) > > > > (sorry, couldn't resist) > > i'll take the bait. > > the changes were very different from the changes for go. python > is an ape program, and ape has been very neglected. many > of these changes were not strictly necessary for the python port. > none are really python specific. they fix broken things in ape. > go needs new system calls, and makes other demands, like the > silly libbio macros. > > here's a highlevel overview of what was done. stars by the necessary > changes: > > *0. support for ssl was added to ape by importing mp, sec, bio into > ape. also compile crypt from /sys/src/libc/port (necessary to avoid usin= g > openssl) > > *1. was moved to /$objtype/include/ape because it's not > portable. (necessary for amd64 port) > > *2. inet_ntop, inet_pton, getaddrinfo (and friends) were added. > python doesn't work well with old-style name lookup. > > *3. all the system calls have had their signatures corrected e.g.: > - extern int _RENDEZVOUS(unsigned long, unsigned long)= ; > + extern void* _RENDEZVOUS(void*, void*); > this is required for amd64. change brk() and _buf() accordingly. > > *4. fix frexp, modf, (endian issues, subnormal #s) and copysign(). > > *5. make a lame attempt to deal with wait4() vs rfork. > > *6. _IO_getc needs to return EOF on eof. > > *7. fix %p for 64-bit add vfscanf in stdio; use USED() not #pragma ref > > *8. getsrvbyaddr() remember that htons! > > *9. further envp rework. > > *10. socketpair: wrong signature. > > and unnecessary but helpful fixes: > > 0. all ape compoents are built with -VTw to prevent simple linker > mistakes. snprintf() now always uses the c99 definition to prevent link > errors with -T. > > *1. support for ssl was added to ape by importing mp, sec, bio into > ape. (necessary to avoid using openssl) > > *2. was moved to /$objtype/include/ape because it's not > portable. (necessary for amd64 port) > > 3. ip6 support was added. > > *4. inet_ntop, inet_pton, getaddrinfo (and friends) were added. > python doesn't work well with old-style name lookup. > > 5. librexexp was fixed in line with fixes to the normal lib. > > 6. Rune and wchar_t are an uint/int for 21-bit runes. decode 21-bit > runes in mbwc.c > > 7. getcallerpc/getfcr implemented for all arches. > > 8. make qsort 64-bit safe. > > 9. fix const in strcspn, strpbrk, strrchr, strspn, strstr, rename, > pathconf > > 10. fix types in setuid, setgid, signal, mkfifo, getgrent, getpwent > > 11. fix conflict between bind() [libdraw] and bind [socket]. > > 12. fmt: fix %p; fix %C (21-bit rune) > > 13. utf: 21-bit runes > > 14. libv: fix impossible definition of nap(). > > - erik > > --089e013cba6210eaa104ec9581dd Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
At a high level it is about excess baggage that needs to b= e carried to provide a familiar environment for either language. =A0Python = needs Posix, so we have to carry its APE baggage, whereas Go brings its own= Plan9-ish baggage (?[cl], lib9, libbio, etc.) and you'll need to give = it some hooks to hang them on.

To the best of my knowledge, until now the following are the= changes to Plan 9 and/or Go to support Go on Plan 9. Do these seem onerous= ?

1. Addition of TSEMACQUIRE system call. =A0Does = it have other applications?
2. Use of Go's libbio, rather than Plan 9's. Alternatively lib= bio on Plan 9 can be changed. It's not clear to me why this would be a = bad thing.
3. Modifications to 8g to get around an 8c bug (for th= e curious, see the test case from Anthony that reproduces it, below). Go te= am accepted the patch to get around this, even though it is a bug in Plan 9= 's 8c.
4. modification to get around having to use=A0runtime=B7memmove in=A0runtime=B7sighandler (for the curious, this is b= ecause=A0runtime=B7m= emmove uses SSE MOVOU instructions, which touch XMM registers).

= * Repro for Plan 9 8c bug:<= /span>
unsigned long long x;

int f(= int);

void
test(void)
{
int a;
=
a =3D f(a-x+a);
}



On Mon, Dec 2, 2013 at 1:51 PM, erik quanstrom &= lt;quanstro@l= abs.coraid.com> wrote:
On Mon Dec =A02 16:08:20 E= ST 2013, skip.tavakkolian@gma= il.com wrote:
> wait! so, you had to make changes to Plan 9 to support Python? :)
>
> (sorry, couldn't resist)

i'll take the bait.

the changes were very different from the changes for go. =A0python
is an ape program, and ape has been very neglected. =A0many
of these changes were not strictly necessary for the python port.
none are really python specific. =A0they fix broken things in ape.
go needs new system calls, and makes other demands, like the
silly libbio macros.

here's a highlevel overview of what was done. =A0stars by the necessary=
changes:

*0. =A0support for ssl was added to ape by importing mp, sec, bio into
ape. =A0also compile crypt from /sys/src/libc/port (necessary to avoid usin= g openssl)

*1. =A0<inttypes.h> was moved to /$objtype/include/ape because it'= ;s not
portable. =A0(necessary for amd64 port)

*2. =A0inet_ntop, inet_pton, getaddrinfo (and friends) were added.
python doesn't work well with old-style name lookup.

*3. =A0all the system calls have had their signatures corrected e.g.:
=A0 =A0 =A0 =A0 - extern =A0 =A0 =A0 =A0int =A0 =A0 _RENDEZVOUS(unsigned lo= ng, unsigned long);
=A0 =A0 =A0 =A0 + extern =A0 =A0 =A0 =A0void* =A0 _RENDEZVOUS(void*, void*)= ;
this is required for amd64. =A0change brk() and _buf() accordingly.

*4. =A0fix frexp, modf, (endian issues, subnormal #s) and copysign().

*5. =A0make a lame attempt to deal with wait4() vs rfork.

*6. =A0_IO_getc needs to return EOF on eof.

*7. =A0fix %p =A0for 64-bit add vfscanf in stdio; use USED() not #pragma re= f

*8. =A0getsrvbyaddr() remember that htons!

*9. =A0further envp rework.

*10. =A0socketpair: wrong signature.

and unnecessary but helpful fixes:

0. =A0all ape compoents are built with -VTw to prevent simple linker
mistakes. =A0snprintf() now always uses the c99 definition to prevent link = errors with -T.

*1. =A0support for ssl was added to ape by importing mp, sec, bio into
ape. =A0(necessary to avoid using openssl)

*2. =A0<inttypes.h> was moved to /$objtype/include/ape because it'= ;s not
portable. =A0(necessary for amd64 port)

3. ip6 support was added.

*4. =A0inet_ntop, inet_pton, getaddrinfo (and friends) were added.
python doesn't work well with old-style name lookup.

5. =A0librexexp was fixed in line with fixes to the normal lib.

6. =A0Rune and wchar_t are an uint/int for 21-bit runes. =A0decode 21-bit runes in mbwc.c

7. =A0getcallerpc/getfcr implemented for all arches.

8. make qsort 64-bit safe.

9. =A0fix const in strcspn, strpbrk, strrchr, strspn, strstr, rename, pathc= onf

10. =A0fix types in setuid, setgid, signal, mkfifo, getgrent, getpwent

11. =A0fix conflict between bind() [libdraw] and bind [socket].

12. =A0fmt: fix %p; fix %C (21-bit rune)

13. =A0utf: 21-bit runes

14. =A0libv: fix impossible definition of nap().

- erik


--089e013cba6210eaa104ec9581dd--