source: branches/arm/lisp-kernel/area.h @ 13923

Last change on this file since 13923 was 13789, checked in by gb, 9 years ago

Lots of (mostly small) changes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.1 KB
RevLine 
[6]1/*
[13067]2   Copyright (C) 2009 Clozure Associates
[6]3   Copyright (C) 1994-2001 Digitool, Inc
[13066]4   This file is part of Clozure CL. 
[6]5
[13066]6   Clozure CL is licensed under the terms of the Lisp Lesser GNU Public
7   License , known as the LLGPL and distributed with Clozure CL as the
[6]8   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
[13066]9   which is distributed with Clozure CL as the file "LGPL".  Where these
[6]10   conflict, the preamble takes precedence. 
11
[13066]12   Clozure CL is referenced in the preamble as the "LIBRARY."
[6]13
14   The LLGPL is also available online at
15   http://opensource.franz.com/preamble.html
16*/
17
18#ifndef __AREA_H__
19#define __AREA_H__ 1
20
21
22#include "bits.h"
23#include "memprotect.h"
24
25
26
27typedef enum {
28  AREA_VOID = 0,                /* Not really an area at all */
[1563]29  AREA_CSTACK = 1<<fixnumshift, /* A control stack */
30  AREA_VSTACK = 2<<fixnumshift, /* A value stack.  The GC sees it as being doubleword-aligned */
31  AREA_TSTACK = 3<<fixnumshift, /* A temp stack.  It -is- doubleword-aligned */
32  AREA_READONLY = 4<<fixnumshift, /* A (cfm) read-only section. */
[12679]33  AREA_WATCHED = 5<<fixnumshift, /* A static area containing a single object. */
[13279]34  AREA_STATIC_CONS = 6<<fixnumshift, /* static, conses only */
35  AREA_MANAGED_STATIC = 7<<fixnumshift, /* A resizable static area */
36  AREA_STATIC = 8<<fixnumshift, /* A  static section: contains
[6]37                                 roots, but not GCed */
[13279]38  AREA_DYNAMIC = 9<<fixnumshift /* A heap. Only one such area is "the heap."*/
[6]39} area_code;
40
41typedef struct area {
[1054]42  struct area* pred;            /* linked list predecessor */
43  struct area* succ;            /* linked list successor */
44  char* low;                    /* arithmetic lower limit on addresses
45                                   (inclusive) */
46  char* high;                   /* arithmetic upper limit on addresses
47                                   (exclusive) */
48  char* active;                 /* low bound (stack) or high bound
49                                   (heap) */
50  char* softlimit;              /* only makes sense for dynamic heaps
51                                   & stacks */
52  char* hardlimit;              /* only makes sense for dynamic heaps
53                                   & stacks */
[557]54  natural code;
[1054]55  natural*  markbits;           /* markbits for active area */
56  natural ndnodes;              /* "active" size of dynamic area or
57                                   stack */
58  struct area* older;           /* if ephemeral, the next older ephemeral area
[6]59                                 or the dynamic area */
[1054]60  struct area* younger;         /* if ephemeral, the next "younger"
61                                  ephemeral area if there is one.  If
62                                  dynamic, the oldest ephemeral
63                                  area. */
64  char*  h;                     /* The pointer allocated to contain
65                                 this area, or NULL if the operating
66                                 system allocated it for us. */
67  protected_area* softprot;     /* "soft" protected_area */
68  protected_area* hardprot;     /* "hard" protected_area */
[4568]69  TCR * owner;                  /* TCR that the area belongs to, if a stack */
[1054]70  natural*  refbits;            /* intergenerational references.  May
71                                               or may not be the same
72                                               as markbits */
73  natural threshold;            /* egc threshold (boxed "fullword
74                                   count") or 0 */
[6]75  LispObj gccount;              /* boxed generation GC count. */
[2995]76  natural static_dnodes;        /* for hash consing, maybe other things. */
77  natural *static_used;         /* bitvector */
[6]78} area;
79
80
81/*
82  Areas are kept in a doubly-linked list.
83  The list header is just a distinguished element of
84  that list; by convention, the "active" dynamic
85  area is described by that header's successor, and areas
86  that may have entries in their "markbits" vector (heaps)
87  precede (in the area_list->succ sense) those  that don't (stacks).
88  The list header's "area" pointer is an "AREA_VOID" area; the header
89  (once allocated during kernel initialization) never
90  moves or changes.  Lisp code can get its hands on
91  the list header via a nilreg global, and carefully,
92  atomically, traverse it to do ROOM, etc.
93*/
94
95
96area *new_area(BytePtr, BytePtr, area_code);
[605]97void add_area(area *, TCR *);
98void add_area_holding_area_lock(area *);
99void condemn_area(area *, TCR *);
100void condemn_area_holding_area_lock(area *);
[6]101area *area_containing(BytePtr);
102area *stack_area_containing(BytePtr);
[3986]103area *heap_area_containing(BytePtr);
[6]104void tenure_to_area(area *);
105void untenure_from_area(area *);
106
[4545]107/* serialize add_area/remove_area, and also the tcr queue */
108void *tcr_area_lock;
[6]109
110#define reserved_area ((area *)(all_areas))
111#define active_dynamic_area ((area *)(reserved_area->succ))
112
113typedef struct area_list {
114  area *the_area;
115  struct area_list *next;
116} area_list;
117
118/* The useable size of a tsp or vsp stack segment.
119  */
120/* #define STACK_SEGMENT_SIZE (64<<10) */
121#define MIN_CSTACK_SIZE (1<<17)
122#define CSTACK_HARDPROT (100<<10)
123#define CSTACK_SOFTPROT (100<<10)
124#define MIN_VSTACK_SIZE (1<<16)
125#define VSTACK_HARDPROT (1<<12)
[13617]126
[13431]127#ifdef PPC
[6]128#define VSTACK_SOFTPROT (1<<16)
[13431]129#else
130#define VSTACK_SOFTPROT CSTACK_SOFTPROT
131#endif
[13617]132
[6]133#define MIN_TSTACK_SIZE (1<<18)
134#define TSTACK_HARDPROT 0
135#define TSTACK_SOFTPROT (1<<16)
[13617]136
[2846]137#ifdef PPC
[1770]138#define CS_OVERFLOW_FORCE_LIMIT ((natural)(-(sizeof(lisp_frame))))
[2846]139#endif
[6]140
[2846]141#ifdef X86
142#define CS_OVERFLOW_FORCE_LIMIT ((natural)(-16))
143#endif
144
[13719]145#ifdef ARM
146#define CS_OVERFLOW_FORCE_LIMIT ((natural)(-(sizeof(lisp_frame))))
147#endif
[3687]148
[6]149
[2872]150
[13279]151#if (WORD_SIZE==64)
152#define PURESPACE_RESERVE 0x2000000000LL /* 128 GB */
153#define PURESPACE_SIZE (1LL<<30LL)
[5170]154#else
[13789]155#ifdef ARM
156#define PURESPACE_RESERVE (8<<20)
157#define PURESPACE_SIZE (4<<20)
158#else
[13279]159#define PURESPACE_RESERVE (128<<20) /* MB */
160#define PURESPACE_SIZE (64<<20)
[5170]161#endif
[13789]162#endif
[5170]163
[6]164#define STATIC_RESERVE heap_segment_size
[5637]165
[6]166
[10947]167#define SPJUMP_TARGET_ADDRESS (STATIC_BASE_ADDRESS+0x3000)
168
[6]169extern LispObj image_base;
170extern BytePtr pure_space_start, pure_space_active, pure_space_limit;
171extern BytePtr static_space_start, static_space_active, static_space_limit;
172extern area *find_readonly_area(void);
[13279]173extern BytePtr low_relocatable_address, high_relocatable_address,
174  low_markable_address, high_markable_address;
[6]175
176#endif /* __AREA_H__ */
Note: See TracBrowser for help on using the repository browser.