~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to src/cmd/gc/go.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
137
137
struct  Type
138
138
{
139
139
        uchar   etype;
 
140
        uchar   nointerface;
140
141
        uchar   chan;
141
142
        uchar   trecur;         // to detect loops
142
143
        uchar   printed;
146
147
        uchar   copyany;
147
148
        uchar   local;          // created in this file
148
149
        uchar   deferwidth;
149
 
        uchar   broke;
 
150
        uchar   broke;          // broken type definition.
150
151
        uchar   isddd;          // TFIELD is ... argument
151
152
        uchar   align;
152
153
 
154
155
        Type*   orig;           // original type (type literal or predefined type)
155
156
        int             lineno;
156
157
 
157
 
        // TFUNCT
158
 
        uchar   thistuple;
159
 
        uchar   outtuple;
160
 
        uchar   intuple;
 
158
        // TFUNC
 
159
        int     thistuple;
 
160
        int     outtuple;
 
161
        int     intuple;
161
162
        uchar   outnamed;
162
163
 
163
164
        Type*   method;
170
171
        vlong   argwid;
171
172
 
172
173
        // most nodes
173
 
        Type*   type;
174
 
        vlong   width;          // offset in TFIELD, width in all others
 
174
        Type*   type;           // actual type for TFIELD, element type for TARRAY, TCHAN, TMAP, TPTRxx
 
175
        vlong   width;          // offset in TFIELD, width in all others
175
176
 
176
177
        // TFIELD
177
 
        Type*   down;           // also used in TMAP
 
178
        Type*   down;           // next struct field, also key type in TMAP
 
179
        Type*   outer;          // outer struct
178
180
        Strlit* note;           // literal string annotation
179
181
 
180
182
        // TARRAY
181
 
        int32   bound;          // negative is dynamic array
 
183
        vlong   bound;          // negative is dynamic array
182
184
 
183
185
        int32   maplineno;      // first use of TFORW as map key
184
186
        int32   embedlineno;    // first use of TFORW as embedded type
185
187
        
186
188
        // for TFORW, where to copy the eventual value to
187
189
        NodeList        *copyto;
 
190
        
 
191
        // for usefield
 
192
        Node    *lastfn;
188
193
};
189
194
#define T       ((Type*)0)
190
195
 
215
220
        EscHeap,
216
221
        EscScope,
217
222
        EscNone,
 
223
        EscReturn,
218
224
        EscNever,
 
225
        EscBits = 4,
 
226
        EscMask = (1<<EscBits) - 1,
219
227
};
220
228
 
221
229
struct  Node
233
241
        NodeList*       rlist;
234
242
 
235
243
        uchar   op;
 
244
        uchar   nointerface;
236
245
        uchar   ullman;         // sethi/ullman number
237
246
        uchar   addable;        // type of addressability - 0 is not addressable
238
247
        uchar   trecur;         // to detect loops
239
248
        uchar   etype;          // op for OASOP, etype for OTYPE, exclam for export
 
249
        uchar   bounded;        // bounds check unnecessary
240
250
        uchar   class;          // PPARAM, PAUTO, PEXTERN, etc
241
251
        uchar   method;         // OCALLMETH name
242
252
        uchar   embedded;       // ODCLFIELD embedded type
243
253
        uchar   colas;          // OAS resulting from :=
244
254
        uchar   diag;           // already printed error about this
245
 
        uchar   esc;            // EscXXX
246
 
        uchar   funcdepth;
 
255
        uchar   noescape;       // func arguments do not escape
247
256
        uchar   builtin;        // built-in name, like len or close
248
257
        uchar   walkdef;
249
258
        uchar   typecheck;
256
265
        uchar   implicit;
257
266
        uchar   addrtaken;      // address taken, even if not moved to heap
258
267
        uchar   dupok;  // duplicate definitions ok (for func)
 
268
        schar   likely; // likeliness of if statement
 
269
        uchar   hasbreak;       // has break statement
 
270
        uint    esc;            // EscXXX
 
271
        int     funcdepth;
259
272
 
260
273
        // most nodes
261
274
        Type*   type;
262
 
        Type*   realtype;       // as determined by typecheck
263
275
        Node*   orig;           // original form, for printing, and tracking copies of ONAMEs
264
276
 
265
277
        // func
270
282
        NodeList*       cvars;  // closure params
271
283
        NodeList*       dcl;    // autodcl for this func/closure
272
284
        NodeList*       inl;    // copy of the body for use in inlining
 
285
        NodeList*       inldcl; // copy of dcl for use in inlining
273
286
 
274
287
        // OLITERAL/OREGISTER
275
288
        Val     val;
279
292
        Node*   defn;   // ONAME: initializing assignment; OLABEL: labeled statement
280
293
        Node*   pack;   // real package for import . names
281
294
        Node*   curfn;  // function for local variables
282
 
        Type*   paramfld; // TFIELD for this PPARAM
 
295
        Type*   paramfld; // TFIELD for this PPARAM; also for ODOT, curfn
283
296
 
284
297
        // ONAME func param with PHEAP
285
298
        Node*   heapaddr;       // temp holding heap address of param
301
314
 
302
315
        // Escape analysis.
303
316
        NodeList* escflowsrc;   // flow(this, src)
304
 
        int     escloopdepth;   // -1: global, 0: not set, function top level:1, increased inside function for every loop or label to mark scopes
 
317
        NodeList* escretval;    // on OCALLxxx, list of dummy return values
 
318
        int     escloopdepth;   // -1: global, 0: return variables, 1:function top level, increased inside function for every loop or label to mark scopes
305
319
 
306
320
        Sym*    sym;            // various
307
321
        int32   vargen;         // unique name for OTYPE/ONAME
308
322
        int32   lineno;
309
323
        int32   endlineno;
310
324
        vlong   xoffset;
311
 
        int32   stkdelta;       // offset added by stack frame compaction phase.
 
325
        vlong   stkdelta;       // offset added by stack frame compaction phase.
312
326
        int32   ostk;
313
327
        int32   iota;
314
328
        uint32  walkgen;
 
329
        int32   esclevel;
315
330
};
316
331
#define N       ((Node*)0)
317
332
 
345
360
        SymExported     = 1<<2, // already written out by export
346
361
        SymUniq         = 1<<3,
347
362
        SymSiggen       = 1<<4,
 
363
        SymGcgen        = 1<<5,
348
364
};
349
365
 
350
366
struct  Sym
354
370
        uchar   sym;            // huffman encoding in object file
355
371
        Sym*    link;
356
372
        int32   npkg;   // number of imported packages with this name
 
373
        uint32  uniqgen;
357
374
 
358
375
        // saved and restored by dcopy
359
376
        Pkg*    pkg;
362
379
        Label*  label;  // corresponding label (ephemeral)
363
380
        int32   block;          // blocknumber to catch redeclaration
364
381
        int32   lastlineno;     // last declaration for diagnostic
 
382
        Pkg*    origpkg;        // original package for . import
365
383
};
366
384
#define S       ((Sym*)0)
367
385
 
374
392
        Sym*    pathsym;
375
393
        char*   prefix;         // escaped path for use in symbol table
376
394
        Pkg*    link;
 
395
        uchar   imported;       // export data of this package was parsed
377
396
        char    exported;       // import line written in export data
378
397
        char    direct; // imported directly
 
398
        char    safe;   // whether the package is marked as safe
379
399
};
380
400
 
381
401
typedef struct  Iter    Iter;
398
418
};
399
419
#define H       ((Hist*)0)
400
420
 
 
421
// Node ops.
401
422
enum
402
423
{
403
424
        OXXX,
404
425
 
405
426
        // names
406
 
        ONAME,
407
 
        ONONAME,
408
 
        OTYPE,
409
 
        OPACK,
410
 
        OLITERAL,
411
 
 
412
 
        // exprs
413
 
        OADD, OSUB, OOR, OXOR, OADDSTR,
414
 
        OADDR,
415
 
        OANDAND,
416
 
        OAPPEND,
417
 
        OARRAYBYTESTR, OARRAYRUNESTR,
418
 
        OSTRARRAYBYTE, OSTRARRAYRUNE,
419
 
        OAS, OAS2, OAS2FUNC, OAS2RECV, OAS2MAPR, OAS2DOTTYPE,
420
 
        OASOP,
421
 
        OBAD,
422
 
        OCALL, OCALLFUNC, OCALLMETH, OCALLINTER,
423
 
        OCAP,
424
 
        OCLOSE,
425
 
        OCLOSURE,
426
 
        OCMPIFACE, OCMPSTR,
427
 
        OCOMPLIT, OMAPLIT, OSTRUCTLIT, OARRAYLIT, OPTRLIT,
428
 
        OCONV, OCONVIFACE, OCONVNOP,
429
 
        OCOPY,
430
 
        ODCL, ODCLFUNC, ODCLFIELD, ODCLCONST, ODCLTYPE,
431
 
        ODELETE,
432
 
        ODOT, ODOTPTR, ODOTMETH, ODOTINTER, OXDOT,
433
 
        ODOTTYPE,
434
 
        ODOTTYPE2,
435
 
        OEQ, ONE, OLT, OLE, OGE, OGT,
436
 
        OIND,
437
 
        OINDEX, OINDEXMAP,
438
 
        OKEY, OPARAM,
439
 
        OLEN,
440
 
        OMAKE, OMAKECHAN, OMAKEMAP, OMAKESLICE,
441
 
        OHMUL, ORRC, OLRC,      // high-mul and rotate-carry
442
 
        OMUL, ODIV, OMOD, OLSH, ORSH, OAND, OANDNOT,
443
 
        ONEW,
444
 
        ONOT, OCOM, OPLUS, OMINUS,
445
 
        OOROR,
446
 
        OPANIC, OPRINT, OPRINTN,
447
 
        OPAREN,
448
 
        OSEND,
449
 
        OSLICE, OSLICEARR, OSLICESTR,
450
 
        ORECOVER,
451
 
        ORECV,
452
 
        ORUNESTR,
453
 
        OSELRECV,
454
 
        OSELRECV2,
455
 
        OIOTA,
456
 
        OREAL, OIMAG, OCOMPLEX,
457
 
 
458
 
        // stmts
459
 
        OBLOCK,
460
 
        OBREAK,
461
 
        OCASE, OXCASE,
462
 
        OCONTINUE,
463
 
        ODEFER,
464
 
        OEMPTY,
465
 
        OFALL, OXFALL,
466
 
        OFOR,
467
 
        OGOTO,
468
 
        OIF,
469
 
        OLABEL,
470
 
        OPROC,
471
 
        ORANGE,
472
 
        ORETURN,
473
 
        OSELECT,
474
 
        OSWITCH,
475
 
        OTYPESW,        // l = r.(type)
 
427
        ONAME,  // var, const or func name
 
428
        ONONAME,        // unnamed arg or return value: f(int, string) (int, error) { etc }
 
429
        OTYPE,  // type name
 
430
        OPACK,  // import
 
431
        OLITERAL, // literal
 
432
 
 
433
        // expressions
 
434
        OADD,   // x + y
 
435
        OSUB,   // x - y
 
436
        OOR,    // x | y
 
437
        OXOR,   // x ^ y
 
438
        OADDSTR,        // s + "foo"
 
439
        OADDR,  // &x
 
440
        OANDAND,        // b0 && b1
 
441
        OAPPEND,        // append
 
442
        OARRAYBYTESTR,  // string(bytes)
 
443
        OARRAYRUNESTR,  // string(runes)
 
444
        OSTRARRAYBYTE,  // []byte(s)
 
445
        OSTRARRAYRUNE,  // []rune(s)
 
446
        OAS,    // x = y or x := y
 
447
        OAS2,   // x, y, z = xx, yy, zz
 
448
        OAS2FUNC,       // x, y = f()
 
449
        OAS2RECV,       // x, ok = <-c
 
450
        OAS2MAPR,       // x, ok = m["foo"]
 
451
        OAS2DOTTYPE,    // x, ok = I.(int)
 
452
        OASOP,  // x += y
 
453
        OCALL,  // function call, method call or type conversion, possibly preceded by defer or go.
 
454
        OCALLFUNC,      // f()
 
455
        OCALLMETH,      // t.Method()
 
456
        OCALLINTER,     // err.Error()
 
457
        OCALLPART,      // t.Method (without ())
 
458
        OCAP,   // cap
 
459
        OCLOSE, // close
 
460
        OCLOSURE,       // f = func() { etc }
 
461
        OCMPIFACE,      // err1 == err2
 
462
        OCMPSTR,        // s1 == s2
 
463
        OCOMPLIT,       // composite literal, typechecking may convert to a more specific OXXXLIT.
 
464
        OMAPLIT,        // M{"foo":3, "bar":4}
 
465
        OSTRUCTLIT,     // T{x:3, y:4}
 
466
        OARRAYLIT,      // [2]int{3, 4}
 
467
        OPTRLIT,        // &T{x:3, y:4}
 
468
        OCONV,  // var i int; var u uint; i = int(u)
 
469
        OCONVIFACE,     // I(t)
 
470
        OCONVNOP,       // type Int int; var i int; var j Int; i = int(j)
 
471
        OCOPY,  // copy
 
472
        ODCL,   // var x int
 
473
        ODCLFUNC,       // func f() or func (r) f()
 
474
        ODCLFIELD,      // struct field, interface field, or func/method argument/return value.
 
475
        ODCLCONST,      // const pi = 3.14
 
476
        ODCLTYPE,       // type Int int
 
477
        ODELETE,        // delete
 
478
        ODOT,   // t.x
 
479
        ODOTPTR,        // p.x that is implicitly (*p).x
 
480
        ODOTMETH,       // t.Method
 
481
        ODOTINTER,      // err.Error
 
482
        OXDOT,  // t.x, typechecking may convert to a more specific ODOTXXX.
 
483
        ODOTTYPE,       // e = err.(MyErr)
 
484
        ODOTTYPE2,      // e, ok = err.(MyErr)
 
485
        OEQ,    // x == y
 
486
        ONE,    // x != y
 
487
        OLT,    // x < y
 
488
        OLE,    // x <= y
 
489
        OGE,    // x >= y
 
490
        OGT,    // x > y
 
491
        OIND,   // *p
 
492
        OINDEX, // a[i]
 
493
        OINDEXMAP,      // m[s]
 
494
        OKEY,   // The x:3 in t{x:3, y:4}, the 1:2 in a[1:2], the 2:20 in [3]int{2:20}, etc.
 
495
        OPARAM, // The on-stack copy of a parameter or return value that escapes.
 
496
        OLEN,   // len
 
497
        OMAKE,  // make, typechecking may convert to a more specfic OMAKEXXX.
 
498
        OMAKECHAN,      // make(chan int)
 
499
        OMAKEMAP,       // make(map[string]int)
 
500
        OMAKESLICE,     // make([]int, 0)
 
501
        OMUL,   // x * y
 
502
        ODIV,   // x / y
 
503
        OMOD,   // x % y
 
504
        OLSH,   // x << u
 
505
        ORSH,   // x >> u
 
506
        OAND,   // x & y
 
507
        OANDNOT,        // x &^ y
 
508
        ONEW,   // new
 
509
        ONOT,   // !b
 
510
        OCOM,   // ^x
 
511
        OPLUS,  // +x
 
512
        OMINUS, // -y
 
513
        OOROR,  // b1 || b2
 
514
        OPANIC, // panic
 
515
        OPRINT, // print
 
516
        OPRINTN,        // println
 
517
        OPAREN, // (x)
 
518
        OSEND,  // c <- x
 
519
        OSLICE, // v[1:2], typechecking may convert to a more specfic OSLICEXXX.
 
520
        OSLICEARR,      // a[1:2]
 
521
        OSLICESTR,      // s[1:2]
 
522
        ORECOVER,       // recover
 
523
        ORECV,  // <-c
 
524
        ORUNESTR,       // string(i)
 
525
        OSELRECV,       // case x = <-c:
 
526
        OSELRECV2,      // case x, ok = <-c:
 
527
        OIOTA,  // iota
 
528
        OREAL,  // real
 
529
        OIMAG,  // imag
 
530
        OCOMPLEX,       // complex
 
531
 
 
532
        // statements
 
533
        OBLOCK, // block of code
 
534
        OBREAK, // break
 
535
        OCASE,  // case, after being verified by swt.c's casebody.
 
536
        OXCASE, // case, before verification.
 
537
        OCONTINUE,      // continue
 
538
        ODEFER, // defer
 
539
        OEMPTY, // no-op
 
540
        OFALL,  // fallthrough, after being verified by swt.c's casebody.
 
541
        OXFALL, // fallthrough, before verification.
 
542
        OFOR,   // for
 
543
        OGOTO,  // goto
 
544
        OIF,    // if
 
545
        OLABEL, // label:
 
546
        OPROC,  // go
 
547
        ORANGE, // range
 
548
        ORETURN,        // return
 
549
        OSELECT,        // select
 
550
        OSWITCH,        // switch x
 
551
        OTYPESW,        // switch err.(type)
476
552
 
477
553
        // types
478
 
        OTCHAN,
479
 
        OTMAP,
480
 
        OTSTRUCT,
481
 
        OTINTER,
482
 
        OTFUNC,
483
 
        OTARRAY,
484
 
        OTPAREN,
 
554
        OTCHAN, // chan int
 
555
        OTMAP,  // map[string]int
 
556
        OTSTRUCT,       // struct{}
 
557
        OTINTER,        // interface{}
 
558
        OTFUNC, // func()
 
559
        OTARRAY,        // []int, [8]int, [N]int or [...]int
 
560
        OTPAREN,        // (T)
485
561
 
486
562
        // misc
487
 
        ODDD,
488
 
        ODDDARG,
489
 
        OINLCALL,       // intermediary representation of an inlined call
490
 
        OITAB,  // itable word of interface value
491
 
 
492
 
        // for back ends
493
 
        OCMP, ODEC, OEXTEND, OINC, OREGISTER, OINDREG,
 
563
        ODDD,   // func f(args ...int) or f(l...) or var a = [...]int{0, 1, 2}.
 
564
        ODDDARG,        // func f(args ...int), introduced by escape analysis.
 
565
        OINLCALL,       // intermediary representation of an inlined call.
 
566
        OEFACE, // itable and data words of an empty-interface value.
 
567
        OITAB,  // itable word of an interface value.
 
568
        OCLOSUREVAR, // variable reference at beginning of closure function
 
569
        OCFUNC, // reference to c function pointer (not go func value)
 
570
        OCHECKNOTNIL, // emit code to ensure pointer/interface not nil
 
571
 
 
572
        // arch-specific registers
 
573
        OREGISTER,      // a register, such as AX.
 
574
        OINDREG,        // offset plus indirect of a register, such as 8(SP).
 
575
 
 
576
        // 386/amd64-specific opcodes
 
577
        OCMP,   // compare: ACMP.
 
578
        ODEC,   // decrement: ADEC.
 
579
        OINC,   // increment: AINC.
 
580
        OEXTEND,        // extend: ACWD/ACDQ/ACQO.
 
581
        OHMUL, // high mul: AMUL/AIMUL for unsigned/signed (OMUL uses AIMUL for both).
 
582
        OLROT,  // left rotate: AROL.
 
583
        ORROTC, // right rotate-carry: ARCR.
494
584
 
495
585
        OEND,
496
586
};
 
587
 
497
588
enum
498
589
{
499
590
        Txxx,                   // 0
539
630
 
540
631
        NTYPE,
541
632
};
 
633
 
542
634
enum
543
635
{
544
636
        CTxxx,
562
654
        Cboth = Crecv | Csend,
563
655
};
564
656
 
 
657
// declaration context
565
658
enum
566
659
{
567
660
        Pxxx,
568
661
 
569
 
        PEXTERN,        // declaration context
570
 
        PAUTO,
571
 
        PPARAM,
572
 
        PPARAMOUT,
573
 
        PPARAMREF,      // param passed by reference
574
 
        PFUNC,
575
 
 
576
 
        PHEAP = 1<<7,
 
662
        PEXTERN,        // global variable
 
663
        PAUTO,          // local variables
 
664
        PPARAM,         // input arguments
 
665
        PPARAMOUT,      // output results
 
666
        PPARAMREF,      // closure variable reference
 
667
        PFUNC,          // global function
 
668
 
 
669
        PDISCARD,       // discard during parse of duplicate import
 
670
 
 
671
        PHEAP = 1<<7,   // an extra bit to identify an escaped variable
577
672
};
578
673
 
579
674
enum
606
701
struct  Var
607
702
{
608
703
        vlong   offset;
609
 
        Sym*    gotype;
610
704
        Node*   node;
611
705
        int     width;
612
706
        char    name;
756
850
EXTERN  char    namebuf[NSYMB];
757
851
EXTERN  char    lexbuf[NSYMB];
758
852
EXTERN  char    litbuf[NSYMB];
759
 
EXTERN  char    debug[256];
 
853
EXTERN  int     debug[256];
760
854
EXTERN  Sym*    hash[NHASH];
761
855
EXTERN  Sym*    importmyname;   // my name for package
762
856
EXTERN  Pkg*    localpkg;       // package being compiled
764
858
EXTERN  Pkg*    structpkg;      // package that declared struct, during import
765
859
EXTERN  Pkg*    builtinpkg;     // fake package for builtins
766
860
EXTERN  Pkg*    gostringpkg;    // fake pkg for Go strings
 
861
EXTERN  Pkg*    itabpkg;        // fake pkg for itab cache
767
862
EXTERN  Pkg*    runtimepkg;     // package runtime
 
863
EXTERN  Pkg*    racepkg;        // package runtime/race
768
864
EXTERN  Pkg*    stringpkg;      // fake package for C strings
769
 
EXTERN  Pkg*    typepkg;        // fake package for runtime type info
 
865
EXTERN  Pkg*    typepkg;        // fake package for runtime type info (headers)
 
866
EXTERN  Pkg*    typelinkpkg;    // fake package for runtime type info (data)
770
867
EXTERN  Pkg*    weaktypepkg;    // weak references to runtime type info
771
868
EXTERN  Pkg*    unsafepkg;      // package unsafe
 
869
EXTERN  Pkg*    trackpkg;       // fake package for field tracking
772
870
EXTERN  Pkg*    phash[128];
773
871
EXTERN  int     tptr;           // either TPTR32 or TPTR64
774
872
extern  char*   runtimeimport;
815
913
EXTERN  NodeList*       closures;
816
914
EXTERN  NodeList*       exportlist;
817
915
EXTERN  NodeList*       importlist;     // imported functions and methods with inlinable bodies
 
916
EXTERN  NodeList*       funcsyms;
818
917
EXTERN  int     dclcontext;             // PEXTERN/PAUTO
819
918
EXTERN  int     incannedimport;
820
919
EXTERN  int     statuniqgen;            // name generator for static temps
823
922
EXTERN  int32   iota;
824
923
EXTERN  NodeList*       lastconst;
825
924
EXTERN  Node*   lasttype;
826
 
EXTERN  int32   maxarg;
827
 
EXTERN  int32   stksize;                // stack size for current frame
 
925
EXTERN  vlong   maxarg;
 
926
EXTERN  vlong   stksize;                // stack size for current frame
828
927
EXTERN  int32   blockgen;               // max block number
829
928
EXTERN  int32   block;                  // current block number
830
929
EXTERN  int     hasdefer;               // flag that curfn has defer statetment
832
931
EXTERN  Node*   curfn;
833
932
 
834
933
EXTERN  int     widthptr;
 
934
EXTERN  int     widthint;
835
935
 
836
936
EXTERN  Node*   typesw;
837
937
EXTERN  Node*   nblank;
838
938
 
839
939
extern  int     thechar;
840
940
extern  char*   thestring;
 
941
EXTERN  int     use_sse;
841
942
 
842
943
EXTERN  char*   hunk;
843
944
EXTERN  int32   nhunk;
846
947
EXTERN  int     funcdepth;
847
948
EXTERN  int     typecheckok;
848
949
EXTERN  int     compiling_runtime;
 
950
EXTERN  int     compiling_wrappers;
 
951
EXTERN  int     pure_go;
 
952
EXTERN  int     flag_race;
 
953
EXTERN  int     flag_largemodel;
 
954
EXTERN  int     noescape;
 
955
 
 
956
EXTERN  int     nointerface;
 
957
EXTERN  int     fieldtrack_enabled;
849
958
 
850
959
/*
851
960
 *      y.tab.c
860
969
void    defercheckwidth(void);
861
970
void    dowidth(Type *t);
862
971
void    resumecheckwidth(void);
863
 
uint32  rnd(uint32 o, uint32 r);
 
972
vlong   rnd(vlong o, vlong r);
864
973
void    typeinit(void);
865
974
 
866
975
/*
884
993
void    closurehdr(Node *ntype);
885
994
void    typecheckclosure(Node *func, int top);
886
995
Node*   walkclosure(Node *func, NodeList **init);
887
 
void    walkcallclosure(Node *n, NodeList **init);
 
996
void    typecheckpartialcall(Node*, Node*);
 
997
Node*   walkpartialcall(Node*, NodeList**);
888
998
 
889
999
/*
890
1000
 *      const.c
898
1008
void    defaultlit2(Node **lp, Node **rp, int force);
899
1009
void    evconst(Node *n);
900
1010
int     isconst(Node *n, int ct);
 
1011
int     isgoconst(Node *n);
901
1012
Node*   nodcplxlit(Val r, Val i);
902
1013
Node*   nodlit(Val v);
903
1014
long    nonnegconst(Node *n);
 
1015
int     doesoverflow(Val v, Type *t);
904
1016
void    overflow(Val v, Type *t);
905
1017
int     smallintconst(Node *n);
906
1018
Val     toint(Val v);
910
1022
 *      cplx.c
911
1023
 */
912
1024
void    complexadd(int op, Node *nl, Node *nr, Node *res);
913
 
void    complexbool(int op, Node *nl, Node *nr, int true, Prog *to);
 
1025
void    complexbool(int op, Node *nl, Node *nr, int true, int likely, Prog *to);
914
1026
void    complexgen(Node *n, Node *res);
915
1027
void    complexminus(Node *nl, Node *res);
916
1028
void    complexmove(Node *f, Node *t);
921
1033
/*
922
1034
 *      dcl.c
923
1035
 */
924
 
void    addmethod(Sym *sf, Type *t, int local);
 
1036
void    addmethod(Sym *sf, Type *t, int local, int nointerface);
925
1037
void    addvar(Node *n, Type *t, int ctxt);
926
1038
NodeList*       checkarglist(NodeList *all, int input);
927
 
Node*   colas(NodeList *left, NodeList *right);
 
1039
Node*   colas(NodeList *left, NodeList *right, int32 lno);
928
1040
void    colasdefn(NodeList *left, Node *defn);
929
1041
NodeList*       constiter(NodeList *vl, Node *t, NodeList *cl);
930
1042
Node*   dclname(Sym *s);
954
1066
Node*   typedcl1(Node *n, Node *t, int local);
955
1067
Node*   typenod(Type *t);
956
1068
NodeList*       variter(NodeList *vl, Node *t, NodeList *el);
 
1069
Sym*    funcsym(Sym*);
957
1070
 
958
1071
/*
959
1072
 *      esc.c
987
1100
void    addrescapes(Node *n);
988
1101
void    cgen_as(Node *nl, Node *nr);
989
1102
void    cgen_callmeth(Node *n, int proc);
 
1103
void    cgen_eface(Node* n, Node* res);
 
1104
void    cgen_slice(Node* n, Node* res);
990
1105
void    clearlabels(void);
991
1106
void    checklabels(void);
992
 
int     dotoffset(Node *n, int *oary, Node **nn);
 
1107
int     dotoffset(Node *n, int64 *oary, Node **nn);
993
1108
void    gen(Node *n);
994
1109
void    genlist(NodeList *l);
995
1110
Node*   sysfunc(char *name);
1115
1230
Type*   methodfunc(Type *f, Type*);
1116
1231
Node*   typename(Type *t);
1117
1232
Sym*    typesym(Type *t);
 
1233
Sym*    typenamesym(Type *t);
 
1234
Sym*    tracksym(Type *t);
1118
1235
Sym*    typesymprefix(char *prefix, Type *t);
1119
1236
int     haspointers(Type *t);
 
1237
void    usefield(Node*);
1120
1238
 
1121
1239
/*
1122
1240
 *      select.c
1214
1332
void    saveerrors(void);
1215
1333
Node*   cheapexpr(Node *n, NodeList **init);
1216
1334
Node*   localexpr(Node *n, Type *t, NodeList **init);
 
1335
void    saveorignode(Node *n);
1217
1336
int32   setlineno(Node *n);
1218
1337
void    setmaxarg(Type *t);
1219
1338
Type*   shallow(Type *t);
1251
1370
void    typechecklist(NodeList *l, int top);
1252
1371
Node*   typecheckdef(Node *n);
1253
1372
void    copytype(Node *n, Type *t);
 
1373
void    checkreturn(Node*);
1254
1374
void    queuemethod(Node *n);
1255
1375
 
1256
1376
/*
1274
1394
void    walkstmt(Node **np);
1275
1395
void    walkstmtlist(NodeList *l);
1276
1396
Node*   conv(Node*, Type*);
 
1397
int     candiscard(Node*);
1277
1398
 
1278
1399
/*
1279
1400
 *      arch-specific ggen.c/gsubr.c/gobj.c/pgen.c
1302
1423
 
1303
1424
int     anyregalloc(void);
1304
1425
void    betypeinit(void);
1305
 
void    bgen(Node *n, int true, Prog *to);
 
1426
void    bgen(Node *n, int true, int likely, Prog *to);
 
1427
void    checkref(Node *n, int force);
 
1428
void    checknotnil(Node*, NodeList**);
1306
1429
void    cgen(Node*, Node*);
1307
1430
void    cgen_asop(Node *n);
1308
1431
void    cgen_call(Node *n, int proc);
1323
1446
void    gdatacomplex(Node*, Mpcplx*);
1324
1447
void    gdatastring(Node*, Strlit*);
1325
1448
void    genembedtramp(Type*, Type*, Sym*, int iface);
1326
 
void    ggloblnod(Node *nam, int32 width);
1327
 
void    ggloblsym(Sym *s, int32 width, int dupok);
 
1449
void    ggloblnod(Node *nam);
 
1450
void    ggloblsym(Sym *s, int32 width, int dupok, int rodata);
1328
1451
Prog*   gjmp(Prog*);
1329
1452
void    gused(Node*);
1330
1453
int     isfat(Type*);
1364
1487
#pragma varargck        type    "V"     Val*
1365
1488
#pragma varargck        type    "Y"     char*
1366
1489
#pragma varargck        type    "Z"     Strlit*
 
1490
 
 
1491
/*
 
1492
 *      racewalk.c
 
1493
 */
 
1494
void    racewalk(Node *fn);