collectable.h File Reference

Go to the source code of this file.

Classes

struct   free_mem
class   Collectable
class   ValueMapper

Defines

#define  ALLOCATOR_STACK_SIZE   2048000
#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 void *  ms_malloc (size_t sz)
ScripterExport void *  ms_realloc (void *p, size_t sz)
void  ms_make_collectable (Collectable *v)

Variables

static const int  STACK_FRAME_HEADER_SIZE = 9

Define Documentation

#define ALLOCATOR_STACK_SIZE   2048000

Definition at line 83 of file collectable.h.

#define STACK_LIMIT_BUFFER_SIZE   64000

Definition at line 84 of file collectable.h.

#define ENABLE_STACK_ALLOCATE (   _class )
Value:
ScripterExport void* operator new (size_t sz) { return stack_alloc(sz); }   \
    ScripterExport void* operator new (size_t sz, char flag) { return Collectable::operator new (sz, flag); }

Definition at line 92 of file collectable.h.

#define GC_NUM_SUBLISTS   128

Definition at line 102 of file collectable.h.

#define GC_LOW_SUBLIST   16

Definition at line 103 of file collectable.h.

#define GC_SUBLIST_INDEX_SHIFT   4

Definition at line 104 of file collectable.h.


Enumeration Type Documentation

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 

Definition at line 33 of file collectable.h.

{
    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
Enumerator:
COLLECTABLE_IN_SPRIN1 
COLLECTABLE_UNUSED2 
COLLECTABLE_UNUSED3 
COLLECTABLE_UNUSED4 
COLLECTABLE_UNUSED5 
COLLECTABLE_UNUSED6 
COLLECTABLE_UNUSED7 
COLLECTABLE_UNUSED8 

Definition at line 46 of file collectable.h.

{
    COLLECTABLE_IN_SPRIN1   = 0x0001, // used by values that can recursively call sprin1. For example, arrays
    COLLECTABLE_UNUSED2     = 0x0002,
    COLLECTABLE_UNUSED3     = 0x0004,
    COLLECTABLE_UNUSED4     = 0x0008,
    COLLECTABLE_UNUSED5     = 0x0010,
    COLLECTABLE_UNUSED6     = 0x0020,
    COLLECTABLE_UNUSED7     = 0x0040,
    COLLECTABLE_UNUSED8     = 0x0080,
};
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 

Definition at line 59 of file collectable.h.

{
    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,
};

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]

Definition at line 197 of file collectable.h.


Variable Documentation

const int STACK_FRAME_HEADER_SIZE = 9 [static]

Definition at line 86 of file collectable.h.