1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-20 19:42:53 -08:00

Change.dylan.meadow-lark.170573

Copied from Perforce
 Change: 19224
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gavin Matthews 1998-01-15 13:23:03 +00:00
parent c75cfc62fe
commit 798e58203c
7 changed files with 73 additions and 16 deletions

View file

@ -1,6 +1,6 @@
/* impl.c.event: EVENT LOGGING
*
* $HopeName: MMsrc!event.c(trunk.4) $
* $HopeName: MMsrc!event.c(trunk.5) $
* Copyright (C) 1997 Harlequin Group, all rights reserved.
*
* .readership: MPS developers.
@ -26,7 +26,7 @@
#include "event.h"
#include "mpsio.h"
SRCID(event, "$HopeName: MMsrc!event.c(trunk.4) $");
SRCID(event, "$HopeName: MMsrc!event.c(trunk.5) $");
#ifdef EVENT /* .trans.ifdef */
@ -34,11 +34,10 @@ static Bool eventInited = FALSE;
static mps_io_t eventIO;
static char eventBuffer[EVENT_BUFFER_SIZE];
static Count eventUserCount;
static Word EventKindControlBuffer[BTSize(EventKindNumber)];
EventUnion Event; /* Used by macros in impl.h.event */
char *EventNext, *EventLimit; /* Used by macros in impl.h.event */
BT EventKindControl; /* Used to control output. */
Word EventKindControl; /* Bit set used to control output. */
Res EventFlush(void)
{
@ -67,10 +66,9 @@ Res (EventInit)(void)
if(res != ResOK) return res;
EventNext = eventBuffer;
EventLimit = &eventBuffer[EVENT_BUFFER_SIZE];
eventUserCount = 0;
eventUserCount = (Count)0;
eventInited = TRUE;
EventKindControl = (BT)EventKindControlBuffer;
BTSetRange(EventKindControl, 0, EventKindNumber);
EventKindControl = (Word)mps_lib_telemetry_control();
}
++eventUserCount;
@ -89,6 +87,30 @@ void (EventFinish)(void)
--eventUserCount;
}
/* EventControl -- Change or read control word
*
* Resets the bits specified in resetMask, and flips those in
* flipMask. Returns old value.
*
* Operations can be implemented as follows:
* Set(M) EventControl(M,M)
* Reset(M) EventControl(M,0)
* Flip(M) EventControl(0,M)
* Read() EventControl(0,0)
*/
Word EventControl(Word resetMask, Word flipMask)
{
Word oldValue = EventKindControl;
/* EventKindControl = (EventKindControl & ~resetMask) ^ flipMask */
EventKindControl =
BS_SYM_DIFF(BS_DIFF(EventKindControl, resetMask), flipMask);
return oldValue;
}
#else /* EVENT, not */
Res (EventInit)(void)
@ -101,4 +123,9 @@ void (EventFinish)(void)
NOOP;
}
Word EventControl(Word resetMask, Word flipMask)
{
return (Word)0;
}
#endif /* EVENT */

View file

@ -1,7 +1,7 @@
/* impl.h.event -- Event Logging Interface
*
* Copyright (C) 1997 Harlequin Group, all rights reserved.
* $HopeName: MMsrc!event.h(trunk.4) $
* $HopeName: MMsrc!event.h(trunk.5) $
*
* READERSHIP
*
@ -28,6 +28,7 @@
extern Res EventFlush(void);
extern Res EventInit(void);
extern void EventFinish(void);
extern Word EventControl(Word, Word);
typedef Index EventKind;
@ -96,7 +97,7 @@ extern EventUnion Event;
Event.any.clock = mps_clock();
#define EVENT_END(type, length) \
if(BTGet(EventKindControl, ((Index)Event ## type ## Kind))) { \
if(BS_IS_MEMBER(EventKindControl, ((Index)Event ## type ## Kind))) { \
AVER(EventNext <= EventLimit); \
if((length) > (size_t)(EventLimit - EventNext)) \
EventFlush(); /* @@@ should pass length */ \
@ -107,7 +108,7 @@ extern EventUnion Event;
END
extern char *EventNext, *EventLimit;
extern BT EventKindControl;
extern Word EventKindControl;
#else /* EVENT not */

View file

@ -1,6 +1,6 @@
/* impl.h.misc: MISCELLANEOUS DEFINITIONS
*
* $HopeName: MMsrc!misc.h(trunk.17) $
* $HopeName: MMsrc!misc.h(trunk.18) $
* Copyright (C) 1997 The Harlequin Group Limited. All rights reserved.
*
* Small general things which are useful for C but aren't part of the
@ -129,6 +129,7 @@ typedef const struct SrcIdStruct {
#define BS_SUPER(s1, s2) (BS_INTER((s1), (s2)) == (s2))
#define BS_SUB(s1, s2) BS_SUPER((s2), (s1))
#define BS_IS_SINGLE(s) (((s) & ((s)-1)) == 0)
#define BS_SYM_DIFF(s1, s2) ((s1) ^ (s2))
#endif /* misc_h */

View file

@ -1,6 +1,6 @@
/* impl.h.mps: HARLEQUIN MEMORY POOL SYSTEM C INTERFACE
*
* $HopeName: MMsrc!mps.h(trunk.30) $
* $HopeName: MMsrc!mps.h(trunk.31) $
* Copyright (C) 1997 The Harlequin Group Limited. All rights reserved.
*
* .readership: customers, MPS developers.
@ -364,6 +364,11 @@ extern mps_res_t mps_finalize(mps_arena_t, mps_addr_t *);
extern void mps_definalize(mps_arena_t, mps_addr_t *);
/* Telemetry Control */
mps_word_t mps_telemetry_control(mps_word_t, mps_word_t);
/* Scanner Support */
extern mps_res_t mps_fix(mps_ss_t, mps_addr_t *);

View file

@ -1,6 +1,6 @@
/* impl.c.mpsi: MEMORY POOL SYSTEM C INTERFACE LAYER
*
* $HopeName: MMsrc!mpsi.c(trunk.39) $
* $HopeName: MMsrc!mpsi.c(trunk.40) $
* Copyright (C) 1997 The Harlequin Group Limited. All rights reserved.
*
* .purpose: This code bridges between the MPS interface to C,
@ -52,7 +52,7 @@
#include "mps.h"
#include "mpsavm.h" /* only for mps_space_create */
SRCID(mpsi, "$HopeName: MMsrc!mpsi.c(trunk.39) $");
SRCID(mpsi, "$HopeName: MMsrc!mpsi.c(trunk.40) $");
/* mpsi_check -- check consistency of interface mappings
@ -1152,3 +1152,13 @@ void mps_message_finalization_ref(mps_addr_t *mps_addr_return,
ArenaLeave(arena);
}
/* Telemetry control */
mps_word_t mps_telemetry_control(mps_word_t resetMask,
mps_word_t flipMask)
{
/* Doesn't require locking and isn't arena-specific. */
return EventControl((Word)resetMask, (Word)flipMask);
}

View file

@ -1,6 +1,6 @@
/* impl.h.mpslib: HARLEQUIN MEMORY POOL SYSTEM LIBRARY INTERFACE
*
* $HopeName: MMsrc!mpslib.h(trunk.4) $
* $HopeName: MMsrc!mpslib.h(trunk.5) $
* Copyright (C) 1996,1997 Harlequin Group, all rights reserved.
*
* .readership: MPS client application developers, MPS developers.
@ -45,4 +45,6 @@ extern void *mps_lib_memcpy(void *, const void *, size_t);
typedef unsigned long mps_clock_t;
extern mps_clock_t mps_clock(void);
extern unsigned long mps_lib_telemetry_control(void);
#endif /* mpslib_h */

View file

@ -1,6 +1,6 @@
/* impl.c.mpsliban: HARLEQUIN MEMORY POOL SYSTEM LIBRARY INTERFACE (ANSI)
*
* $HopeName: MMsrc!mpsliban.c(trunk.5) $
* $HopeName: MMsrc!mpsliban.c(trunk.6) $
* Copyright (C) 1996,1997 Harlequin Group, all rights reserved.
*
* PURPOSE
@ -89,3 +89,14 @@ mps_clock_t mps_clock(void)
{
return (unsigned long)clock();
}
unsigned long mps_lib_telemetry_control(void)
{
char *s;
s = getenv("MPS_TELEMETRY_CONTROL");
if(s != NULL)
return strtoul(s, (char **)NULL, 0);
else
return 0;
}