1
#ifndef P6OPAQUE_H_GUARD
2
#define P6OPAQUE_H_GUARD
4
/* This is how an instance with the P6opaque representation starts. However, what
5
* follows on from this depends on the declaration. For object attributes, it will
6
* be a pointer size and point to another 6model Object. For native integers and
7
* numbers, it will be the appropriate sized piece of memory to store them
8
* right there in the object. Note that P6opaque does not do packed storage, so
9
* an int2 gets as much space as an int. */
11
/* The commonalities all objects have. */
12
SixModelObjectCommonalities common;
15
/* This is used in the name to class mapping. */
21
/* This is used in boxed type mappings. */
25
} P6opaqueBoxedTypeMap;
27
/* The P6opaque REPR data has the slot mapping, allocation size and
28
* various other bits of info. It hangs off the REPR_data pointer
31
/* The memory allocation size for an object instance. Includes space
32
* for the 6model common header and attributes. Size is in bytes. */
33
INTVAL allocation_size;
35
/* The number of attributes we have allocated slots for. Note that
36
* slots can vary in size. */
37
INTVAL num_attributes;
39
/* Maps attribute position numbers to the byte offset in the object. */
40
INTVAL *attribute_offsets;
42
/* If the attribute was actually flattened in to this object from another
43
* representation, this is the s-table of the type of that attribute. NULL
44
* for attributes that are just reference types. */
45
STable **flattened_stables;
47
/* Flags if we are MI or not. */
50
/* Instantiated objects are just a blank piece of memory that needs to
51
* be set up. However, in some cases we'd like them to magically turn in
52
* to some container type. */
53
PMC **auto_viv_values;
55
/* Slot to delegate to when we need to unbox to a native integer. */
56
INTVAL unbox_int_slot;
58
/* Slot to delegate to when we need to unbox to a native number. */
59
INTVAL unbox_num_slot;
61
/* Slot to delegate to when we need to unbox to a native string. */
62
INTVAL unbox_str_slot;
64
/* If we have any other boxings, this maps repr ID to slot. */
65
P6opaqueBoxedTypeMap *unbox_slots;
67
/* Slot containing object to delegate for positional things. */
70
/* Slot containing object to delegate for associative things. */
73
/* A table mapping attribute names to indexes (which can then be looked
74
* up in the offset table). Uses a final null entry as a sentinel. */
75
P6opaqueNameMap *name_to_index_mapping;
77
/* Offsets into the object that are elligible for PMC GC marking, and how
78
* many of them we have. */
79
INTVAL *gc_pmc_mark_offsets;
80
INTVAL gc_pmc_mark_offsets_count;
82
/* Slots holding flattened objects that need another REPR to initialize
83
* them; terminated with -1. */
84
INTVAL *initialize_slots;
86
/* Slots holding flattened objects that need another REPR to mark them;
87
* terminated with -1. */
88
INTVAL *gc_mark_slots;
90
/* Slots holding flattened objects that need another REPR to clean them;
91
* terminated with -1. */
92
INTVAL *gc_cleanup_slots;
95
/* Initializes the P6opaque REPR. */
96
REPROps * P6opaque_initialize(PARROT_INTERP);