3ds Max C++ API Reference
Loading...
Searching...
No Matches
collectable.h File Reference

Classes

struct  free_mem
 
class  Collectable
 
class  ValueMapper
 
class  NewCollectableLinkedListItem
 

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_IS_ANIMATABLE_KNOWN = 0x0002 , COLLECTABLE_IS_ANIMATABLE = 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 (MAXScript_TLS *_tls=nullptr)
 
ScripterExport void pop_alloc_frame (MAXScript_TLS *_tls=nullptr)
 
ScripterExport void pop_alloc_frame (Value *&result, MAXScript_TLS *_tls=nullptr)
 
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

◆ ALLOCATOR_STACK_SIZE

#define ALLOCATOR_STACK_SIZE   2048000

◆ ALLOCATOR_STACK_SIZE_BUFFER

#define ALLOCATOR_STACK_SIZE_BUFFER   2000

◆ STACK_LIMIT_BUFFER_SIZE

#define STACK_LIMIT_BUFFER_SIZE   64000

◆ ENABLE_STACK_ALLOCATE

#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); }
#define ScripterExport
Definition: ScripterExport.h:7
@ GC_ON_STACK
Definition: collectable.h:45

◆ GC_NUM_SUBLISTS

#define GC_NUM_SUBLISTS   128

◆ GC_LOW_SUBLIST

#define GC_LOW_SUBLIST   16

◆ GC_SUBLIST_INDEX_SHIFT

#define GC_SUBLIST_INDEX_SHIFT   4

Enumeration Type Documentation

◆ collectable_state

Enumerator
booting 
pre_gc 
in_mutator 
in_mark 
in_sweep 
closing_down 
in_coalesce 
18{
19 booting,
20 pre_gc,
22 in_mark,
23 in_sweep,
26};
@ pre_gc
Definition: collectable.h:20
@ closing_down
Definition: collectable.h:24
@ in_coalesce
Definition: collectable.h:25
@ in_mark
Definition: collectable.h:22
@ in_sweep
Definition: collectable.h:23
@ booting
Definition: collectable.h:19
@ in_mutator
Definition: collectable.h:21

◆ gc_flags

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 
38{
39 GC_IN_USE = 0x0001,
40 GC_GARBAGE = 0x0002,
41 GC_PERMANENT = 0x0004,
42 GC_IN_HEAP = 0x0008,
43 GC_NOT_NEW = 0x0010,
44 GC_STATIC = 0x0020,
45 GC_ON_STACK = 0x0040,
46 GC_MIGRATED_TO_HEAP = 0x0080,
47};
@ GC_MIGRATED_TO_HEAP
Definition: collectable.h:46
@ GC_PERMANENT
Definition: collectable.h:41
@ GC_IN_USE
Definition: collectable.h:39
@ GC_STATIC
Definition: collectable.h:44
@ GC_GARBAGE
Definition: collectable.h:40
@ GC_NOT_NEW
Definition: collectable.h:43
@ GC_IN_HEAP
Definition: collectable.h:42

◆ gp_flags2

enum gp_flags2
Enumerator
COLLECTABLE_IN_SPRIN1 
COLLECTABLE_IS_ANIMATABLE_KNOWN 
COLLECTABLE_IS_ANIMATABLE 
COLLECTABLE_UNUSED4 
COLLECTABLE_UNUSED5 
COLLECTABLE_UNUSED6 
COLLECTABLE_UNUSED7 
COLLECTABLE_UNUSED8 
51{
52 COLLECTABLE_IN_SPRIN1 = 0x0001, // used by values that can recursively call sprin1. For example, arrays
53 COLLECTABLE_IS_ANIMATABLE_KNOWN = 0x0002, // used by gc for caching whether value derives from animatable. Set if cached. See derives_from_Animatable() below.
54 COLLECTABLE_IS_ANIMATABLE = 0x0004, // If bit 2 is set, this bit says whether value derives from animatable or not
55 COLLECTABLE_UNUSED4 = 0x0008,
56 COLLECTABLE_UNUSED5 = 0x0010,
57 COLLECTABLE_UNUSED6 = 0x0020,
58 COLLECTABLE_UNUSED7 = 0x0040,
59 COLLECTABLE_UNUSED8 = 0x0080,
60};
@ COLLECTABLE_UNUSED6
Definition: collectable.h:57
@ COLLECTABLE_UNUSED8
Definition: collectable.h:59
@ COLLECTABLE_UNUSED7
Definition: collectable.h:58
@ COLLECTABLE_UNUSED4
Definition: collectable.h:55
@ COLLECTABLE_UNUSED5
Definition: collectable.h:56
@ COLLECTABLE_IS_ANIMATABLE
Definition: collectable.h:54
@ COLLECTABLE_IN_SPRIN1
Definition: collectable.h:52
@ COLLECTABLE_IS_ANIMATABLE_KNOWN
Definition: collectable.h:53

◆ gp_flags3

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 
64{
65 VALUE_FLAGBIT_0 = 0x0001,
66 VALUE_FLAGBIT_1 = 0x0002,
67 VALUE_FLAGBIT_2 = 0x0004,
68 VALUE_FLAGBIT_3 = 0x0008,
69 VALUE_FLAGBIT_4 = 0x0010,
70 VALUE_FLAGBIT_5 = 0x0020,
71 VALUE_FLAGBIT_6 = 0x0040,
72 VALUE_FLAGBIT_7 = 0x0080,
73 VALUE_FLAGBIT_8 = 0x0100,
74 VALUE_FLAGBIT_9 = 0x0200,
75 VALUE_FLAGBIT_10 = 0x0400,
76 VALUE_FLAGBIT_11 = 0x0800,
77 VALUE_FLAGBIT_12 = 0x1000,
78 VALUE_FLAGBIT_13 = 0x2000,
79 VALUE_FLAGBIT_14 = 0x4000,
80 VALUE_FLAGBIT_15 = 0x8000,
81};
@ VALUE_FLAGBIT_7
Definition: collectable.h:72
@ VALUE_FLAGBIT_14
Definition: collectable.h:79
@ VALUE_FLAGBIT_11
Definition: collectable.h:76
@ VALUE_FLAGBIT_13
Definition: collectable.h:78
@ VALUE_FLAGBIT_1
Definition: collectable.h:66
@ VALUE_FLAGBIT_15
Definition: collectable.h:80
@ VALUE_FLAGBIT_8
Definition: collectable.h:73
@ VALUE_FLAGBIT_10
Definition: collectable.h:75
@ VALUE_FLAGBIT_9
Definition: collectable.h:74
@ VALUE_FLAGBIT_0
Definition: collectable.h:65
@ VALUE_FLAGBIT_5
Definition: collectable.h:70
@ VALUE_FLAGBIT_4
Definition: collectable.h:69
@ VALUE_FLAGBIT_2
Definition: collectable.h:67
@ VALUE_FLAGBIT_6
Definition: collectable.h:71
@ VALUE_FLAGBIT_3
Definition: collectable.h:68
@ VALUE_FLAGBIT_12
Definition: collectable.h:77

Function Documentation

◆ push_alloc_frame()

ScripterExport void push_alloc_frame ( MAXScript_TLS _tls = nullptr)

◆ pop_alloc_frame() [1/2]

ScripterExport void pop_alloc_frame ( MAXScript_TLS _tls = nullptr)

◆ pop_alloc_frame() [2/2]

ScripterExport void pop_alloc_frame ( Value *&  result,
MAXScript_TLS _tls = nullptr 
)

◆ ms_free()

ScripterExport void ms_free ( void p)

◆ ms_malloc()

ScripterExport void * ms_malloc ( size_t  sz)

◆ ms_realloc()

ScripterExport void * ms_realloc ( void p,
size_t  sz 
)

◆ ms_make_collectable()

void ms_make_collectable ( Collectable v)
inline
219{
220 if (v != nullptr && Collectable::state != closing_down)
221 v->make_collectable();
222}
ScripterExport void make_collectable()
static ScripterExport collectable_state state
Definition: collectable.h:131

Variable Documentation

◆ STACK_FRAME_HEADER_SIZE

const int STACK_FRAME_HEADER_SIZE = 9
static