/*
 * This is a machine-generated file. Please do not edit it by hand.
 *
 * This file contains low-level information about the
 * internals of a particular version and configuration
 * of SBCL. It is used by the C compiler to create a runtime
 * support environment, an executable program in the host
 * operating system's native format, which can then be used to
 * load and run 'core' files, which are basically programs
 * in SBCL's own format.
 */
#ifndef SBCL_GENESIS_EVENTS
#define SBCL_GENESIS_EVENTS
enum vmevent {
  EventGotSignal=0,
  EventSigDeferred_IntDisabled,
  EventSigDeferred_PA,
  EventStopDeferred_GCinhibit,
  EventStopDeferred_PA,
  EventStopForGC,
  EventAfterGCblockedDeferrables,
  EventSuspended,
  EventResumed,
  EventSTW_end,
  EventFutexWait,
  EventFutexWake
};

#include <stdint.h>
#define EVENTBUFMAX 400000
extern uintptr_t *eventdata;
extern int n_logevents;
#ifndef should_record_event
#define should_record_event(x) 0
#endif
#ifdef WANT_EVENTLOG_FORMAT_STRINGS
static char event_printf_nargs[32] = {2,3,2,0,0,0,0,0,0,0,1,1};
static char *event_printf_format[] = {
  "got signal %d @ pc=%p",
  "can_handle_now(%p,%d): deferred (RACE=%d)",
  "can_handle_now(%p,%d): deferred (PA)",
  "stop_for_gc deferred for *GC-INHIBIT*",
  "stop_for_gc deferred for PA",
  "stop_for_gc",
  "cleaning up after gc_blocked_deferrables",
  "suspended",
  "resumed",
  "/gc_stop_the_world:end",
  "futex_wait %p",
  "futex_wake %p"
};
#endif

#define EVENT0(id) { if(should_record_event(id)) \
 { int i_ = __sync_fetch_and_add(&n_logevents, 1); if (i_ < EVENTBUFMAX) { \
   eventdata[i_] = ((uword_t)pthread_self() << 2) | id; }}}
#define EVENT1(id,arg1) { if(should_record_event(id)) \
 { int i_ = __sync_fetch_and_add(&n_logevents, 2); if (i_ < EVENTBUFMAX) { \
   eventdata[i_] = ((uword_t)pthread_self() << 2) | id;   eventdata[i_+1] = (uword_t)arg1; }}}
#define EVENT2(id,arg1,arg2) { if(should_record_event(id)) \
 { int i_ = __sync_fetch_and_add(&n_logevents, 3); if (i_ < EVENTBUFMAX) { \
   eventdata[i_] = ((uword_t)pthread_self() << 2) | id;   eventdata[i_+1] = (uword_t)arg1; \
   eventdata[i_+2] = (uword_t)arg2; }}}
#define EVENT3(id,arg1,arg2,arg3) { if(should_record_event(id)) \
 { int i_ = __sync_fetch_and_add(&n_logevents, 4); if (i_ < EVENTBUFMAX) { \
   eventdata[i_] = ((uword_t)pthread_self() << 2) | id;   eventdata[i_+1] = (uword_t)arg1; \
   eventdata[i_+2] = (uword_t)arg2; \
   eventdata[i_+3] = (uword_t)arg3; }}}
#define EVENT4(id,arg1,arg2,arg3,arg4) { if(should_record_event(id)) \
 { int i_ = __sync_fetch_and_add(&n_logevents, 5); if (i_ < EVENTBUFMAX) { \
   eventdata[i_] = ((uword_t)pthread_self() << 2) | id;   eventdata[i_+1] = (uword_t)arg1; \
   eventdata[i_+2] = (uword_t)arg2; \
   eventdata[i_+3] = (uword_t)arg3; \
   eventdata[i_+4] = (uword_t)arg4; }}}
#define EVENT5(id,arg1,arg2,arg3,arg4,arg5) { if(should_record_event(id)) \
 { int i_ = __sync_fetch_and_add(&n_logevents, 6); if (i_ < EVENTBUFMAX) { \
   eventdata[i_] = ((uword_t)pthread_self() << 2) | id;   eventdata[i_+1] = (uword_t)arg1; \
   eventdata[i_+2] = (uword_t)arg2; \
   eventdata[i_+3] = (uword_t)arg3; \
   eventdata[i_+4] = (uword_t)arg4; \
   eventdata[i_+5] = (uword_t)arg5; }}}
#define EVENT6(id,arg1,arg2,arg3,arg4,arg5,arg6) { if(should_record_event(id)) \
 { int i_ = __sync_fetch_and_add(&n_logevents, 7); if (i_ < EVENTBUFMAX) { \
   eventdata[i_] = ((uword_t)pthread_self() << 2) | id;   eventdata[i_+1] = (uword_t)arg1; \
   eventdata[i_+2] = (uword_t)arg2; \
   eventdata[i_+3] = (uword_t)arg3; \
   eventdata[i_+4] = (uword_t)arg4; \
   eventdata[i_+5] = (uword_t)arg5; \
   eventdata[i_+6] = (uword_t)arg6; }}}
#define event_GotSignal(arg1,arg2) EVENT2(EventGotSignal,arg1,arg2)
#define event_SigDeferred_IntDisabled(arg1,arg2,arg3) EVENT3(EventSigDeferred_IntDisabled,arg1,arg2,arg3)
#define event_SigDeferred_PA(arg1,arg2) EVENT2(EventSigDeferred_PA,arg1,arg2)
#define event_StopDeferred_GCinhibit() EVENT0(EventStopDeferred_GCinhibit)
#define event_StopDeferred_PA() EVENT0(EventStopDeferred_PA)
#define event_StopForGC() EVENT0(EventStopForGC)
#define event_AfterGCblockedDeferrables() EVENT0(EventAfterGCblockedDeferrables)
#define event_Suspended() EVENT0(EventSuspended)
#define event_Resumed() EVENT0(EventResumed)
#define event_STW_end() EVENT0(EventSTW_end)
#define event_FutexWait(arg1) EVENT1(EventFutexWait,arg1)
#define event_FutexWake(arg1) EVENT1(EventFutexWake,arg1)
#endif
