~ubuntu-branches/ubuntu/vivid/nqp/vivid-proposed

« back to all changes in this revision

Viewing changes to src/6model/reprs/P6opaque.h

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2013-11-01 12:09:18 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20131101120918-kx51sl0sxl3exsxi
Tags: 2013.10-1
* New upstream release
* Bump versioned (Build-)Depends on parrot
* Update patches
* Install new README.pod
* Fix vcs-field-not-canonical
* Do not install rubyish examples
* Do not Depends on parrot-devel anymore
* Add 07_disable-serialization-tests.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef P6OPAQUE_H_GUARD
2
 
#define P6OPAQUE_H_GUARD
3
 
 
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. */
10
 
typedef struct {
11
 
    /* The commonalities all objects have. */
12
 
    SixModelObjectCommonalities common;
13
 
} P6opaqueInstance;
14
 
 
15
 
/* This is used in the name to class mapping. */
16
 
typedef struct {
17
 
    PMC *class_key;
18
 
    PMC *name_map;
19
 
} P6opaqueNameMap;
20
 
 
21
 
/* This is used in boxed type mappings. */
22
 
typedef struct {
23
 
    INTVAL repr_id;
24
 
    INTVAL slot;
25
 
} P6opaqueBoxedTypeMap;
26
 
 
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
29
 
 * in the s-table. */
30
 
typedef struct {
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;
34
 
 
35
 
    /* The number of attributes we have allocated slots for. Note that
36
 
     * slots can vary in size. */
37
 
    INTVAL num_attributes;
38
 
 
39
 
    /* Maps attribute position numbers to the byte offset in the object. */
40
 
    INTVAL *attribute_offsets;
41
 
 
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;
46
 
    
47
 
    /* Flags if we are MI or not. */
48
 
    INTVAL mi;
49
 
    
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;
54
 
 
55
 
    /* Slot to delegate to when we need to unbox to a native integer. */
56
 
    INTVAL unbox_int_slot;
57
 
 
58
 
    /* Slot to delegate to when we need to unbox to a native number. */
59
 
    INTVAL unbox_num_slot;
60
 
 
61
 
    /* Slot to delegate to when we need to unbox to a native string. */
62
 
    INTVAL unbox_str_slot;
63
 
    
64
 
    /* If we have any other boxings, this maps repr ID to slot. */
65
 
    P6opaqueBoxedTypeMap *unbox_slots;
66
 
    
67
 
    /* Slot containing object to delegate for positional things. */
68
 
    INTVAL pos_del_slot;
69
 
    
70
 
    /* Slot containing object to delegate for associative things. */
71
 
    INTVAL ass_del_slot;
72
 
 
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;
76
 
 
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;
81
 
 
82
 
    /* Slots holding flattened objects that need another REPR to initialize
83
 
     * them; terminated with -1. */
84
 
    INTVAL *initialize_slots;
85
 
    
86
 
    /* Slots holding flattened objects that need another REPR to mark them;
87
 
     * terminated with -1. */
88
 
    INTVAL *gc_mark_slots;
89
 
    
90
 
    /* Slots holding flattened objects that need another REPR to clean them;
91
 
     * terminated with -1. */
92
 
    INTVAL *gc_cleanup_slots;
93
 
} P6opaqueREPRData;
94
 
 
95
 
/* Initializes the P6opaque REPR. */
96
 
REPROps * P6opaque_initialize(PARROT_INTERP);
97
 
 
98
 
#endif