1995-08-09 08:06:35 -07:00
|
|
|
/***********************************************************************/
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Objective Caml */
|
1995-08-09 08:06:35 -07:00
|
|
|
/* */
|
|
|
|
/* Xavier Leroy and Damien Doligez, INRIA Rocquencourt */
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Copyright 1996 Institut National de Recherche en Informatique et */
|
1999-11-17 10:59:06 -08:00
|
|
|
/* en Automatique. All rights reserved. This file is distributed */
|
2001-12-07 05:41:02 -08:00
|
|
|
/* under the terms of the GNU Library General Public License, with */
|
|
|
|
/* the special exception on linking described in file ../LICENSE. */
|
1995-08-09 08:06:35 -07:00
|
|
|
/* */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
2003-12-15 08:28:22 -08:00
|
|
|
#ifndef CAML_CONFIG_H
|
|
|
|
#define CAML_CONFIG_H
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2002-02-19 06:37:44 -08:00
|
|
|
/* <include ../config/m.h> */
|
|
|
|
/* <include ../config/s.h> */
|
|
|
|
/* <private> */
|
1995-05-04 03:15:53 -07:00
|
|
|
#include "../config/m.h"
|
|
|
|
#include "../config/s.h"
|
2002-02-19 06:37:44 -08:00
|
|
|
/* </private> */
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2003-12-29 14:15:02 -08:00
|
|
|
#ifndef CAML_NAME_SPACE
|
2003-12-15 08:28:22 -08:00
|
|
|
#include "compatibility.h"
|
2003-12-29 14:15:02 -08:00
|
|
|
#endif
|
2003-12-15 08:28:22 -08:00
|
|
|
|
2005-09-22 07:21:50 -07:00
|
|
|
/* Types for signed chars, 32-bit integers, 64-bit integers,
|
|
|
|
native integers (as wide as a pointer type) */
|
2000-02-11 04:03:31 -08:00
|
|
|
|
|
|
|
typedef signed char schar;
|
|
|
|
|
2005-09-22 07:21:50 -07:00
|
|
|
#if SIZEOF_PTR == SIZEOF_LONG
|
2005-09-24 02:19:28 -07:00
|
|
|
/* Standard models: ILP32 or I32LP64 */
|
2005-09-22 07:21:50 -07:00
|
|
|
typedef long intnat;
|
|
|
|
typedef unsigned long uintnat;
|
|
|
|
#define ARCH_INTNAT_PRINTF_FORMAT "l"
|
|
|
|
#elif SIZEOF_PTR == SIZEOF_INT
|
2005-09-24 02:19:28 -07:00
|
|
|
/* Hypothetical IP32L64 model */
|
2005-09-22 07:21:50 -07:00
|
|
|
typedef int intnat;
|
|
|
|
typedef unsigned int uintnat;
|
|
|
|
#define ARCH_INTNAT_PRINTF_FORMAT ""
|
|
|
|
#elif SIZEOF_PTR == 8 && defined(ARCH_INT64_TYPE)
|
2005-09-24 02:19:28 -07:00
|
|
|
/* Win64 model: IL32LLP64 */
|
2005-09-22 07:21:50 -07:00
|
|
|
typedef ARCH_INT64_TYPE intnat;
|
|
|
|
typedef ARCH_UINT64_TYPE uintnat;
|
|
|
|
#define ARCH_INTNAT_PRINTF_FORMAT ARCH_INT64_PRINTF_FORMAT
|
|
|
|
#else
|
|
|
|
#error "No integer type available to represent pointers"
|
|
|
|
#endif
|
2000-02-21 10:13:48 -08:00
|
|
|
|
2000-02-11 04:03:31 -08:00
|
|
|
#if SIZEOF_INT == 4
|
|
|
|
typedef int int32;
|
|
|
|
typedef unsigned int uint32;
|
2005-09-22 07:21:50 -07:00
|
|
|
#define ARCH_INT32_PRINTF_FORMAT ""
|
2000-02-11 04:03:31 -08:00
|
|
|
#elif SIZEOF_LONG == 4
|
|
|
|
typedef long int32;
|
|
|
|
typedef unsigned long uint32;
|
2005-09-22 07:21:50 -07:00
|
|
|
#define ARCH_INT32_PRINTF_FORMAT "l"
|
2000-02-11 04:03:31 -08:00
|
|
|
#elif SIZEOF_SHORT == 4
|
|
|
|
typedef short int32;
|
|
|
|
typedef unsigned short uint32;
|
2005-09-22 07:21:50 -07:00
|
|
|
#define ARCH_INT32_PRINTF_FORMAT ""
|
|
|
|
#else
|
|
|
|
#error "No 32-bit integer type available"
|
2000-02-11 04:03:31 -08:00
|
|
|
#endif
|
|
|
|
|
2002-05-25 01:32:53 -07:00
|
|
|
#if defined(ARCH_INT64_TYPE)
|
2000-02-11 07:47:09 -08:00
|
|
|
typedef ARCH_INT64_TYPE int64;
|
|
|
|
typedef ARCH_UINT64_TYPE uint64;
|
2000-02-11 04:03:31 -08:00
|
|
|
#else
|
2004-08-12 05:13:34 -07:00
|
|
|
# ifdef ARCH_BIG_ENDIAN
|
2002-05-25 01:32:53 -07:00
|
|
|
typedef struct { uint32 h, l; } uint64, int64;
|
|
|
|
# else
|
|
|
|
typedef struct { uint32 l, h; } uint64, int64;
|
|
|
|
# endif
|
2000-02-11 04:03:31 -08:00
|
|
|
#endif
|
|
|
|
|
2002-02-19 06:37:44 -08:00
|
|
|
/* Endianness of floats */
|
|
|
|
|
|
|
|
/* ARCH_FLOAT_ENDIANNESS encodes the byte order of doubles as follows:
|
|
|
|
the value [0xabcdefgh] means that the least significant byte of the
|
|
|
|
float is at byte offset [a], the next lsb at [b], ..., and the
|
|
|
|
most significant byte at [h]. */
|
|
|
|
|
2007-10-08 07:19:34 -07:00
|
|
|
#if defined(__arm__) && !defined(__ARM_EABI__)
|
2002-02-19 06:37:44 -08:00
|
|
|
#define ARCH_FLOAT_ENDIANNESS 0x45670123
|
|
|
|
#elif defined(ARCH_BIG_ENDIAN)
|
|
|
|
#define ARCH_FLOAT_ENDIANNESS 0x76543210
|
|
|
|
#else
|
|
|
|
#define ARCH_FLOAT_ENDIANNESS 0x01234567
|
|
|
|
#endif
|
2000-02-11 04:03:31 -08:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
/* We use threaded code interpretation if the compiler provides labels
|
2002-05-25 01:32:53 -07:00
|
|
|
as first-class values (GCC 2.x). */
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2004-04-19 00:55:28 -07:00
|
|
|
#if defined(__GNUC__) && __GNUC__ >= 2 && !defined(DEBUG) && !defined (SHRINKED_GNUC) && !defined(CAML_JIT)
|
1995-05-04 03:15:53 -07:00
|
|
|
#define THREADED_CODE
|
|
|
|
#endif
|
|
|
|
|
1995-05-09 02:34:59 -07:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
/* Do not change this definition. */
|
|
|
|
#define Page_size (1 << Page_log)
|
|
|
|
|
|
|
|
/* Memory model parameters */
|
|
|
|
|
|
|
|
/* The size of a page for memory management (in bytes) is [1 << Page_log].
|
2005-09-22 07:21:50 -07:00
|
|
|
It must be a multiple of [sizeof (value)]. */
|
1995-05-04 03:15:53 -07:00
|
|
|
#define Page_log 12 /* A page is 4 kilobytes. */
|
|
|
|
|
1995-07-20 00:51:48 -07:00
|
|
|
/* Initial size of stack (bytes). */
|
1995-11-27 07:36:57 -08:00
|
|
|
#define Stack_size (4096 * sizeof(value))
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
/* Minimum free size of stack (bytes); below that, it is reallocated. */
|
1995-11-27 07:36:57 -08:00
|
|
|
#define Stack_threshold (256 * sizeof(value))
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1997-05-13 07:45:38 -07:00
|
|
|
/* Default maximum size of the stack (words). */
|
2006-09-19 05:40:29 -07:00
|
|
|
#define Max_stack_def (1024 * 1024)
|
1995-07-20 00:51:48 -07:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
/* Maximum size of a block allocated in the young generation (words). */
|
|
|
|
/* Must be > 4 */
|
|
|
|
#define Max_young_wosize 256
|
|
|
|
|
|
|
|
|
|
|
|
/* Minimum size of the minor zone (words).
|
|
|
|
This must be at least [Max_young_wosize + 1]. */
|
|
|
|
#define Minor_heap_min 4096
|
|
|
|
|
|
|
|
/* Maximum size of the minor zone (words).
|
|
|
|
Must be greater than or equal to [Minor_heap_min].
|
|
|
|
*/
|
|
|
|
#define Minor_heap_max (1 << 28)
|
|
|
|
|
|
|
|
/* Default size of the minor zone. (words) */
|
|
|
|
#define Minor_heap_def 32768
|
|
|
|
|
|
|
|
|
|
|
|
/* Minimum size increment when growing the heap (words).
|
|
|
|
Must be a multiple of [Page_size / sizeof (value)]. */
|
|
|
|
#define Heap_chunk_min (2 * Page_size / sizeof (value))
|
|
|
|
|
1997-05-21 08:28:15 -07:00
|
|
|
/* Default size increment when growing the heap. (words)
|
1995-05-04 03:15:53 -07:00
|
|
|
Must be a multiple of [Page_size / sizeof (value)]. */
|
2002-11-15 08:15:19 -08:00
|
|
|
#define Heap_chunk_def (15 * Page_size)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1997-05-21 08:28:15 -07:00
|
|
|
/* Default initial size of the major heap (words);
|
1997-05-13 07:45:38 -07:00
|
|
|
same constraints as for Heap_chunk_def. */
|
2002-11-15 08:15:19 -08:00
|
|
|
#define Init_heap_def (15 * Page_size)
|
1997-05-13 07:45:38 -07:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
/* Default speed setting for the major GC. The heap will grow until
|
|
|
|
the dead objects and the free list represent this percentage of the
|
2002-01-18 07:13:26 -08:00
|
|
|
total size of live objects. */
|
2002-08-01 07:14:10 -07:00
|
|
|
#define Percent_free_def 80
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2002-05-28 09:57:31 -07:00
|
|
|
/* Default setting for the compacter: 500%
|
|
|
|
(i.e. trigger the compacter when 5/6 of the heap is free or garbage)
|
|
|
|
This can be set quite high because the overhead is over-estimated
|
|
|
|
when fragmentation occurs.
|
|
|
|
*/
|
|
|
|
#define Max_percent_free_def 500
|
1997-05-13 07:45:38 -07:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2003-12-15 08:28:22 -08:00
|
|
|
#endif /* CAML_CONFIG_H */
|