maxscript/kernel/collectable.h File Reference

collectable.h File Reference

Classes

struct  free_mem
 
class  Collectable
 
class  ValueMapper
 

Macros

#define ALLOCATOR_STACK_SIZE   2048000
 
#define ALLOCATOR_STACK_SIZE_BUFFER   2000
 
#define STACK_LIMIT_BUFFER_SIZE   64000
 
#define ENABLE_STACK_ALLOCATE(_class)
 
#define GC_NUM_SUBLISTS   128
 
#define GC_LOW_SUBLIST   16
 
#define GC_SUBLIST_INDEX_SHIFT   4
 

Enumerations

enum  collectable_state {
  booting, pre_gc, in_mutator, in_mark,
  in_sweep, closing_down, in_coalesce
}
 
enum  gc_flags {
  GC_IN_USE = 0x0001, GC_GARBAGE = 0x0002, GC_PERMANENT = 0x0004, GC_IN_HEAP = 0x0008,
  GC_NOT_NEW = 0x0010, GC_STATIC = 0x0020, GC_ON_STACK = 0x0040, GC_MIGRATED_TO_HEAP = 0x0080
}
 
enum  gp_flags2 {
  COLLECTABLE_IN_SPRIN1 = 0x0001, COLLECTABLE_UNUSED2 = 0x0002, COLLECTABLE_UNUSED3 = 0x0004, COLLECTABLE_UNUSED4 = 0x0008,
  COLLECTABLE_UNUSED5 = 0x0010, COLLECTABLE_UNUSED6 = 0x0020, COLLECTABLE_UNUSED7 = 0x0040, COLLECTABLE_UNUSED8 = 0x0080
}
 
enum  gp_flags3 {
  VALUE_FLAGBIT_0 = 0x0001, VALUE_FLAGBIT_1 = 0x0002, VALUE_FLAGBIT_2 = 0x0004, VALUE_FLAGBIT_3 = 0x0008,
  VALUE_FLAGBIT_4 = 0x0010, VALUE_FLAGBIT_5 = 0x0020, VALUE_FLAGBIT_6 = 0x0040, VALUE_FLAGBIT_7 = 0x0080,
  VALUE_FLAGBIT_8 = 0x0100, VALUE_FLAGBIT_9 = 0x0200, VALUE_FLAGBIT_10 = 0x0400, VALUE_FLAGBIT_11 = 0x0800,
  VALUE_FLAGBIT_12 = 0x1000, VALUE_FLAGBIT_13 = 0x2000, VALUE_FLAGBIT_14 = 0x4000, VALUE_FLAGBIT_15 = 0x8000
}
 

Functions

ScripterExport void push_alloc_frame ()
 
ScripterExport void pop_alloc_frame ()
 
ScripterExport void pop_alloc_frame (Value *&result)
 
ScripterExport void ms_free (void *p)
 
ScripterExport voidms_malloc (size_t sz)
 
ScripterExport voidms_realloc (void *p, size_t sz)
 
void ms_make_collectable (Collectable *v)
 

Variables

static const int STACK_FRAME_HEADER_SIZE = 9
 

Macro Definition Documentation

#define ALLOCATOR_STACK_SIZE   2048000
#define ALLOCATOR_STACK_SIZE_BUFFER   2000
#define STACK_LIMIT_BUFFER_SIZE   64000
#define ENABLE_STACK_ALLOCATE (   _class)
Value:
ScripterExport void* operator new (size_t sz) { return Collectable::operator new (sz, GC_ON_STACK); } \
ScripterExport void* operator new (size_t sz, char flag) { return Collectable::operator new (sz, flag); }
Definition: collectable.h:41
#define ScripterExport
Definition: ScripterExport.h:7
#define GC_NUM_SUBLISTS   128
#define GC_LOW_SUBLIST   16
#define GC_SUBLIST_INDEX_SHIFT   4

Enumeration Type Documentation

Enumerator
booting 
pre_gc 
in_mutator 
in_mark 
in_sweep 
closing_down 
in_coalesce 
14 {
15  booting,
16  pre_gc,
17  in_mutator,
18  in_mark,
19  in_sweep,
20  closing_down,
22 };
Definition: collectable.h:18
Definition: collectable.h:16
Definition: collectable.h:15
Definition: collectable.h:17
Definition: collectable.h:21
Definition: collectable.h:19
Definition: collectable.h:20
enum gc_flags
Enumerator
GC_IN_USE 
GC_GARBAGE 
GC_PERMANENT 
GC_IN_HEAP 
GC_NOT_NEW 
GC_STATIC 
GC_ON_STACK 
GC_MIGRATED_TO_HEAP 
34 {
35  GC_IN_USE = 0x0001,
36  GC_GARBAGE = 0x0002,
37  GC_PERMANENT = 0x0004,
38  GC_IN_HEAP = 0x0008,
39  GC_NOT_NEW = 0x0010,
40  GC_STATIC = 0x0020,
41  GC_ON_STACK = 0x0040,
42  GC_MIGRATED_TO_HEAP = 0x0080,
43 };
Definition: collectable.h:42
Definition: collectable.h:40
Definition: collectable.h:41
Definition: collectable.h:37
Definition: collectable.h:39
Definition: collectable.h:35
Definition: collectable.h:36
Definition: collectable.h:38
enum gp_flags2
Enumerator
COLLECTABLE_IN_SPRIN1 
COLLECTABLE_UNUSED2 
COLLECTABLE_UNUSED3 
COLLECTABLE_UNUSED4 
COLLECTABLE_UNUSED5 
COLLECTABLE_UNUSED6 
COLLECTABLE_UNUSED7 
COLLECTABLE_UNUSED8 
47 {
48  COLLECTABLE_IN_SPRIN1 = 0x0001, // used by values that can recursively call sprin1. For example, arrays
49  COLLECTABLE_UNUSED2 = 0x0002,
50  COLLECTABLE_UNUSED3 = 0x0004,
51  COLLECTABLE_UNUSED4 = 0x0008,
52  COLLECTABLE_UNUSED5 = 0x0010,
53  COLLECTABLE_UNUSED6 = 0x0020,
54  COLLECTABLE_UNUSED7 = 0x0040,
55  COLLECTABLE_UNUSED8 = 0x0080,
56 };
Definition: collectable.h:50
Definition: collectable.h:54
Definition: collectable.h:52
Definition: collectable.h:55
Definition: collectable.h:48
Definition: collectable.h:49
Definition: collectable.h:53
Definition: collectable.h:51
enum gp_flags3
Enumerator
VALUE_FLAGBIT_0 
VALUE_FLAGBIT_1 
VALUE_FLAGBIT_2 
VALUE_FLAGBIT_3 
VALUE_FLAGBIT_4 
VALUE_FLAGBIT_5 
VALUE_FLAGBIT_6 
VALUE_FLAGBIT_7 
VALUE_FLAGBIT_8 
VALUE_FLAGBIT_9 
VALUE_FLAGBIT_10 
VALUE_FLAGBIT_11 
VALUE_FLAGBIT_12 
VALUE_FLAGBIT_13 
VALUE_FLAGBIT_14 
VALUE_FLAGBIT_15 
60 {
61  VALUE_FLAGBIT_0 = 0x0001,
62  VALUE_FLAGBIT_1 = 0x0002,
63  VALUE_FLAGBIT_2 = 0x0004,
64  VALUE_FLAGBIT_3 = 0x0008,
65  VALUE_FLAGBIT_4 = 0x0010,
66  VALUE_FLAGBIT_5 = 0x0020,
67  VALUE_FLAGBIT_6 = 0x0040,
68  VALUE_FLAGBIT_7 = 0x0080,
69  VALUE_FLAGBIT_8 = 0x0100,
70  VALUE_FLAGBIT_9 = 0x0200,
71  VALUE_FLAGBIT_10 = 0x0400,
72  VALUE_FLAGBIT_11 = 0x0800,
73  VALUE_FLAGBIT_12 = 0x1000,
74  VALUE_FLAGBIT_13 = 0x2000,
75  VALUE_FLAGBIT_14 = 0x4000,
76  VALUE_FLAGBIT_15 = 0x8000,
77 };
Definition: collectable.h:66
Definition: collectable.h:73
Definition: collectable.h:69
Definition: collectable.h:76
Definition: collectable.h:63
Definition: collectable.h:75
Definition: collectable.h:62
Definition: collectable.h:72
Definition: collectable.h:70
Definition: collectable.h:68
Definition: collectable.h:65
Definition: collectable.h:67
Definition: collectable.h:71
Definition: collectable.h:74
Definition: collectable.h:64
Definition: collectable.h:61

Function Documentation

ScripterExport void push_alloc_frame ( )
ScripterExport void pop_alloc_frame ( )
ScripterExport void pop_alloc_frame ( Value *&  result)
ScripterExport void ms_free ( void p)
ScripterExport void* ms_malloc ( size_t  sz)
ScripterExport void* ms_realloc ( void p,
size_t  sz 
)
void ms_make_collectable ( Collectable v)
inline
207 {
208  if (v != NULL && Collectable::state != closing_down)
209  v->make_collectable();
210 }
#define NULL
Definition: autoptr.h:18
static ScripterExport collectable_state state
Definition: collectable.h:126
ScripterExport void make_collectable()
Definition: collectable.h:20

Variable Documentation

const int STACK_FRAME_HEADER_SIZE = 9
static