/home/travis/build/MoarVM/MoarVM/src/6model/reprs/NativeRef.h
Line | Count | Source |
1 | | /* Representation of a reference to a native value. */ |
2 | | struct MVMNativeRefBody { |
3 | | union { |
4 | | struct { |
5 | | MVMFrame *frame; |
6 | | MVMuint16 env_idx; |
7 | | MVMuint16 type; |
8 | | } lex; |
9 | | struct { |
10 | | MVMObject *obj; |
11 | | MVMObject *class_handle; |
12 | | MVMString *name; |
13 | | } attribute; |
14 | | struct { |
15 | | MVMObject *obj; |
16 | | MVMint64 idx; |
17 | | } positional; |
18 | | struct { |
19 | | MVMObject *obj; |
20 | | MVMObject *indices; |
21 | | } multidim; |
22 | | } u; |
23 | | }; |
24 | | struct MVMNativeRef { |
25 | | MVMObject common; |
26 | | MVMNativeRefBody body; |
27 | | }; |
28 | | |
29 | | /* Kinds of native reference. */ |
30 | 28 | #define MVM_NATIVEREF_LEX 1 |
31 | 17 | #define MVM_NATIVEREF_ATTRIBUTE 2 |
32 | 9 | #define MVM_NATIVEREF_POSITIONAL 3 |
33 | 15 | #define MVM_NATIVEREF_MULTIDIM 4 |
34 | | |
35 | | /* REPR data for a native reference. */ |
36 | | struct MVMNativeRefREPRData { |
37 | | /* The primitive type of native reference this is (one of the values that |
38 | | * is valid for MVMStorageSpec.boxed_primitive). */ |
39 | | MVMuint16 primitive_type; |
40 | | |
41 | | /* The kind of reference this is. */ |
42 | | MVMuint16 ref_kind; |
43 | | }; |
44 | | |
45 | | /* Function for REPR setup. */ |
46 | | const MVMREPROps * MVMNativeRef_initialize(MVMThreadContext *tc); |
47 | | |
48 | | /* Operations on a nativeref REPR. */ |
49 | | void MVM_nativeref_ensure(MVMThreadContext *tc, MVMObject *val, MVMuint16 wantprim, MVMuint16 wantkind, char *guilty); |
50 | | MVMObject * MVM_nativeref_lex_i(MVMThreadContext *tc, MVMuint16 outers, MVMuint16 idx); |
51 | | MVMObject * MVM_nativeref_lex_n(MVMThreadContext *tc, MVMuint16 outers, MVMuint16 idx); |
52 | | MVMObject * MVM_nativeref_lex_s(MVMThreadContext *tc, MVMuint16 outers, MVMuint16 idx); |
53 | | MVMObject * MVM_nativeref_lex_name_i(MVMThreadContext *tc, MVMString *name); |
54 | | MVMObject * MVM_nativeref_lex_name_n(MVMThreadContext *tc, MVMString *name); |
55 | | MVMObject * MVM_nativeref_lex_name_s(MVMThreadContext *tc, MVMString *name); |
56 | | MVMObject * MVM_nativeref_attr_i(MVMThreadContext *tc, MVMObject *obj, MVMObject *class_handle, MVMString *name); |
57 | | MVMObject * MVM_nativeref_attr_n(MVMThreadContext *tc, MVMObject *obj, MVMObject *class_handle, MVMString *name); |
58 | | MVMObject * MVM_nativeref_attr_s(MVMThreadContext *tc, MVMObject *obj, MVMObject *class_handle, MVMString *name); |
59 | | MVMObject * MVM_nativeref_pos_i(MVMThreadContext *tc, MVMObject *obj, MVMint64 idx); |
60 | | MVMObject * MVM_nativeref_pos_n(MVMThreadContext *tc, MVMObject *obj, MVMint64 idx); |
61 | | MVMObject * MVM_nativeref_pos_s(MVMThreadContext *tc, MVMObject *obj, MVMint64 idx); |
62 | | MVMObject * MVM_nativeref_multidim_i(MVMThreadContext *tc, MVMObject *obj, MVMObject *indices); |
63 | | MVMObject * MVM_nativeref_multidim_n(MVMThreadContext *tc, MVMObject *obj, MVMObject *indices); |
64 | | MVMObject * MVM_nativeref_multidim_s(MVMThreadContext *tc, MVMObject *obj, MVMObject *indices); |
65 | | MVMint64 MVM_nativeref_read_lex_i(MVMThreadContext *tc, MVMObject *ref); |
66 | | MVMnum64 MVM_nativeref_read_lex_n(MVMThreadContext *tc, MVMObject *ref); |
67 | | MVMString * MVM_nativeref_read_lex_s(MVMThreadContext *tc, MVMObject *ref); |
68 | | MVMint64 MVM_nativeref_read_attribute_i(MVMThreadContext *tc, MVMObject *ref); |
69 | | MVMnum64 MVM_nativeref_read_attribute_n(MVMThreadContext *tc, MVMObject *ref); |
70 | | MVMString * MVM_nativeref_read_attribute_s(MVMThreadContext *tc, MVMObject *ref); |
71 | | MVMint64 MVM_nativeref_read_positional_i(MVMThreadContext *tc, MVMObject *ref); |
72 | | MVMnum64 MVM_nativeref_read_positional_n(MVMThreadContext *tc, MVMObject *ref); |
73 | | MVMString * MVM_nativeref_read_positional_s(MVMThreadContext *tc, MVMObject *ref); |
74 | | MVMint64 MVM_nativeref_read_multidim_i(MVMThreadContext *tc, MVMObject *ref); |
75 | | MVMnum64 MVM_nativeref_read_multidim_n(MVMThreadContext *tc, MVMObject *ref); |
76 | | MVMString * MVM_nativeref_read_multidim_s(MVMThreadContext *tc, MVMObject *ref); |
77 | | void MVM_nativeref_write_lex_i(MVMThreadContext *tc, MVMObject *ref, MVMint64 value); |
78 | | void MVM_nativeref_write_lex_n(MVMThreadContext *tc, MVMObject *ref, MVMnum64 value); |
79 | | void MVM_nativeref_write_lex_s(MVMThreadContext *tc, MVMObject *ref, MVMString *value); |
80 | | void MVM_nativeref_write_attribute_i(MVMThreadContext *tc, MVMObject *ref, MVMint64 value); |
81 | | void MVM_nativeref_write_attribute_n(MVMThreadContext *tc, MVMObject *ref, MVMnum64 value); |
82 | | void MVM_nativeref_write_attribute_s(MVMThreadContext *tc, MVMObject *ref, MVMString *value); |
83 | | void MVM_nativeref_write_positional_i(MVMThreadContext *tc, MVMObject *ref, MVMint64 value); |
84 | | void MVM_nativeref_write_positional_n(MVMThreadContext *tc, MVMObject *ref, MVMnum64 value); |
85 | | void MVM_nativeref_write_positional_s(MVMThreadContext *tc, MVMObject *ref, MVMString *value); |
86 | | void MVM_nativeref_write_multidim_i(MVMThreadContext *tc, MVMObject *ref, MVMint64 value); |
87 | | void MVM_nativeref_write_multidim_n(MVMThreadContext *tc, MVMObject *ref, MVMnum64 value); |
88 | | void MVM_nativeref_write_multidim_s(MVMThreadContext *tc, MVMObject *ref, MVMString *value); |
89 | | AO_t * MVM_nativeref_as_atomic_lex_i(MVMThreadContext *tc, MVMObject *ref_obj); |
90 | | AO_t * MVM_nativeref_as_atomic_attribute_i(MVMThreadContext *tc, MVMObject *ref_obj); |
91 | | AO_t * MVM_nativeref_as_atomic_positional_i(MVMThreadContext *tc, MVMObject *ref_obj); |
92 | | AO_t * MVM_nativeref_as_atomic_multidim_i(MVMThreadContext *tc, MVMObject *ref_obj); |