home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / src / h / cpuconf.h < prev    next >
C/C++ Source or Header  |  2001-12-12  |  10KB  |  322 lines

  1. /*
  2.  *  Configuration parameters that depend on computer architecture.
  3.  *  Some depend on values defined in config.h, which is always
  4.  *  included before this file.
  5.  */
  6.  
  7. #ifndef CStateSize
  8.    #define CStateSize 15        /* size of C state for co-expressions */
  9. #endif                    /* CStateSize */
  10.  
  11. /*
  12.  * The following definitions depend on the sizes of ints and pointers.
  13.  */
  14.  
  15. /*
  16.  * Most of the present implementations use 32-bit "words".  Note that
  17.  *  WordBits is the number of bits in an Icon integer, not necessarily
  18.  *  the number of bits in an int (given by IntBits).  For example,
  19.  *  in MS-DOS an Icon integer is a long, not an int.
  20.  *
  21.  *  MaxStrLen must not be so large as to overlap flags.
  22.  */
  23.  
  24. /*
  25.  * 64-bit words.
  26.  */
  27.  
  28. #if WordBits == 64
  29.  
  30.    #ifndef MinLong
  31.       #define MinLong  ((long int)0x8000000000000000) /* smallest long int */
  32.    #endif
  33.  
  34.    #ifndef MaxLong
  35.       #define MaxLong  ((long int)0x7fffffffffffffff) /* largest long integer */
  36.    #endif
  37.  
  38.    #define MaxStrLen 017777777777L        /* maximum string length */
  39.  
  40.    #ifndef MaxNegInt
  41.       #define MaxNegInt "-9223372036854775808"
  42.    #endif
  43.  
  44.    #ifndef F_Nqual
  45.       #define F_Nqual 0x8000000000000000    /* set if NOT string qualifier*/
  46.    #endif                /* F_Nqual */
  47.  
  48.    #ifndef F_Var
  49.       #define F_Var    0x4000000000000000    /* set if variable */
  50.    #endif                /* F_Var */
  51.  
  52.    #ifndef F_Ptr
  53.       #define F_Ptr    0x1000000000000000    /* set if value field is ptr */
  54.    #endif                /* F_Ptr */
  55.  
  56.    #ifndef F_Typecode
  57.       #define F_Typecode  0x2000000000000000    /* set if dword incls typecode*/
  58.    #endif                /* F_Typecode */
  59.  
  60. #endif                    /* WordBits == 64 */
  61.  
  62. /*
  63.  * 32-bit words.
  64.  */
  65.  
  66. #if WordBits == 32
  67.  
  68.    #define MaxLong  ((long int)017777777777L)   /* largest long integer */
  69.    #define MinLong  ((long int)020000000000L)   /* smallest long integer */
  70.  
  71.    #define MaxNegInt "-2147483648"
  72.  
  73.    #define MaxStrLen 0777777777        /* maximum string length */
  74.  
  75.    #define F_Nqual    0x80000000    /* set if NOT string qualifier */
  76.    #define F_Var    0x40000000    /* set if variable */
  77.    #define F_Ptr    0x10000000    /* set if value field is pointer */
  78.    #define F_Typecode    0x20000000    /* set if dword includes type code */
  79.  
  80. #endif                    /* WordBits == 32 */
  81.  
  82. /*
  83.  * Values that depend on the number of bits in an int (not necessarily
  84.  * the same as the number of bits in a word).
  85.  */
  86.  
  87. #if IntBits == 64
  88.    #define LogIntBits    6            /* log of IntBits */
  89.    #define MaxUnsigned 01777777777777777777777L /* largest unsigned integer */
  90.    #define MaxInt    0777777777777777777777L /* largest int */
  91.    /*
  92.     * Cset initialization and access macros.
  93.     */
  94.    #define fwd(w0, w1, w2, w3) \
  95.       (((w0) & 0xffff) | (((unsigned)(w1) & 0xffff) << 16) | \
  96.       (((unsigned)(w2) & 0xffff) << 32) | (((unsigned)(w3) & 0xffff) << 48))
  97.    #define cset_display(w0,w1,w2,w3,w4,w5,w6,w7,w8,w9,wa,wb,wc,wd,we,wf) \
  98.       {fwd(w0,w1,w2,w3),fwd(w4,w5,w6,w7),fwd(w8,w9,wa,wb),fwd(wc,wd,we,wf)}
  99.    #define Cset32(b,c) (*CsetPtr(b,c)>>(32*CsetOff((b)>>5)))  /* 32b of cset */
  100. #endif                    /* IntBits == 64 */
  101.  
  102. #if IntBits == 32
  103.    #define LogIntBits    5        /* log of IntBits */
  104.    #define MaxUnsigned    037777777777    /* largest unsigned integer */
  105.    #define MaxInt    017777777777    /* largest int */
  106.    /*
  107.     * Cset initialization and access macros.
  108.     */
  109.    #define twd(w0,w1)    (((w0)&0xffff) | (((unsigned)w1)<<16))
  110.    #define cset_display(w0,w1,w2,w3,w4,w5,w6,w7,w8,w9,wa,wb,wc,wd,we,wf) \
  111.       {twd(w0,w1),twd(w2,w3),twd(w4,w5),twd(w6,w7), \
  112.        twd(w8,w9),twd(wa,wb),twd(wc,wd),twd(we,wf)}
  113.    #define Cset32(b,c) (*CsetPtr(b,c))    /* 32 bits of cset */
  114. #endif                    /* IntBits == 32 */
  115.  
  116. #if IntBits == 16
  117.    #define LogIntBits    4            /* log of IntBits */
  118.    #define MaxUnsigned ((unsigned int)0177777)    /* largest unsigned integer */
  119.    #define MaxInt    077777            /* largest int */
  120.  
  121.    #ifndef MaxListSlots
  122.       #define MaxListSlots 8000        /* largest list-element block */
  123.    #endif                /* MaxListSlots */
  124.  
  125.    /*
  126.     * Cset initialization and access macros.
  127.     */
  128.    #define cset_display(w0,w1,w2,w3,w4,w5,w6,w7,w8,w9,wa,wb,wc,wd,we,wf) \
  129.       {w0,w1,w2,w3,w4,w5,w6,w7,w8,w9,wa,wb,wc,wd,we,wf}
  130.    #define Cset32(b,c) (((unsigned long)(unsigned int)(*CsetPtr((b)+16,c))<<16) | \
  131.       ((unsigned long)(unsigned int)(*CsetPtr(b,c))))  /* 32 bits of cset */
  132. #endif                    /* IntBits == 16 */
  133.  
  134. #ifndef LogHuge
  135.    #define LogHuge 309            /* maximum base-10 exp+1 of real */
  136. #endif                    /* LogHuge */
  137.  
  138. #ifndef Big
  139.    #define Big 9007199254740992.    /* larger than 2^53 lose precision */
  140. #endif                    /* Big */
  141.  
  142. #ifndef Precision
  143.    #define Precision 10            /* digits in string from real */
  144. #endif                    /* Precision */
  145.  
  146. /*
  147.  * Parameters that configure tables and sets:
  148.  *
  149.  *  HSlots    Initial number of hash buckets; must be a power of 2.
  150.  *  LogHSlots    Log to the base 2 of HSlots.
  151.  *
  152.  *  HSegs    Maximum number of hash bin segments; the maximum number of
  153.  *        hash bins is HSlots * 2 ^ (HSegs - 1).
  154.  *
  155.  *        If Hsegs is increased above 20, the arrays log2h[] and segsize[]
  156.  *        in the runtime system will need modification.
  157.  *
  158.  *  MaxHLoad    Maximum loading factor; more hash bins are allocated when
  159.  *        the average bin exceeds this many entries.
  160.  *
  161.  *  MinHLoad    Minimum loading factor; if a newly created table (e.g. via
  162.  *        copy()) is more lightly loaded than this, bins are combined.
  163.  *
  164.  *  Because splitting doubles the number of hash bins, and combining halves it,
  165.  *  MaxHLoad should be at least twice MinHLoad.
  166.  */
  167.  
  168. #ifndef HSlots
  169.    #if IntBits == 16
  170.       #define HSlots     4
  171.       #define LogHSlots  2
  172.    #else                /* IntBits */
  173.       #define HSlots     16
  174.       #define LogHSlots  4
  175.    #endif                /* IntBits */
  176. #endif                    /* HSlots */
  177.  
  178. #if ((1 << LogHSlots) != HSlots)
  179.    Deliberate Syntax Error -- HSlots and LogHSlots are inconsistent
  180. #endif                    /* HSlots / LogHSlots consistency */
  181.  
  182. #ifndef HSegs
  183.    #if IntBits == 16
  184.       #define HSegs      6
  185.    #else                /* IntBits */
  186.       #define HSegs     20
  187.    #endif                /* IntBits */
  188. #endif                    /* HSegs */
  189.  
  190. #ifndef MinHLoad
  191.    #define MinHLoad  1
  192. #endif                    /* MinHLoad */
  193.  
  194. #ifndef MaxHLoad
  195.    #define MaxHLoad  5
  196. #endif                    /* MaxHLoad */
  197.  
  198. /*
  199.  * The number of bits in each base-B digit; the type DIGIT (unsigned int)
  200.  *  in rt.h must be large enough to hold this many bits.
  201.  *  It must be at least 2 and at most WordBits / 2.
  202.  */
  203. #define NB           (WordBits / 2)
  204.  
  205. /*
  206.  * The number of decimal digits at which the image lf a large integer
  207.  * goes from exact to approximate (to avoid possible long delays in
  208.  * conversion from large integer to string because of its quadratic
  209.  * complexity).
  210.  */
  211. #define MaxDigits    30
  212.  
  213. /*
  214.  * Memory sizing.
  215.  */
  216. #ifndef AlcMax
  217.    #define AlcMax 25
  218. #endif                    /* AlcMax */
  219.  
  220. /*
  221.  * Maximum sized block that can be allocated (via malloc() or such).
  222.  */
  223. #ifndef MaxBlock
  224.    #if IntBits == 16
  225.       #define MaxBlock 65000        /* leaves room for malloc header */
  226.    #else                /* IntBits == 16 */
  227.       #define MaxBlock MaxUnsigned
  228.    #endif                /* IntBits == 16 */
  229. #endif                    /* MaxBlock */
  230.  
  231. /*
  232.  * What follows is default memory sizing. Implementations with special
  233.  *  requirements may specify these values in define.h.
  234.  */
  235.  
  236. #ifndef MaxStrSpace
  237.    #if IntBits == 16
  238.       #define MaxStrSpace 65000        /* size of the string space in bytes */
  239.    #else                /* IntBits == 16 */
  240.       #define MaxStrSpace 500000    /* size of the string space in bytes */
  241.    #endif                /* IntBits == 16 */
  242. #endif                    /* MaxStrSpace */
  243.  
  244. #ifndef MaxAbrSize
  245.    #if IntBits == 16
  246.       #define MaxAbrSize 65000        /* size of the block region in bytes */
  247.    #else                /* IntBits == 16 */
  248.       #define MaxAbrSize 500000        /* size of the block region in bytes */
  249.    #endif                /* IntBits == 16 */
  250. #endif                    /* MaxAbrSize */
  251.  
  252. #ifndef MStackSize
  253.    #ifdef MultiThread
  254.       #define MStackSize 20000        /* size of the main stack in words */
  255.    #else                /* MultiThread */
  256.       #define MStackSize 10000        /* size of the main stack in words */
  257.    #endif                /* MultiThread */
  258. #endif                    /* MStackSize */
  259.  
  260. #ifndef StackSize
  261.    #define StackSize    2000        /* words in co-expression stack */
  262. #endif                    /* StackSize */
  263.  
  264. #ifndef QualLstSize
  265.    #define QualLstSize    5000        /* size of qualifier pointer region */
  266. #endif                    /* QualLstSize */
  267.  
  268. #ifndef ActStkBlkEnts
  269.    #ifdef Coexpr
  270.       #define ActStkBlkEnts   25    /* number of entries in an astkblk */
  271.    #else                /* Coexpr */
  272.       #define ActStkBlkEnts    1    /* number of entries in an astkblk */
  273.    #endif                /* Coexpr */
  274. #endif                    /* ActStkBlkEnts */
  275.  
  276. #ifndef RegionCushion
  277.    #define RegionCushion 10        /* % memory cushion to avoid thrashing*/
  278. #endif                    /* RegionCushion */
  279.  
  280. #ifndef RegionGrowth
  281.    #define RegionGrowth 200        /* % region growth when full */
  282. #endif                    /* RegionGrowth */
  283.  
  284. /*
  285.  * Minimum regions sizes (presently not used).
  286.  */
  287. #ifndef MinStatSize
  288.    #ifdef Coexpr
  289.       #define MinStatSize    10240    /* size of the static region in bytes*/
  290.    #else                /* Coexpr */
  291.       #define MinStatSize     1024    /* size of static region in bytes */
  292.    #endif                /* Coexpr */
  293. #endif                    /* MinStatSize */
  294.  
  295. #ifndef MinStrSpace
  296.    #define MinStrSpace         5000    /* size of the string space in bytes */
  297. #endif                    /* MinStrSpace */
  298.  
  299. #ifndef MinAbrSize
  300.    #define MinAbrSize         5000    /* size of the block region in bytes */
  301. #endif                    /* MinAbrSize */
  302.  
  303. #ifndef MinMStackSize
  304.    #define MinMStackSize     2000    /* size of the main stack in words */
  305. #endif                    /* MinMStackSize */
  306.  
  307. #ifndef MinStackSize
  308.    #define MinStackSize         1000    /* words in co-expression stack */
  309. #endif                    /* MinStackSize */
  310.  
  311. #ifndef MinQualLstSize
  312.    #define MinQualLstSize      500    /* size of qualifier pointer region */
  313. #endif                    /* MinQualLstSize */
  314.  
  315. #ifndef GranSize
  316.    #define GranSize           64    /* storage allocation granule size */
  317. #endif                    /* GranSize */
  318.  
  319. #ifndef Sqlinc
  320.    #define Sqlinc 128*sizeof(dptr *)    /* qualifier pointer list increment */
  321. #endif                    /* Sqlinc */
  322.