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

« back to all changes in this revision

Viewing changes to src/pmc/ownedhash.pmc

  • 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
 
/* Represents a Hash that is owned by a serialization context. If it gets
2
 
 * modified, we need to trigger the SC write barrier. */
3
 
 
4
 
#include "../6model/sixmodelobject.h"
5
 
 
6
 
pmclass OwnedHash extends Hash provides hash auto_attrs dynpmc group nqp {
7
 
    /* The object that owns this hash. */
8
 
    ATTR PMC *owner;
9
 
    
10
 
    VTABLE void set_integer_keyed(PMC* key, INTVAL value) {
11
 
        PMC *owner;
12
 
        GET_ATTR_owner(interp, SELF, owner);
13
 
        if (!PMC_IS_NULL(owner))
14
 
            OBJ_SC_WRITE_BARRIER(owner);
15
 
        SUPER(key, value);
16
 
    }
17
 
    VTABLE void set_integer_keyed_int(INTVAL key, INTVAL value) {
18
 
        PMC *owner;
19
 
        GET_ATTR_owner(interp, SELF, owner);
20
 
        if (!PMC_IS_NULL(owner))
21
 
            OBJ_SC_WRITE_BARRIER(owner);
22
 
        SUPER(key, value);
23
 
    }
24
 
    VTABLE void set_integer_keyed_str(STRING* key, INTVAL value) {
25
 
        PMC *owner;
26
 
        GET_ATTR_owner(interp, SELF, owner);
27
 
        if (!PMC_IS_NULL(owner))
28
 
            OBJ_SC_WRITE_BARRIER(owner);
29
 
        SUPER(key, value);
30
 
    }
31
 
 
32
 
    VTABLE void set_number_keyed(PMC* key, FLOATVAL value) {
33
 
        PMC *owner;
34
 
        GET_ATTR_owner(interp, SELF, owner);
35
 
        if (!PMC_IS_NULL(owner))
36
 
            OBJ_SC_WRITE_BARRIER(owner);
37
 
        SUPER(key, value);
38
 
    }
39
 
    VTABLE void set_number_keyed_int(INTVAL key, FLOATVAL value) {
40
 
        PMC *owner;
41
 
        GET_ATTR_owner(interp, SELF, owner);
42
 
        if (!PMC_IS_NULL(owner))
43
 
            OBJ_SC_WRITE_BARRIER(owner);
44
 
        SUPER(key, value);
45
 
    }
46
 
    VTABLE void set_number_keyed_str(STRING* key, FLOATVAL value) {
47
 
        PMC *owner;
48
 
        GET_ATTR_owner(interp, SELF, owner);
49
 
        if (!PMC_IS_NULL(owner))
50
 
            OBJ_SC_WRITE_BARRIER(owner);
51
 
        SUPER(key, value);
52
 
    }
53
 
 
54
 
    VTABLE void set_string_keyed(PMC* key, STRING* value) {
55
 
        PMC *owner;
56
 
        GET_ATTR_owner(interp, SELF, owner);
57
 
        if (!PMC_IS_NULL(owner))
58
 
            OBJ_SC_WRITE_BARRIER(owner);
59
 
        SUPER(key, value);
60
 
    }
61
 
    VTABLE void set_string_keyed_int(INTVAL key, STRING* value) {
62
 
        PMC *owner;
63
 
        GET_ATTR_owner(interp, SELF, owner);
64
 
        if (!PMC_IS_NULL(owner))
65
 
            OBJ_SC_WRITE_BARRIER(owner);
66
 
        SUPER(key, value);
67
 
    }
68
 
    VTABLE void set_string_keyed_str(STRING* key, STRING* value) {
69
 
        PMC *owner;
70
 
        GET_ATTR_owner(interp, SELF, owner);
71
 
        if (!PMC_IS_NULL(owner))
72
 
            OBJ_SC_WRITE_BARRIER(owner);
73
 
        SUPER(key, value);
74
 
    }
75
 
    
76
 
    VTABLE void set_pmc_keyed(PMC* key, PMC* value) {
77
 
        PMC *owner;
78
 
        GET_ATTR_owner(interp, SELF, owner);
79
 
        if (!PMC_IS_NULL(owner))
80
 
            OBJ_SC_WRITE_BARRIER(owner);
81
 
        SUPER(key, value);
82
 
    }
83
 
    VTABLE void set_pmc_keyed_int(INTVAL key, PMC* value) {
84
 
        PMC *owner;
85
 
        GET_ATTR_owner(interp, SELF, owner);
86
 
        if (!PMC_IS_NULL(owner))
87
 
            OBJ_SC_WRITE_BARRIER(owner);
88
 
        SUPER(key, value);
89
 
    }
90
 
    VTABLE void set_pmc_keyed_str(STRING* key, PMC* value) {
91
 
        PMC *owner;
92
 
        GET_ATTR_owner(interp, SELF, owner);
93
 
        if (!PMC_IS_NULL(owner))
94
 
            OBJ_SC_WRITE_BARRIER(owner);
95
 
        SUPER(key, value);
96
 
    }
97
 
    
98
 
    VTABLE void mark() {
99
 
        PMC *owner;
100
 
        GET_ATTR_owner(interp, SELF, owner);
101
 
        Parrot_gc_mark_PMC_alive(INTERP, owner);
102
 
        SUPER();
103
 
    }
104
 
}