From 5996f13128bd9aa828ea2677819f055845553c74 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Tue, 4 Nov 2014 16:34:56 -0500 Subject: [dev.power64] gc: convert Bits to a uint64 array So far all of our architectures have had at most 32 registers, so we've been able to use entry 0 in the Bits uint32 array directly as a register mask. Power64 has 64 registers, so this converts Bits to a uint64 array so we can continue to use entry 0 directly as a register mask on Power64. LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/169060043 --- src/cmd/gc/go.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/cmd/gc/go.h') diff --git a/src/cmd/gc/go.h b/src/cmd/gc/go.h index 965a0550d..d3c4193b5 100644 --- a/src/cmd/gc/go.h +++ b/src/cmd/gc/go.h @@ -704,13 +704,13 @@ enum Ecomplit = 1<<11, // type in composite literal }; -#define BITS 5 -#define NVAR (BITS*sizeof(uint32)*8) +#define BITS 3 +#define NVAR (BITS*sizeof(uint64)*8) typedef struct Bits Bits; struct Bits { - uint32 b[BITS]; + uint64 b[BITS]; }; EXTERN Bits zbits; @@ -1027,12 +1027,14 @@ int Qconv(Fmt *fp); Bits band(Bits a, Bits b); int bany(Bits *a); int beq(Bits a, Bits b); -int bitno(int32 b); +int bitno(uint64 b); Bits blsh(uint n); Bits bnot(Bits a); int bnum(Bits a); Bits bor(Bits a, Bits b); -int bset(Bits a, uint n); +int btest(Bits *a, uint n); +void biset(Bits *a, uint n); +void biclr(Bits *a, uint n); /* * bv.c -- cgit v1.2.1 From 1696dca2d75dddd64f27a9bed5951c70a64a6b34 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 11 Nov 2014 01:27:30 -0500 Subject: [dev.cc] cmd/gc: changes for removing runtime C code [This CL is part of the removal of C code from package runtime. See golang.org/s/dev.cc for an overview.] export.c, lex.c: Add -asmhdr flag to write assembly header file with struct field offsets and const values. cmd/dist used to construct this file by interpreting output from the C compiler. Generate it from the Go definitions instead. Also, generate the form we need directly, instead of relying on cmd/dist for reprocessing. lex.c, obj.c: If the C compiler accepted #pragma cgo_xxx, recognize a directive //go:cgo_xxx instead. The effect is the same as in the C compiler: accumulate text into a buffer and emit in the output file, where the linker will find and use it. lex.c, obj.c: Accept //go:linkname to control the external symbol name used for a particular top-level Go variable. This makes it possible to refer to C symbol names but also symbols from other packages. It has always been possible to do this from C and assembly. To drive home the point that this should not be done lightly, require import "unsafe" in any file containing //go:linkname. plive.c, reflect.c, subr.c: Hard-code that interfaces contain only pointers. This means code handling multiword values in the garbage collector and the stack copier can be deleted instead of being converted. This change is already present in the dev.garbage branch. LGTM=r R=r CC=austin, golang-codereviews, iant, khr https://codereview.appspot.com/169360043 --- src/cmd/gc/go.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/cmd/gc/go.h') diff --git a/src/cmd/gc/go.h b/src/cmd/gc/go.h index 965a0550d..92625f919 100644 --- a/src/cmd/gc/go.h +++ b/src/cmd/gc/go.h @@ -382,6 +382,7 @@ enum SymExported = 1<<2, // already written out by export SymUniq = 1<<3, SymSiggen = 1<<4, + SymAsm = 1<<5, }; struct Sym @@ -393,6 +394,7 @@ struct Sym int32 npkg; // number of imported packages with this name uint32 uniqgen; Pkg* importdef; // where imported definition was found + char* linkname; // link name // saved and restored by dcopy Pkg* pkg; @@ -860,6 +862,8 @@ EXTERN int32 lexlineno; EXTERN int32 lineno; EXTERN int32 prevlineno; +EXTERN Fmt pragcgobuf; + EXTERN char* infile; EXTERN char* outfile; EXTERN Biobuf* bout; @@ -890,6 +894,7 @@ EXTERN Pkg* typelinkpkg; // fake package for runtime type info (data) EXTERN Pkg* weaktypepkg; // weak references to runtime type info EXTERN Pkg* unsafepkg; // package unsafe EXTERN Pkg* trackpkg; // fake package for field tracking +EXTERN Pkg* rawpkg; // fake package for raw symbol names EXTERN Pkg* phash[128]; EXTERN int tptr; // either TPTR32 or TPTR64 extern char* runtimeimport; @@ -897,6 +902,7 @@ extern char* unsafeimport; EXTERN char* myimportpath; EXTERN Idir* idirs; EXTERN char* localimport; +EXTERN char* asmhdr; EXTERN Type* types[NTYPE]; EXTERN Type* idealstring; @@ -1145,6 +1151,7 @@ void escapes(NodeList*); */ void autoexport(Node *n, int ctxt); void dumpexport(void); +void dumpasmhdr(void); int exportname(char *s); void exportsym(Node *n); void importconst(Sym *s, Type *t, Node *n); -- cgit v1.2.1