switch(t->etype) {
case TENUM:
if(!typefd[t->etype])
- Bprint(&outbuf, "const %U = %lld\n", s->name, s->vconst);
+ Bprint(&outbuf, "const %s = %lld\n", s->name, s->vconst);
else
- Bprint(&outbuf, "const %U = %f\n;", s->name, s->fconst);
+ Bprint(&outbuf, "const %s = %f\n;", s->name, s->fconst);
break;
case TFUNC:
"\n"
);
+ // Do not emit constant definitions for these.
+ vadd(&seen, "true");
+ vadd(&seen, "false");
+ vadd(&seen, "raceenabled");
// Run 6c -D GOOS_goos -D GOARCH_goarch -I workdir -q -n -o workdir/runtimedefs
// on each of the runtimedefs C files.
splitlines(&lines, bstr(&in));
for(i=0; i<lines.len; i++) {
p = lines.p[i];
- // Drop comment, func, and const lines.
- if(hasprefix(p, "//") || hasprefix(p, "const") || hasprefix(p, "func"))
+ // Drop comment and func lines.
+ if(hasprefix(p, "//") || hasprefix(p, "func"))
continue;
// Note beginning of type or var decl, which can be multiline.
// Remove duplicates. The linear check of seen here makes the
// whole processing quadratic in aggregate, but there are only
// about 100 declarations, so this is okay (and simple).
- if(hasprefix(p, "type ") || hasprefix(p, "var ")) {
+ if(hasprefix(p, "type ") || hasprefix(p, "var ") || hasprefix(p, "const ")) {
splitfields(&fields, p);
if(fields.len < 2)
continue;
}
vadd(&seen, fields.p[1]);
}
+
+ // Const lines are printed in original case (usually upper). Add a leading _ as needed.
+ if(hasprefix(p, "const ")) {
+ if('A' <= p[6] && p[6] <= 'Z')
+ bwritestr(&out, "const _");
+ else
+ bwritestr(&out, "const ");
+ bwritestr(&out, p+6);
+ continue;
+ }
+
if(skip) {
if(hasprefix(p, "}"))
skip = 0;
#include "race.h"
#include "chan.h"
#include "mprof.h"
+#include "defs_GOOS_GOARCH.h"
typedef struct MachNDR MachNDR;
typedef struct MachPort MachPort;
typedef struct StackT StackT;
-typedef struct Sigaction Sigaction;
+typedef struct SigactionT SigactionT;
typedef struct Siginfo Siginfo;
typedef struct Timeval Timeval;
typedef struct Itimerval Itimerval;
typedef struct ExceptionState32 ExceptionState32;
typedef struct Mcontext32 Mcontext32;
typedef struct Ucontext Ucontext;
-typedef struct Kevent Kevent;
+typedef struct KeventT KeventT;
#pragma pack on
};
typedef byte Sighandler[4];
-struct Sigaction {
+struct SigactionT {
byte __sigaction_u[4];
void *sa_tramp;
uint32 sa_mask;
Mcontext32 *uc_mcontext;
};
-struct Kevent {
+struct KeventT {
uint32 ident;
int16 filter;
uint16 flags;
typedef struct MachNDR MachNDR;
typedef struct MachPort MachPort;
typedef struct StackT StackT;
-typedef struct Sigaction Sigaction;
+typedef struct SigactionT SigactionT;
typedef struct Siginfo Siginfo;
typedef struct Timeval Timeval;
typedef struct Itimerval Itimerval;
typedef struct ExceptionState32 ExceptionState32;
typedef struct Mcontext32 Mcontext32;
typedef struct Ucontext Ucontext;
-typedef struct Kevent Kevent;
+typedef struct KeventT KeventT;
#pragma pack on
};
typedef byte Sighandler[8];
-struct Sigaction {
+struct SigactionT {
byte __sigaction_u[8];
void *sa_tramp;
uint32 sa_mask;
Mcontext64 *uc_mcontext;
};
-struct Kevent {
+struct KeventT {
uint64 ident;
int16 filter;
uint16 flags;
typedef struct Timespec Timespec;
typedef struct Timeval Timeval;
typedef struct Itimerval Itimerval;
-typedef struct Kevent Kevent;
+typedef struct KeventT KeventT;
#pragma pack on
Timeval it_value;
};
-struct Kevent {
+struct KeventT {
uint32 ident;
int16 filter;
uint16 flags;
typedef struct Timespec Timespec;
typedef struct Timeval Timeval;
typedef struct Itimerval Itimerval;
-typedef struct Kevent Kevent;
+typedef struct KeventT KeventT;
#pragma pack on
Timeval it_value;
};
-struct Kevent {
+struct KeventT {
uint64 ident;
int16 filter;
uint16 flags;
typedef struct Timespec Timespec;
typedef struct Timeval Timeval;
typedef struct Itimerval Itimerval;
-typedef struct Kevent Kevent;
+typedef struct KeventT KeventT;
#pragma pack on
Timeval it_value;
};
-struct Kevent {
+struct KeventT {
uint32 ident;
int16 filter;
uint16 flags;
typedef struct Timespec Timespec;
typedef struct Timeval Timeval;
typedef struct Itimerval Itimerval;
-typedef struct Kevent Kevent;
+typedef struct KeventT KeventT;
#pragma pack on
Timeval it_value;
};
-struct Kevent {
+struct KeventT {
uint64 ident;
int16 filter;
uint16 flags;
typedef struct Timespec Timespec;
typedef struct Timeval Timeval;
typedef struct Itimerval Itimerval;
-typedef struct Kevent Kevent;
+typedef struct KeventT KeventT;
#pragma pack on
Timeval it_value;
};
-struct Kevent {
+struct KeventT {
uint32 ident;
int16 filter;
uint16 flags;
typedef struct Fpstate Fpstate;
typedef struct Timespec Timespec;
typedef struct Timeval Timeval;
-typedef struct Sigaction Sigaction;
+typedef struct SigactionT SigactionT;
typedef struct Siginfo Siginfo;
typedef struct Sigaltstack Sigaltstack;
typedef struct Sigcontext Sigcontext;
int32 tv_sec;
int32 tv_usec;
};
-struct Sigaction {
+struct SigactionT {
void *k_sa_handler;
uint32 sa_flags;
void *sa_restorer;
typedef struct Timespec Timespec;
typedef struct Timeval Timeval;
-typedef struct Sigaction Sigaction;
+typedef struct SigactionT SigactionT;
typedef struct Siginfo Siginfo;
typedef struct Itimerval Itimerval;
typedef struct EpollEvent EpollEvent;
int64 tv_sec;
int64 tv_usec;
};
-struct Sigaction {
+struct SigactionT {
void *sa_handler;
uint64 sa_flags;
void *sa_restorer;
uint8 _sifields[4];
};
-typedef struct Sigaction Sigaction;
-struct Sigaction {
+typedef struct SigactionT SigactionT;
+struct SigactionT {
void *sa_handler;
uint32 sa_flags;
void *sa_restorer;
typedef struct Itimerval Itimerval;
typedef struct McontextT McontextT;
typedef struct UcontextT UcontextT;
-typedef struct Kevent Kevent;
+typedef struct KeventT KeventT;
#pragma pack on
int32 __uc_pad[4];
};
-struct Kevent {
+struct KeventT {
uint32 ident;
uint32 filter;
uint32 flags;
typedef struct Itimerval Itimerval;
typedef struct McontextT McontextT;
typedef struct UcontextT UcontextT;
-typedef struct Kevent Kevent;
+typedef struct KeventT KeventT;
#pragma pack on
McontextT uc_mcontext;
};
-struct Kevent {
+struct KeventT {
uint64 ident;
uint32 filter;
uint32 flags;
typedef struct Itimerval Itimerval;
typedef struct McontextT McontextT;
typedef struct UcontextT UcontextT;
-typedef struct Kevent Kevent;
+typedef struct KeventT KeventT;
#pragma pack on
int32 __uc_pad[2];
};
-struct Kevent {
+struct KeventT {
uint32 ident;
uint32 filter;
uint32 flags;
typedef struct Timespec Timespec;
typedef struct Timeval Timeval;
typedef struct Itimerval Itimerval;
-typedef struct Kevent Kevent;
+typedef struct KeventT KeventT;
#pragma pack on
Timeval it_value;
};
-struct Kevent {
+struct KeventT {
uint32 ident;
int16 filter;
uint16 flags;
typedef struct Timespec Timespec;
typedef struct Timeval Timeval;
typedef struct Itimerval Itimerval;
-typedef struct Kevent Kevent;
+typedef struct KeventT KeventT;
#pragma pack on
Timeval it_value;
};
-struct Kevent {
+struct KeventT {
uint64 ident;
int16 filter;
uint16 flags;
typedef struct Sigset Sigset;
typedef struct StackT StackT;
typedef struct Siginfo Siginfo;
-typedef struct Sigaction Sigaction;
+typedef struct SigactionT SigactionT;
typedef struct Fpregset Fpregset;
typedef struct Mcontext Mcontext;
typedef struct Ucontext Ucontext;
int32 si_pad;
byte __data[240];
};
-struct Sigaction {
+struct SigactionT {
int32 sa_flags;
byte Pad_cgo_0[4];
byte _funcptr[8];
pageSize = 1 << pageShift
pageMask = pageSize - 1
- gcBits = 4
- wordsPerBitmapByte = 8 / gcBits
- bitsPerPointer = 2
- bitsMask = 1<<bitsPerPointer - 1
- pointersPerByte = 8 / bitsPerPointer
- bitPtrMask = bitsMask << 2
- maxGCMask = 64
- bitsDead = 0
- bitsPointer = 2
+ bitsPerPointer = 2
+ bitsMask = 1<<bitsPerPointer - 1
+ pointersPerByte = 8 / bitsPerPointer
+ bitPtrMask = bitsMask << 2
+ maxGCMask = 64
+ bitsDead = 0
+ bitsPointer = 2
bitBoundary = 1
bitMarked = 2
// Integrated network poller (kqueue-based implementation).
int32 runtime·kqueue(void);
-int32 runtime·kevent(int32, Kevent*, int32, Kevent*, int32, Timespec*);
+int32 runtime·kevent(int32, KeventT*, int32, KeventT*, int32, Timespec*);
void runtime·closeonexec(int32);
static int32 kq = -1;
int32
runtime·netpollopen(uintptr fd, PollDesc *pd)
{
- Kevent ev[2];
+ KeventT ev[2];
int32 n;
// Arm both EVFILT_READ and EVFILT_WRITE in edge-triggered mode (EV_CLEAR)
runtime·netpoll(bool block)
{
static int32 lasterr;
- Kevent events[64], *ev;
+ KeventT events[64], *ev;
Timespec ts, *tp;
int32 n, i, mode;
G *gp;
void
runtime·setsig(int32 i, GoSighandler *fn, bool restart)
{
- Sigaction sa;
+ SigactionT sa;
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
GoSighandler*
runtime·getsig(int32 i)
{
- Sigaction sa;
+ SigactionT sa;
runtime·memclr((byte*)&sa, sizeof sa);
runtime·sigaction(i, nil, &sa);
void runtime·sigprocmask(int32, Sigset*, Sigset*);
void runtime·unblocksignals(void);
-struct Sigaction;
-void runtime·sigaction(uintptr, struct Sigaction*, struct Sigaction*);
+struct SigactionT;
+void runtime·sigaction(uintptr, struct SigactionT*, struct SigactionT*);
struct StackT;
void runtime·sigaltstack(struct StackT*, struct StackT*);
} __sigaction_u; /* signal handler */
int32 sa_flags; /* see signal options below */
Sigset sa_mask; /* signal mask to apply */
-} Sigaction;
+} SigactionT;
void
runtime·setsig(int32 i, GoSighandler *fn, bool restart)
{
- Sigaction sa;
+ SigactionT sa;
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
GoSighandler*
runtime·getsig(int32 i)
{
- Sigaction sa;
+ SigactionT sa;
runtime·memclr((byte*)&sa, sizeof sa);
runtime·sigaction(i, nil, &sa);
} __sigaction_u; /* signal handler */
int32 sa_flags; /* see signal options below */
Sigset sa_mask; /* signal mask to apply */
-} Sigaction;
+} SigactionT;
void
runtime·setsig(int32 i, GoSighandler *fn, bool restart)
{
- Sigaction sa;
+ SigactionT sa;
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
GoSighandler*
runtime·getsig(int32 i)
{
- Sigaction sa;
+ SigactionT sa;
runtime·memclr((byte*)&sa, sizeof sa);
runtime·sigaction(i, nil, &sa);
void
runtime·setsig(int32 i, GoSighandler *fn, bool restart)
{
- Sigaction sa;
+ SigactionT sa;
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_ONSTACK | SA_SIGINFO | SA_RESTORER;
GoSighandler*
runtime·getsig(int32 i)
{
- Sigaction sa;
+ SigactionT sa;
runtime·memclr((byte*)&sa, sizeof sa);
if(runtime·rt_sigaction(i, nil, &sa, sizeof(sa.sa_mask)) != 0)
int32 runtime·futex(uint32*, int32, uint32, Timespec*, uint32*, uint32);
int32 runtime·clone(int32, void*, M*, G*, void(*)(void));
-struct Sigaction;
-int32 runtime·rt_sigaction(uintptr, struct Sigaction*, void*, uintptr);
+struct SigactionT;
+int32 runtime·rt_sigaction(uintptr, struct SigactionT*, void*, uintptr);
void runtime·sigaltstack(Sigaltstack*, Sigaltstack*);
void runtime·sigpanic(void);
} _sa_u; /* signal handler */
uint32 sa_mask[4]; /* signal mask to apply */
int32 sa_flags; /* see signal options below */
-} Sigaction;
+} SigactionT;
void
runtime·setsig(int32 i, GoSighandler *fn, bool restart)
{
- Sigaction sa;
+ SigactionT sa;
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
GoSighandler*
runtime·getsig(int32 i)
{
- Sigaction sa;
+ SigactionT sa;
runtime·memclr((byte*)&sa, sizeof sa);
runtime·sigaction(i, nil, &sa);
} __sigaction_u; /* signal handler */
uint32 sa_mask; /* signal mask to apply */
int32 sa_flags; /* see signal options below */
-} Sigaction;
+} SigactionT;
void
runtime·setsig(int32 i, GoSighandler *fn, bool restart)
{
- Sigaction sa;
+ SigactionT sa;
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
GoSighandler*
runtime·getsig(int32 i)
{
- Sigaction sa;
+ SigactionT sa;
runtime·memclr((byte*)&sa, sizeof sa);
runtime·sigaction(i, nil, &sa);
void
runtime·setsig(int32 i, GoSighandler *fn, bool restart)
{
- Sigaction sa;
+ SigactionT sa;
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
GoSighandler*
runtime·getsig(int32 i)
{
- Sigaction sa;
+ SigactionT sa;
runtime·memclr((byte*)&sa, sizeof sa);
runtime·sigaction(i, nil, &sa);
}
/* int32 */ void
-runtime·sigaction(int32 sig, struct Sigaction* act, struct Sigaction* oact)
+runtime·sigaction(int32 sig, struct SigactionT* act, struct SigactionT* oact)
{
runtime·sysvicall3(libc·sigaction, (uintptr)sig, (uintptr)act, (uintptr)oact);
}
void runtime·sigpanic(void);
void runtime·setitimer(int32, Itimerval*, Itimerval*);
-void runtime·sigaction(int32, struct Sigaction*, struct Sigaction*);
+void runtime·sigaction(int32, struct SigactionT*, struct SigactionT*);
void runtime·sigaltstack(Sigaltstack*, Sigaltstack*);
void runtime·sigprocmask(int32, Sigset*, Sigset*);
void runtime·unblocksignals(void);