summaryrefslogtreecommitdiff
path: root/src/cmd/gc/go.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/gc/go.h')
-rw-r--r--src/cmd/gc/go.h59
1 files changed, 50 insertions, 9 deletions
diff --git a/src/cmd/gc/go.h b/src/cmd/gc/go.h
index e94eb90ee..562f16890 100644
--- a/src/cmd/gc/go.h
+++ b/src/cmd/gc/go.h
@@ -63,6 +63,8 @@ enum
ACPLX128,
BADWIDTH = -1000000000,
+
+ MaxStackVarSize = 10*1024*1024,
};
extern vlong MAXWIDTH;
@@ -76,7 +78,7 @@ typedef struct Strlit Strlit;
struct Strlit
{
int32 len;
- char s[3]; // variable
+ char s[1]; // variable
};
enum
@@ -127,6 +129,7 @@ struct Val
} u;
};
+typedef struct Bvec Bvec;
typedef struct Pkg Pkg;
typedef struct Sym Sym;
typedef struct Node Node;
@@ -138,6 +141,7 @@ struct Type
{
uchar etype;
uchar nointerface;
+ uchar noalg;
uchar chan;
uchar trecur; // to detect loops
uchar printed;
@@ -150,6 +154,7 @@ struct Type
uchar broke; // broken type definition.
uchar isddd; // TFIELD is ... argument
uchar align;
+ uchar haspointers; // 0 unknown, 1 no, 2 yes
Node* nod; // canonical OTYPE node
Type* orig; // original type (type literal or predefined type)
@@ -182,14 +187,17 @@ struct Type
// TARRAY
vlong bound; // negative is dynamic array
+ // TMAP
+ Type* bucket; // internal type representing a hash bucket
+ Type* hmap; // internal type representing a Hmap (map header object)
+
int32 maplineno; // first use of TFORW as map key
int32 embedlineno; // first use of TFORW as embedded type
// for TFORW, where to copy the eventual value to
NodeList *copyto;
- // for usefield
- Node *lastfn;
+ Node *lastfn; // for usefield
};
#define T ((Type*)0)
@@ -265,8 +273,10 @@ struct Node
uchar implicit;
uchar addrtaken; // address taken, even if not moved to heap
uchar dupok; // duplicate definitions ok (for func)
+ uchar wrapper; // is method wrapper (for func)
schar likely; // likeliness of if statement
uchar hasbreak; // has break statement
+ uchar needzero; // if it contains pointers, needs to be zeroed on function entry
uint esc; // EscXXX
int funcdepth;
@@ -327,6 +337,7 @@ struct Node
int32 iota;
uint32 walkgen;
int32 esclevel;
+ void* opt; // for optimization passes
};
#define N ((Node*)0)
@@ -371,6 +382,7 @@ struct Sym
Sym* link;
int32 npkg; // number of imported packages with this name
uint32 uniqgen;
+ Pkg* importdef; // where imported definition was found
// saved and restored by dcopy
Pkg* pkg;
@@ -519,6 +531,8 @@ enum
OSLICE, // v[1:2], typechecking may convert to a more specfic OSLICEXXX.
OSLICEARR, // a[1:2]
OSLICESTR, // s[1:2]
+ OSLICE3, // v[1:2:3], typechecking may convert to OSLICE3ARR.
+ OSLICE3ARR, // a[1:2:3]
ORECOVER, // recover
ORECV, // <-c
ORUNESTR, // string(i)
@@ -565,9 +579,10 @@ enum
OINLCALL, // intermediary representation of an inlined call.
OEFACE, // itable and data words of an empty-interface value.
OITAB, // itable word of an interface value.
+ OSPTR, // base pointer of a slice or string.
OCLOSUREVAR, // variable reference at beginning of closure function
OCFUNC, // reference to c function pointer (not go func value)
- OCHECKNOTNIL, // emit code to ensure pointer/interface not nil
+ OCHECKNIL, // emit code to ensure pointer/interface not nil
// arch-specific registers
OREGISTER, // a register, such as AX.
@@ -581,6 +596,7 @@ enum
OHMUL, // high mul: AMUL/AIMUL for unsigned/signed (OMUL uses AIMUL for both).
OLROT, // left rotate: AROL.
ORROTC, // right rotate-carry: ARCR.
+ ORETJMP, // return to other function
OEND,
};
@@ -697,6 +713,12 @@ struct Bits
EXTERN Bits zbits;
+struct Bvec
+{
+ int32 n; // number of bits
+ uint32 b[];
+};
+
typedef struct Var Var;
struct Var
{
@@ -741,6 +763,7 @@ struct Io
int32 ilineno;
int nlsemi;
int eofnl;
+ int last;
int peekc;
int peekc1; // second peekc for ...
char* cp; // used for content when bin==nil
@@ -851,6 +874,8 @@ EXTERN char namebuf[NSYMB];
EXTERN char lexbuf[NSYMB];
EXTERN char litbuf[NSYMB];
EXTERN int debug[256];
+EXTERN char* debugstr;
+EXTERN int debug_checknil;
EXTERN Sym* hash[NHASH];
EXTERN Sym* importmyname; // my name for package
EXTERN Pkg* localpkg; // package being compiled
@@ -924,6 +949,8 @@ EXTERN NodeList* lastconst;
EXTERN Node* lasttype;
EXTERN vlong maxarg;
EXTERN vlong stksize; // stack size for current frame
+EXTERN vlong stkptrsize; // prefix of stack containing pointers
+EXTERN vlong stkzerosize; // prefix of stack that must be zeroed on entry
EXTERN int32 blockgen; // max block number
EXTERN int32 block; // current block number
EXTERN int hasdefer; // flag that curfn has defer statetment
@@ -949,12 +976,14 @@ EXTERN int typecheckok;
EXTERN int compiling_runtime;
EXTERN int compiling_wrappers;
EXTERN int pure_go;
+EXTERN char* flag_installsuffix;
EXTERN int flag_race;
EXTERN int flag_largemodel;
EXTERN int noescape;
EXTERN int nointerface;
EXTERN int fieldtrack_enabled;
+EXTERN int precisestack_enabled;
/*
* y.tab.c
@@ -987,6 +1016,16 @@ Bits bor(Bits a, Bits b);
int bset(Bits a, uint n);
/*
+ * bv.c
+ */
+Bvec* bvalloc(int32 n);
+void bvset(Bvec *bv, int32 i);
+void bvres(Bvec *bv, int32 i);
+int bvget(Bvec *bv, int32 i);
+int bvisempty(Bvec *bv);
+int bvcmp(Bvec *bv1, Bvec *bv2);
+
+/*
* closure.c
*/
Node* closurebody(NodeList *body);
@@ -1042,7 +1081,7 @@ NodeList* constiter(NodeList *vl, Node *t, NodeList *cl);
Node* dclname(Sym *s);
void declare(Node *n, int ctxt);
void dumpdcl(char *st);
-Node* embedded(Sym *s);
+Node* embedded(Sym *s, Pkg *pkg);
Node* fakethis(void);
void funcbody(Node *n);
void funccompile(Node *n, int isclosure);
@@ -1420,20 +1459,22 @@ EXTERN Prog* firstpc;
EXTERN Prog* retpc;
EXTERN Node* nodfp;
+EXTERN int disable_checknil;
int anyregalloc(void);
void betypeinit(void);
void bgen(Node *n, int true, int likely, Prog *to);
-void checkref(Node *n, int force);
-void checknotnil(Node*, NodeList**);
+void checknil(Node*, NodeList**);
+void expandchecks(Prog*);
void cgen(Node*, Node*);
void cgen_asop(Node *n);
void cgen_call(Node *n, int proc);
void cgen_callinter(Node *n, Node *res, int proc);
+void cgen_checknil(Node*);
void cgen_ret(Node *n);
void clearfat(Node *n);
void compile(Node*);
-void defframe(Prog*);
+void defframe(Prog*, Bvec*);
int dgostringptr(Sym*, int off, char *str);
int dgostrlitptr(Sym*, int off, Strlit*);
int dstringptr(Sym *s, int off, char *str);
@@ -1445,11 +1486,11 @@ void fixautoused(Prog*);
void gdata(Node*, Node*, int);
void gdatacomplex(Node*, Mpcplx*);
void gdatastring(Node*, Strlit*);
-void genembedtramp(Type*, Type*, Sym*, int iface);
void ggloblnod(Node *nam);
void ggloblsym(Sym *s, int32 width, int dupok, int rodata);
Prog* gjmp(Prog*);
void gused(Node*);
+void movelarge(NodeList*);
int isfat(Type*);
void markautoused(Prog*);
Plist* newplist(void);