Commit 030a1217 authored by simonm's avatar simonm

[project @ 1999-03-15 16:30:24 by simonm]

Remove flags field from info tables; create a separate table of flags
indexed by the closure type in the RTS.
parent 42a51e93
/* ----------------------------------------------------------------------------
* $Id: ClosureTypes.h,v 1.9 1999/02/05 16:02:20 simonm Exp $
* $Id: ClosureTypes.h,v 1.10 1999/03/15 16:30:24 simonm Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -72,7 +72,8 @@
#define STABLE_NAME 56
#define TSO 57
#define BLOCKED_FETCH 58
#define FETCH_ME 69
#define FETCH_ME 59
#define EVACUATED 60
#define N_CLOSURE_TYPES 61
#endif CLOSURETYPES_H
/* ----------------------------------------------------------------------------
* $Id: InfoMacros.h,v 1.4 1999/03/02 19:44:09 sof Exp $
* $Id: InfoMacros.h,v 1.5 1999/03/15 16:30:25 simonm Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -13,14 +13,12 @@
#define STD_INFO(type_) \
srt : 0, \
srt_len : 0, \
type : type_, \
flags: FLAGS_##type_
type : type_
#define SRT_INFO(type_,srt_,srt_off_,srt_len_) \
srt : (StgSRT *)((StgClosure **)srt_+srt_off_), \
srt_len : srt_len_, \
type : type_, \
flags: FLAGS_##type_
type : type_
/* function/thunk info tables --------------------------------------------- */
......@@ -87,7 +85,6 @@ INFO_TABLE_CONSTR(info, entry, ptrs, nptrs, tag_,type_,info_class, \
layout : { payload : {ptrs,nptrs} }, \
srt_len : tag_, \
type : type_, \
flags : FLAGS_##type_, \
INIT_ENTRY(entry) \
}
......
/* ----------------------------------------------------------------------------
* $Id: InfoTables.h,v 1.12 1999/03/02 19:44:10 sof Exp $
* $Id: InfoTables.h,v 1.13 1999/03/15 16:30:25 simonm Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -76,98 +76,6 @@ typedef struct {
#endif /* DEBUG_CLOSURE */
/* -----------------------------------------------------------------------------
Closure Types
If you add or delete any closure types, don't forget to update
ClosureTypes.h for the native code generator. This is a temporary
measure (I hope).
-------------------------------------------------------------------------- */
typedef enum {
INVALID_OBJECT /* Object tag 0 raises an internal error */
, CONSTR
, CONSTR_1_0
, CONSTR_0_1
, CONSTR_2_0
, CONSTR_1_1
, CONSTR_0_2
, CONSTR_INTLIKE
, CONSTR_CHARLIKE
, CONSTR_STATIC
, CONSTR_NOCAF_STATIC
, FUN
, FUN_1_0
, FUN_0_1
, FUN_2_0
, FUN_1_1
, FUN_0_2
, FUN_STATIC
, THUNK
, THUNK_1_0
, THUNK_0_1
, THUNK_2_0
, THUNK_1_1
, THUNK_0_2
, THUNK_STATIC
, THUNK_SELECTOR
, BCO
, AP_UPD
, PAP /* should be called AP_NUPD */
, IND
, IND_OLDGEN
, IND_PERM
, IND_OLDGEN_PERM
, IND_STATIC
, CAF_UNENTERED
, CAF_ENTERED
, CAF_BLACKHOLE
, RET_BCO
, RET_SMALL
, RET_VEC_SMALL
, RET_BIG
, RET_VEC_BIG
, RET_DYN
, UPDATE_FRAME
, CATCH_FRAME
, STOP_FRAME
, SEQ_FRAME
, BLACKHOLE
, BLACKHOLE_BQ
, MVAR
, ARR_WORDS
, MUT_ARR_PTRS
, MUT_ARR_PTRS_FROZEN
, MUT_VAR
, WEAK
, FOREIGN
, STABLE_NAME
, TSO
, BLOCKED_FETCH
, FETCH_ME
, EVACUATED
, N_CLOSURE_TYPES /* number of distinct closure types */
} StgClosureType;
/* The type flags provide quick access to certain properties of a closure. */
#define _HNF (1<<0) /* head normal form? */
......@@ -186,70 +94,15 @@ typedef enum {
#define isUNPOINTED(flags) ((flags) &_UPT)
#define hasSRT(flags) ((flags) &_SRT)
#define closure_STATIC(closure) ( get_itbl(closure)->flags & _STA)
#define closure_SHOULD_SPARK(closure) (!(get_itbl(closure)->flags & _NS))
#define closure_MUTABLE(closure) ( get_itbl(closure)->flags & _MUT)
#define closure_UNPOINTED(closure) ( get_itbl(closure)->flags & _UPT)
/* HNF BTM NS STA THU MUT UPT SRT */
#define FLAGS_CONSTR (_HNF| _NS )
#define FLAGS_CONSTR_1_0 (_HNF| _NS )
#define FLAGS_CONSTR_0_1 (_HNF| _NS )
#define FLAGS_CONSTR_2_0 (_HNF| _NS )
#define FLAGS_CONSTR_1_1 (_HNF| _NS )
#define FLAGS_CONSTR_0_2 (_HNF| _NS )
#define FLAGS_CONSTR_STATIC (_HNF| _NS|_STA )
#define FLAGS_CONSTR_NOCAF_STATIC (_HNF| _NS|_STA )
#define FLAGS_FUN (_HNF| _NS| _SRT )
#define FLAGS_FUN_1_0 (_HNF| _NS )
#define FLAGS_FUN_0_1 (_HNF| _NS )
#define FLAGS_FUN_2_0 (_HNF| _NS )
#define FLAGS_FUN_1_1 (_HNF| _NS )
#define FLAGS_FUN_0_2 (_HNF| _NS )
#define FLAGS_FUN_STATIC (_HNF| _NS|_STA| _SRT )
#define FLAGS_THUNK ( _BTM| _THU| _SRT )
#define FLAGS_THUNK_1_0 ( _BTM| _THU| _SRT )
#define FLAGS_THUNK_0_1 ( _BTM| _THU| _SRT )
#define FLAGS_THUNK_2_0 ( _BTM| _THU| _SRT )
#define FLAGS_THUNK_1_1 ( _BTM| _THU| _SRT )
#define FLAGS_THUNK_0_2 ( _BTM| _THU| _SRT )
#define FLAGS_THUNK_STATIC ( _BTM| _STA|_THU| _SRT )
#define FLAGS_THUNK_SELECTOR ( _BTM| _THU| _SRT )
#define FLAGS_BCO (_HNF| _NS )
#define FLAGS_CAF_UNENTERED 0 /* Do we still use these? */
#define FLAGS_CAF_ENTERED 0
#define FLAGS_CAF_BLACKHOLE ( _BTM|_NS| _UPT )
#define FLAGS_AP_UPD ( _BTM| _THU )
#define FLAGS_PAP (_HNF| _NS )
#define FLAGS_IND 0
#define FLAGS_IND_OLDGEN 0
#define FLAGS_IND_PERM 0
#define FLAGS_IND_OLDGEN_PERM 0
#define FLAGS_IND_STATIC ( _STA )
#define FLAGS_EVACUATED 0
#define FLAGS_ARR_WORDS (_HNF| _NS| _UPT )
#define FLAGS_MUT_ARR_PTRS (_HNF| _NS| _MUT|_UPT )
#define FLAGS_MUT_ARR_PTRS_FROZEN (_HNF| _NS| _MUT|_UPT )
#define FLAGS_MUT_VAR (_HNF| _NS| _MUT|_UPT )
#define FLAGS_FOREIGN (_HNF| _NS| _UPT )
#define FLAGS_STABLE_NAME (_HNF| _NS| _UPT )
#define FLAGS_WEAK (_HNF| _NS| _UPT )
#define FLAGS_BLACKHOLE ( _NS| _UPT )
#define FLAGS_BLACKHOLE_BQ ( _NS| _MUT|_UPT )
#define FLAGS_MVAR (_HNF| _NS| _MUT|_UPT )
#define FLAGS_FETCH_ME (_HNF| _NS )
#define FLAGS_TSO (_HNF| _NS| _MUT|_UPT )
#define FLAGS_RET_BCO ( _BTM )
#define FLAGS_RET_SMALL ( _BTM| _SRT)
#define FLAGS_RET_VEC_SMALL ( _BTM| _SRT)
#define FLAGS_RET_BIG ( _SRT)
#define FLAGS_RET_VEC_BIG ( _SRT)
#define FLAGS_RET_DYN ( _SRT)
#define FLAGS_CATCH_FRAME ( _BTM )
#define FLAGS_STOP_FRAME ( _BTM )
#define FLAGS_SEQ_FRAME ( _BTM )
#define FLAGS_UPDATE_FRAME ( _BTM )
extern StgWord16 closure_flags[];
#define closureFlags(c) (closure_flags[get_itbl(c)->type])
#define closure_STATIC(c) ( closureFlags(c) & _STA)
#define closure_SHOULD_SPARK(c) (!(closureFlags(c) & _NS))
#define closure_MUTABLE(c) ( closureFlags(c) & _MUT)
#define closure_UNPOINTED(c) ( closureFlags(c) & _UPT)
/* -----------------------------------------------------------------------------
Info Tables
......@@ -314,13 +167,11 @@ typedef struct _StgInfoTable {
#endif
StgClosureInfo layout; /* closure layout info (pointer-sized) */
#if SIZEOF_VOID_P == 8
StgWord16 flags; /* } */
StgClosureType type : 16; /* } These 4 elements fit into 64 bits */
StgWord32 type; /* } These 2 elements fit into 64 bits */
StgWord32 srt_len; /* } */
#else
StgWord8 flags; /* } */
StgClosureType type : 8; /* } These 4 elements fit into 32 bits */
StgWord16 srt_len; /* } */
StgWord type : 16; /* } These 2 elements fit into 32 bits */
StgWord srt_len : 16; /* } */
#endif
#if USE_MINIINTERPRETER
StgFunPtr (*vector)[];
......
/* -----------------------------------------------------------------------------
* $Id: Stg.h,v 1.8 1999/03/03 19:28:23 sof Exp $
* $Id: Stg.h,v 1.9 1999/03/15 16:30:25 simonm Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -96,6 +96,7 @@ void _stgAssert (char *, unsigned int);
/* Storage format definitions */
#include "Closures.h"
#include "ClosureTypes.h"
#include "InfoTables.h"
#include "TSO.h"
......@@ -104,20 +105,6 @@ void _stgAssert (char *, unsigned int);
#include "Regs.h"
#include "TailCalls.h"
/**
* Added by Ian McDonald 7/5/98
* XXX The position of this code is very
* important - it must come after the
* Regs.h include
**/
#ifdef nemesis_TARGET_OS
#define _NEMESIS_OS_
#ifndef __LANGUAGE_C
#define __LANGUAGE_C
#endif
#include <nemesis.h>
#endif
/* these are all ANSI C headers */
#include <stdlib.h>
#include <string.h>
......
/* -----------------------------------------------------------------------------
* $Id: ClosureFlags.c,v 1.1 1999/03/15 16:30:27 simonm Exp $
*
* (c) The GHC Team 1998-1999
*
* Closure type flags
*
* ---------------------------------------------------------------------------*/
#include "Rts.h"
StgWord16 closure_flags[] = {
/*
* These *must* be in the same order as the closure types in
* ClosureTypes.h.
*/
/* HNF BTM NS STA THU MUT UPT SRT */
/* INVALID_OBJECT */ ( 0 ),
/* CONSTR */ (_HNF| _NS ),
/* CONSTR_1_0 */ (_HNF| _NS ),
/* CONSTR_0_1 */ (_HNF| _NS ),
/* CONSTR_2_0 */ (_HNF| _NS ),
/* CONSTR_1_1 */ (_HNF| _NS ),
/* CONSTR_0_2 */ (_HNF| _NS ),
/* CONSTR_INTLIKE */ (_HNF| _NS|_STA ),
/* CONSTR_CHARLIKE */ (_HNF| _NS|_STA ),
/* CONSTR_STATIC */ (_HNF| _NS|_STA ),
/* CONSTR_NOCAF_STATIC */ (_HNF| _NS|_STA ),
/* FUN */ (_HNF| _NS| _SRT ),
/* FUN_1_0 */ (_HNF| _NS ),
/* FUN_0_1 */ (_HNF| _NS ),
/* FUN_2_0 */ (_HNF| _NS ),
/* FUN_1_1 */ (_HNF| _NS ),
/* FUN_0_2 */ (_HNF| _NS ),
/* FUN_STATIC */ (_HNF| _NS|_STA| _SRT ),
/* THUNK */ ( _BTM| _THU| _SRT ),
/* THUNK_1_0 */ ( _BTM| _THU| _SRT ),
/* THUNK_0_1 */ ( _BTM| _THU| _SRT ),
/* THUNK_2_0 */ ( _BTM| _THU| _SRT ),
/* THUNK_1_1 */ ( _BTM| _THU| _SRT ),
/* THUNK_0_2 */ ( _BTM| _THU| _SRT ),
/* THUNK_STATIC */ ( _BTM| _STA|_THU| _SRT ),
/* THUNK_SELECTOR */ ( _BTM| _THU| _SRT ),
/* BCO */ (_HNF| _NS ),
/* AP_UPD */ ( _BTM| _THU ),
/* PAP */ (_HNF| _NS ),
/* IND */ ( 0 ),
/* IND_OLDGEN */ ( 0 ),
/* IND_PERM */ ( 0 ),
/* IND_OLDGEN_PERM */ ( 0 ),
/* IND_STATIC */ ( _STA ),
/* CAF_UNENTERED */ ( 0 ),
/* CAF_ENTERED */ ( 0 ),
/* CAF_BLACKHOLE */ ( _BTM|_NS| _UPT ),
/* RET_BCO */ ( _BTM ),
/* RET_SMALL */ ( _BTM| _SRT),
/* RET_VEC_SMALL */ ( _BTM| _SRT),
/* RET_BIG */ ( _SRT),
/* RET_VEC_BIG */ ( _SRT),
/* RET_DYN */ ( _SRT),
/* UPDATE_FRAME */ ( _BTM ),
/* CATCH_FRAME */ ( _BTM ),
/* STOP_FRAME */ ( _BTM ),
/* SEQ_FRAME */ ( _BTM ),
/* BLACKHOLE */ ( _NS| _UPT ),
/* BLACKHOLE_BQ */ ( _NS| _MUT|_UPT ),
/* MVAR */ (_HNF| _NS| _MUT|_UPT ),
/* ARR_WORDS */ (_HNF| _NS| _UPT ),
/* MUT_ARR_PTRS */ (_HNF| _NS| _MUT|_UPT ),
/* MUT_ARR_PTRS_FROZEN */ (_HNF| _NS| _MUT|_UPT ),
/* MUT_VAR */ (_HNF| _NS| _MUT|_UPT ),
/* WEAK */ (_HNF| _NS| _UPT ),
/* FOREIGN */ (_HNF| _NS| _UPT ),
/* STABLE_NAME */ (_HNF| _NS| _UPT ),
/* TSO */ (_HNF| _NS| _MUT|_UPT ),
/* BLOCKED_FETCH */ (_HNF| _NS ),
/* FETCH_ME */ (_HNF| _NS ),
/* EVACUATED */ ( 0 )
};
/* -----------------------------------------------------------------------------
* $Id: GC.c,v 1.50 1999/03/11 09:31:53 simonm Exp $
* $Id: GC.c,v 1.51 1999/03/15 16:30:27 simonm Exp $
*
* (c) The GHC Team 1998-1999
*
......@@ -2330,7 +2330,7 @@ scavenge_stack(StgPtr p, StgPtr stack_end)
{
StgUpdateFrame *frame = (StgUpdateFrame *)p;
StgClosure *to;
StgClosureType type = get_itbl(frame->updatee)->type;
nat type = get_itbl(frame->updatee)->type;
p += sizeofW(StgUpdateFrame);
if (type == EVACUATED) {
......
/* -----------------------------------------------------------------------------
* $Id: Printer.c,v 1.9 1999/03/09 14:51:23 sewardj Exp $
* $Id: Printer.c,v 1.10 1999/03/15 16:30:29 simonm Exp $
*
* Copyright (c) 1994-1999.
*
......@@ -40,6 +40,7 @@ static void printZcoded ( const char *raw );
* ------------------------------------------------------------------------*/
#ifdef INTERPRETER
extern void* itblNames[];
extern int nItblNames;
char* lookupHugsItblName ( void* v )
......@@ -49,6 +50,7 @@ char* lookupHugsItblName ( void* v )
if (itblNames[i] == v) return itblNames[i+1];
return NULL;
}
#endif
extern void printPtr( StgPtr p )
{
......@@ -59,9 +61,9 @@ extern void printPtr( StgPtr p )
#ifdef INTERPRETER
} else if ((raw = lookupHugsName(p)) != 0) {
fprintf(stderr, "%s", raw);
#endif
} else if ((str = lookupHugsItblName(p)) != 0) {
fprintf(stderr, "%p=%s", p, str);
#endif
} else {
fprintf(stderr, "%p", p);
}
......@@ -348,6 +350,7 @@ StgPtr printStackObj( StgPtr sp )
} else {
StgClosure* c = (StgClosure*)(*sp);
printPtr((StgPtr)*sp);
#ifdef INTERPRETER
if (c == &ret_bco_info) {
fprintf(stderr, "\t\t");
fprintf(stderr, "ret_bco_info\n" );
......@@ -356,6 +359,7 @@ StgPtr printStackObj( StgPtr sp )
fprintf(stderr, "\t\t\t");
fprintf(stderr, "ConstrInfoTable\n" );
} else
#endif
if (get_itbl(c)->type == BCO) {
fprintf(stderr, "\t\t\t");
fprintf(stderr, "BCO(...)\n");
......
/* -----------------------------------------------------------------------------
* $Id: StgMiscClosures.hc,v 1.16 1999/03/09 14:24:45 sewardj Exp $
* $Id: StgMiscClosures.hc,v 1.17 1999/03/15 16:30:29 simonm Exp $
*
* (c) The GHC Team, 1998-1999
*
......@@ -325,13 +325,15 @@ NON_ENTERABLE_ENTRY_CODE(MUT_CONS);
-------------------------------------------------------------------------- */
#define ArrayInfo(type) \
INFO_TABLE(type##_info, type##_entry, 0, 0, type, const, EF_,0,0); \
NON_ENTERABLE_ENTRY_CODE(type);
#define ArrayInfo(type) \
INFO_TABLE(type##_info, type##_entry, 0, 0, type, const, EF_,0,0);
ArrayInfo(ARR_WORDS);
NON_ENTERABLE_ENTRY_CODE(ARR_WORDS);
ArrayInfo(MUT_ARR_PTRS);
NON_ENTERABLE_ENTRY_CODE(MUT_ARR_PTRS);
ArrayInfo(MUT_ARR_PTRS_FROZEN);
NON_ENTERABLE_ENTRY_CODE(MUT_ARR_PTRS_FROZEN);
#undef ArrayInfo
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment