/src/ruby/internal/struct.h
Line | Count | Source |
1 | | #ifndef INTERNAL_STRUCT_H /*-*-C-*-vi:se ft=c:*/ |
2 | | #define INTERNAL_STRUCT_H |
3 | | /** |
4 | | * @author Ruby developers <ruby-core@ruby-lang.org> |
5 | | * @copyright This file is a part of the programming language Ruby. |
6 | | * Permission is hereby granted, to either redistribute and/or |
7 | | * modify this file, provided that the conditions mentioned in the |
8 | | * file COPYING are met. Consult the file for details. |
9 | | * @brief Internal header for Struct. |
10 | | */ |
11 | | #include "ruby/internal/stdbool.h" /* for bool */ |
12 | | #include "ruby/ruby.h" /* for struct RBasic */ |
13 | | |
14 | | /* Flags of RStruct |
15 | | * |
16 | | * 1-7: RSTRUCT_EMBED_LEN |
17 | | * If non-zero, the struct is embedded (its contents follow the |
18 | | * header, rather than being on a separately allocated buffer) and |
19 | | * these bits are the length of the Struct. |
20 | | * 8: RSTRUCT_GEN_FIELDS |
21 | | * The struct is embedded and has no space left to store the |
22 | | * IMEMO/fields reference. Any ivar this struct may have will be in |
23 | | * the generic_fields_tbl. This flag doesn't imply the struct has |
24 | | * ivars. |
25 | | */ |
26 | | enum { |
27 | | RSTRUCT_EMBED_LEN_MASK = RUBY_FL_USER7 | RUBY_FL_USER6 | RUBY_FL_USER5 | RUBY_FL_USER4 | |
28 | | RUBY_FL_USER3 | RUBY_FL_USER2 | RUBY_FL_USER1, |
29 | | RSTRUCT_EMBED_LEN_SHIFT = (RUBY_FL_USHIFT+1), |
30 | | RSTRUCT_GEN_FIELDS = RUBY_FL_USER8, |
31 | | }; |
32 | | |
33 | | struct RStruct { |
34 | | struct RBasic basic; |
35 | | union { |
36 | | struct { |
37 | | long len; |
38 | | const VALUE *ptr; |
39 | | VALUE fields_obj; |
40 | | } heap; |
41 | | /* This is a length 1 array because: |
42 | | * 1. GCC has a bug that does not optimize C flexible array members |
43 | | * (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102452) |
44 | | * 2. Zero length arrays are not supported by all compilers |
45 | | */ |
46 | | const VALUE ary[1]; |
47 | | } as; |
48 | | }; |
49 | | |
50 | 0 | #define RSTRUCT(obj) ((struct RStruct *)(obj)) |
51 | | |
52 | | /* struct.c */ |
53 | | VALUE rb_struct_init_copy(VALUE copy, VALUE s); |
54 | | VALUE rb_struct_lookup(VALUE s, VALUE idx); |
55 | | VALUE rb_struct_s_keyword_init(VALUE klass); |
56 | | static inline long RSTRUCT_EMBED_LEN(VALUE st); |
57 | | static inline long RSTRUCT_LEN_RAW(VALUE st); |
58 | | static inline int RSTRUCT_LENINT(VALUE st); |
59 | | static inline const VALUE *RSTRUCT_CONST_PTR(VALUE st); |
60 | | static inline void RSTRUCT_SET_RAW(VALUE st, long k, VALUE v); |
61 | | static inline VALUE RSTRUCT_GET_RAW(VALUE st, long k); |
62 | | |
63 | | static inline long |
64 | | RSTRUCT_EMBED_LEN(VALUE st) |
65 | 0 | { |
66 | 0 | long ret = FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK); |
67 | 0 | ret >>= RSTRUCT_EMBED_LEN_SHIFT; |
68 | 0 | return ret; |
69 | 0 | } Unexecuted instantiation: array.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: bignum.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: class.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: complex.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: enumerator.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: error.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: eval.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: gc.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: hash.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: imemo.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: io.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: iseq.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: load.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: marshal.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: memory_view.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: node.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: node_dump.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: numeric.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: object.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: pack.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: proc.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: process.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: ractor.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: random.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: range.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: re.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: ruby.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: set.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: shape.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: string.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: struct.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: thread.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: time.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: variable.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: vm.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: vm_backtrace.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: vm_dump.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: vm_trace.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: builtin.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: ast.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: box.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: compile.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: cont.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: debug.c:RSTRUCT_EMBED_LEN Unexecuted instantiation: parse.c:RSTRUCT_EMBED_LEN |
70 | | |
71 | | static inline long |
72 | | RSTRUCT_LEN_RAW(VALUE st) |
73 | 0 | { |
74 | 0 | if (FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK)) { |
75 | 0 | return RSTRUCT_EMBED_LEN(st); |
76 | 0 | } |
77 | 0 | else { |
78 | 0 | return RSTRUCT(st)->as.heap.len; |
79 | 0 | } |
80 | 0 | } Unexecuted instantiation: array.c:RSTRUCT_LEN_RAW Unexecuted instantiation: bignum.c:RSTRUCT_LEN_RAW Unexecuted instantiation: class.c:RSTRUCT_LEN_RAW Unexecuted instantiation: complex.c:RSTRUCT_LEN_RAW Unexecuted instantiation: enumerator.c:RSTRUCT_LEN_RAW Unexecuted instantiation: error.c:RSTRUCT_LEN_RAW Unexecuted instantiation: eval.c:RSTRUCT_LEN_RAW Unexecuted instantiation: gc.c:RSTRUCT_LEN_RAW Unexecuted instantiation: hash.c:RSTRUCT_LEN_RAW Unexecuted instantiation: imemo.c:RSTRUCT_LEN_RAW Unexecuted instantiation: io.c:RSTRUCT_LEN_RAW Unexecuted instantiation: iseq.c:RSTRUCT_LEN_RAW Unexecuted instantiation: load.c:RSTRUCT_LEN_RAW Unexecuted instantiation: marshal.c:RSTRUCT_LEN_RAW Unexecuted instantiation: memory_view.c:RSTRUCT_LEN_RAW Unexecuted instantiation: node.c:RSTRUCT_LEN_RAW Unexecuted instantiation: node_dump.c:RSTRUCT_LEN_RAW Unexecuted instantiation: numeric.c:RSTRUCT_LEN_RAW Unexecuted instantiation: object.c:RSTRUCT_LEN_RAW Unexecuted instantiation: pack.c:RSTRUCT_LEN_RAW Unexecuted instantiation: proc.c:RSTRUCT_LEN_RAW Unexecuted instantiation: process.c:RSTRUCT_LEN_RAW Unexecuted instantiation: ractor.c:RSTRUCT_LEN_RAW Unexecuted instantiation: random.c:RSTRUCT_LEN_RAW Unexecuted instantiation: range.c:RSTRUCT_LEN_RAW Unexecuted instantiation: re.c:RSTRUCT_LEN_RAW Unexecuted instantiation: ruby.c:RSTRUCT_LEN_RAW Unexecuted instantiation: set.c:RSTRUCT_LEN_RAW Unexecuted instantiation: shape.c:RSTRUCT_LEN_RAW Unexecuted instantiation: string.c:RSTRUCT_LEN_RAW Unexecuted instantiation: struct.c:RSTRUCT_LEN_RAW Unexecuted instantiation: thread.c:RSTRUCT_LEN_RAW Unexecuted instantiation: time.c:RSTRUCT_LEN_RAW Unexecuted instantiation: variable.c:RSTRUCT_LEN_RAW Unexecuted instantiation: vm.c:RSTRUCT_LEN_RAW Unexecuted instantiation: vm_backtrace.c:RSTRUCT_LEN_RAW Unexecuted instantiation: vm_dump.c:RSTRUCT_LEN_RAW Unexecuted instantiation: vm_trace.c:RSTRUCT_LEN_RAW Unexecuted instantiation: builtin.c:RSTRUCT_LEN_RAW Unexecuted instantiation: ast.c:RSTRUCT_LEN_RAW Unexecuted instantiation: box.c:RSTRUCT_LEN_RAW Unexecuted instantiation: compile.c:RSTRUCT_LEN_RAW Unexecuted instantiation: cont.c:RSTRUCT_LEN_RAW Unexecuted instantiation: debug.c:RSTRUCT_LEN_RAW Unexecuted instantiation: parse.c:RSTRUCT_LEN_RAW |
81 | | |
82 | | static inline int |
83 | | RSTRUCT_LENINT(VALUE st) |
84 | 0 | { |
85 | 0 | return rb_long2int(RSTRUCT_LEN_RAW(st)); |
86 | 0 | } Unexecuted instantiation: array.c:RSTRUCT_LENINT Unexecuted instantiation: bignum.c:RSTRUCT_LENINT Unexecuted instantiation: class.c:RSTRUCT_LENINT Unexecuted instantiation: complex.c:RSTRUCT_LENINT Unexecuted instantiation: enumerator.c:RSTRUCT_LENINT Unexecuted instantiation: error.c:RSTRUCT_LENINT Unexecuted instantiation: eval.c:RSTRUCT_LENINT Unexecuted instantiation: gc.c:RSTRUCT_LENINT Unexecuted instantiation: hash.c:RSTRUCT_LENINT Unexecuted instantiation: imemo.c:RSTRUCT_LENINT Unexecuted instantiation: io.c:RSTRUCT_LENINT Unexecuted instantiation: iseq.c:RSTRUCT_LENINT Unexecuted instantiation: load.c:RSTRUCT_LENINT Unexecuted instantiation: marshal.c:RSTRUCT_LENINT Unexecuted instantiation: memory_view.c:RSTRUCT_LENINT Unexecuted instantiation: node.c:RSTRUCT_LENINT Unexecuted instantiation: node_dump.c:RSTRUCT_LENINT Unexecuted instantiation: numeric.c:RSTRUCT_LENINT Unexecuted instantiation: object.c:RSTRUCT_LENINT Unexecuted instantiation: pack.c:RSTRUCT_LENINT Unexecuted instantiation: proc.c:RSTRUCT_LENINT Unexecuted instantiation: process.c:RSTRUCT_LENINT Unexecuted instantiation: ractor.c:RSTRUCT_LENINT Unexecuted instantiation: random.c:RSTRUCT_LENINT Unexecuted instantiation: range.c:RSTRUCT_LENINT Unexecuted instantiation: re.c:RSTRUCT_LENINT Unexecuted instantiation: ruby.c:RSTRUCT_LENINT Unexecuted instantiation: set.c:RSTRUCT_LENINT Unexecuted instantiation: shape.c:RSTRUCT_LENINT Unexecuted instantiation: string.c:RSTRUCT_LENINT Unexecuted instantiation: struct.c:RSTRUCT_LENINT Unexecuted instantiation: thread.c:RSTRUCT_LENINT Unexecuted instantiation: time.c:RSTRUCT_LENINT Unexecuted instantiation: variable.c:RSTRUCT_LENINT Unexecuted instantiation: vm.c:RSTRUCT_LENINT Unexecuted instantiation: vm_backtrace.c:RSTRUCT_LENINT Unexecuted instantiation: vm_dump.c:RSTRUCT_LENINT Unexecuted instantiation: vm_trace.c:RSTRUCT_LENINT Unexecuted instantiation: builtin.c:RSTRUCT_LENINT Unexecuted instantiation: ast.c:RSTRUCT_LENINT Unexecuted instantiation: box.c:RSTRUCT_LENINT Unexecuted instantiation: compile.c:RSTRUCT_LENINT Unexecuted instantiation: cont.c:RSTRUCT_LENINT Unexecuted instantiation: debug.c:RSTRUCT_LENINT Unexecuted instantiation: parse.c:RSTRUCT_LENINT |
87 | | |
88 | | static inline const VALUE * |
89 | | RSTRUCT_CONST_PTR(VALUE st) |
90 | 0 | { |
91 | 0 | const struct RStruct *p = RSTRUCT(st); |
92 | |
|
93 | 0 | if (FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK)) { |
94 | 0 | return p->as.ary; |
95 | 0 | } |
96 | 0 | else { |
97 | 0 | return p->as.heap.ptr; |
98 | 0 | } |
99 | 0 | } Unexecuted instantiation: array.c:RSTRUCT_CONST_PTR Unexecuted instantiation: bignum.c:RSTRUCT_CONST_PTR Unexecuted instantiation: class.c:RSTRUCT_CONST_PTR Unexecuted instantiation: complex.c:RSTRUCT_CONST_PTR Unexecuted instantiation: enumerator.c:RSTRUCT_CONST_PTR Unexecuted instantiation: error.c:RSTRUCT_CONST_PTR Unexecuted instantiation: eval.c:RSTRUCT_CONST_PTR Unexecuted instantiation: gc.c:RSTRUCT_CONST_PTR Unexecuted instantiation: hash.c:RSTRUCT_CONST_PTR Unexecuted instantiation: imemo.c:RSTRUCT_CONST_PTR Unexecuted instantiation: io.c:RSTRUCT_CONST_PTR Unexecuted instantiation: iseq.c:RSTRUCT_CONST_PTR Unexecuted instantiation: load.c:RSTRUCT_CONST_PTR Unexecuted instantiation: marshal.c:RSTRUCT_CONST_PTR Unexecuted instantiation: memory_view.c:RSTRUCT_CONST_PTR Unexecuted instantiation: node.c:RSTRUCT_CONST_PTR Unexecuted instantiation: node_dump.c:RSTRUCT_CONST_PTR Unexecuted instantiation: numeric.c:RSTRUCT_CONST_PTR Unexecuted instantiation: object.c:RSTRUCT_CONST_PTR Unexecuted instantiation: pack.c:RSTRUCT_CONST_PTR Unexecuted instantiation: proc.c:RSTRUCT_CONST_PTR Unexecuted instantiation: process.c:RSTRUCT_CONST_PTR Unexecuted instantiation: ractor.c:RSTRUCT_CONST_PTR Unexecuted instantiation: random.c:RSTRUCT_CONST_PTR Unexecuted instantiation: range.c:RSTRUCT_CONST_PTR Unexecuted instantiation: re.c:RSTRUCT_CONST_PTR Unexecuted instantiation: ruby.c:RSTRUCT_CONST_PTR Unexecuted instantiation: set.c:RSTRUCT_CONST_PTR Unexecuted instantiation: shape.c:RSTRUCT_CONST_PTR Unexecuted instantiation: string.c:RSTRUCT_CONST_PTR Unexecuted instantiation: struct.c:RSTRUCT_CONST_PTR Unexecuted instantiation: thread.c:RSTRUCT_CONST_PTR Unexecuted instantiation: time.c:RSTRUCT_CONST_PTR Unexecuted instantiation: variable.c:RSTRUCT_CONST_PTR Unexecuted instantiation: vm.c:RSTRUCT_CONST_PTR Unexecuted instantiation: vm_backtrace.c:RSTRUCT_CONST_PTR Unexecuted instantiation: vm_dump.c:RSTRUCT_CONST_PTR Unexecuted instantiation: vm_trace.c:RSTRUCT_CONST_PTR Unexecuted instantiation: builtin.c:RSTRUCT_CONST_PTR Unexecuted instantiation: ast.c:RSTRUCT_CONST_PTR Unexecuted instantiation: box.c:RSTRUCT_CONST_PTR Unexecuted instantiation: compile.c:RSTRUCT_CONST_PTR Unexecuted instantiation: cont.c:RSTRUCT_CONST_PTR Unexecuted instantiation: debug.c:RSTRUCT_CONST_PTR Unexecuted instantiation: parse.c:RSTRUCT_CONST_PTR |
100 | | |
101 | | static inline void |
102 | | RSTRUCT_SET_RAW(VALUE st, long k, VALUE v) |
103 | 0 | { |
104 | 0 | RB_OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[k], v); |
105 | 0 | } Unexecuted instantiation: array.c:RSTRUCT_SET_RAW Unexecuted instantiation: bignum.c:RSTRUCT_SET_RAW Unexecuted instantiation: class.c:RSTRUCT_SET_RAW Unexecuted instantiation: complex.c:RSTRUCT_SET_RAW Unexecuted instantiation: enumerator.c:RSTRUCT_SET_RAW Unexecuted instantiation: error.c:RSTRUCT_SET_RAW Unexecuted instantiation: eval.c:RSTRUCT_SET_RAW Unexecuted instantiation: gc.c:RSTRUCT_SET_RAW Unexecuted instantiation: hash.c:RSTRUCT_SET_RAW Unexecuted instantiation: imemo.c:RSTRUCT_SET_RAW Unexecuted instantiation: io.c:RSTRUCT_SET_RAW Unexecuted instantiation: iseq.c:RSTRUCT_SET_RAW Unexecuted instantiation: load.c:RSTRUCT_SET_RAW Unexecuted instantiation: marshal.c:RSTRUCT_SET_RAW Unexecuted instantiation: memory_view.c:RSTRUCT_SET_RAW Unexecuted instantiation: node.c:RSTRUCT_SET_RAW Unexecuted instantiation: node_dump.c:RSTRUCT_SET_RAW Unexecuted instantiation: numeric.c:RSTRUCT_SET_RAW Unexecuted instantiation: object.c:RSTRUCT_SET_RAW Unexecuted instantiation: pack.c:RSTRUCT_SET_RAW Unexecuted instantiation: proc.c:RSTRUCT_SET_RAW Unexecuted instantiation: process.c:RSTRUCT_SET_RAW Unexecuted instantiation: ractor.c:RSTRUCT_SET_RAW Unexecuted instantiation: random.c:RSTRUCT_SET_RAW Unexecuted instantiation: range.c:RSTRUCT_SET_RAW Unexecuted instantiation: re.c:RSTRUCT_SET_RAW Unexecuted instantiation: ruby.c:RSTRUCT_SET_RAW Unexecuted instantiation: set.c:RSTRUCT_SET_RAW Unexecuted instantiation: shape.c:RSTRUCT_SET_RAW Unexecuted instantiation: string.c:RSTRUCT_SET_RAW Unexecuted instantiation: struct.c:RSTRUCT_SET_RAW Unexecuted instantiation: thread.c:RSTRUCT_SET_RAW Unexecuted instantiation: time.c:RSTRUCT_SET_RAW Unexecuted instantiation: variable.c:RSTRUCT_SET_RAW Unexecuted instantiation: vm.c:RSTRUCT_SET_RAW Unexecuted instantiation: vm_backtrace.c:RSTRUCT_SET_RAW Unexecuted instantiation: vm_dump.c:RSTRUCT_SET_RAW Unexecuted instantiation: vm_trace.c:RSTRUCT_SET_RAW Unexecuted instantiation: builtin.c:RSTRUCT_SET_RAW Unexecuted instantiation: ast.c:RSTRUCT_SET_RAW Unexecuted instantiation: box.c:RSTRUCT_SET_RAW Unexecuted instantiation: compile.c:RSTRUCT_SET_RAW Unexecuted instantiation: cont.c:RSTRUCT_SET_RAW Unexecuted instantiation: debug.c:RSTRUCT_SET_RAW Unexecuted instantiation: parse.c:RSTRUCT_SET_RAW |
106 | | |
107 | | static inline VALUE |
108 | | RSTRUCT_GET_RAW(VALUE st, long k) |
109 | 0 | { |
110 | 0 | return RSTRUCT_CONST_PTR(st)[k]; |
111 | 0 | } Unexecuted instantiation: array.c:RSTRUCT_GET_RAW Unexecuted instantiation: bignum.c:RSTRUCT_GET_RAW Unexecuted instantiation: class.c:RSTRUCT_GET_RAW Unexecuted instantiation: complex.c:RSTRUCT_GET_RAW Unexecuted instantiation: enumerator.c:RSTRUCT_GET_RAW Unexecuted instantiation: error.c:RSTRUCT_GET_RAW Unexecuted instantiation: eval.c:RSTRUCT_GET_RAW Unexecuted instantiation: gc.c:RSTRUCT_GET_RAW Unexecuted instantiation: hash.c:RSTRUCT_GET_RAW Unexecuted instantiation: imemo.c:RSTRUCT_GET_RAW Unexecuted instantiation: io.c:RSTRUCT_GET_RAW Unexecuted instantiation: iseq.c:RSTRUCT_GET_RAW Unexecuted instantiation: load.c:RSTRUCT_GET_RAW Unexecuted instantiation: marshal.c:RSTRUCT_GET_RAW Unexecuted instantiation: memory_view.c:RSTRUCT_GET_RAW Unexecuted instantiation: node.c:RSTRUCT_GET_RAW Unexecuted instantiation: node_dump.c:RSTRUCT_GET_RAW Unexecuted instantiation: numeric.c:RSTRUCT_GET_RAW Unexecuted instantiation: object.c:RSTRUCT_GET_RAW Unexecuted instantiation: pack.c:RSTRUCT_GET_RAW Unexecuted instantiation: proc.c:RSTRUCT_GET_RAW Unexecuted instantiation: process.c:RSTRUCT_GET_RAW Unexecuted instantiation: ractor.c:RSTRUCT_GET_RAW Unexecuted instantiation: random.c:RSTRUCT_GET_RAW Unexecuted instantiation: range.c:RSTRUCT_GET_RAW Unexecuted instantiation: re.c:RSTRUCT_GET_RAW Unexecuted instantiation: ruby.c:RSTRUCT_GET_RAW Unexecuted instantiation: set.c:RSTRUCT_GET_RAW Unexecuted instantiation: shape.c:RSTRUCT_GET_RAW Unexecuted instantiation: string.c:RSTRUCT_GET_RAW Unexecuted instantiation: struct.c:RSTRUCT_GET_RAW Unexecuted instantiation: thread.c:RSTRUCT_GET_RAW Unexecuted instantiation: time.c:RSTRUCT_GET_RAW Unexecuted instantiation: variable.c:RSTRUCT_GET_RAW Unexecuted instantiation: vm.c:RSTRUCT_GET_RAW Unexecuted instantiation: vm_backtrace.c:RSTRUCT_GET_RAW Unexecuted instantiation: vm_dump.c:RSTRUCT_GET_RAW Unexecuted instantiation: vm_trace.c:RSTRUCT_GET_RAW Unexecuted instantiation: builtin.c:RSTRUCT_GET_RAW Unexecuted instantiation: ast.c:RSTRUCT_GET_RAW Unexecuted instantiation: box.c:RSTRUCT_GET_RAW Unexecuted instantiation: compile.c:RSTRUCT_GET_RAW Unexecuted instantiation: cont.c:RSTRUCT_GET_RAW Unexecuted instantiation: debug.c:RSTRUCT_GET_RAW Unexecuted instantiation: parse.c:RSTRUCT_GET_RAW |
112 | | |
113 | | static inline VALUE |
114 | | RSTRUCT_FIELDS_OBJ(VALUE st) |
115 | 0 | { |
116 | 0 | const long embed_len = RSTRUCT_EMBED_LEN(st); |
117 | 0 | VALUE fields_obj; |
118 | 0 | if (embed_len) { |
119 | 0 | RUBY_ASSERT(!FL_TEST_RAW(st, RSTRUCT_GEN_FIELDS)); |
120 | 0 | fields_obj = RSTRUCT_GET_RAW(st, embed_len); |
121 | 0 | } |
122 | 0 | else { |
123 | 0 | fields_obj = RSTRUCT(st)->as.heap.fields_obj; |
124 | 0 | } |
125 | 0 | return fields_obj; |
126 | 0 | } Unexecuted instantiation: array.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: bignum.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: class.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: complex.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: enumerator.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: error.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: eval.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: gc.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: hash.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: imemo.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: io.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: iseq.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: load.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: marshal.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: memory_view.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: node.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: node_dump.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: numeric.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: object.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: pack.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: proc.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: process.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: ractor.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: random.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: range.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: re.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: ruby.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: set.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: shape.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: string.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: struct.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: thread.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: time.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: variable.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: vm.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: vm_backtrace.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: vm_dump.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: vm_trace.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: builtin.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: ast.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: box.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: compile.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: cont.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: debug.c:RSTRUCT_FIELDS_OBJ Unexecuted instantiation: parse.c:RSTRUCT_FIELDS_OBJ |
127 | | |
128 | | static inline void |
129 | | RSTRUCT_SET_FIELDS_OBJ(VALUE st, VALUE fields_obj) |
130 | 0 | { |
131 | 0 | const long embed_len = RSTRUCT_EMBED_LEN(st); |
132 | 0 | if (embed_len) { |
133 | 0 | RUBY_ASSERT(!FL_TEST_RAW(st, RSTRUCT_GEN_FIELDS)); |
134 | 0 | RSTRUCT_SET_RAW(st, embed_len, fields_obj); |
135 | 0 | } |
136 | 0 | else { |
137 | 0 | RB_OBJ_WRITE(st, &RSTRUCT(st)->as.heap.fields_obj, fields_obj); |
138 | 0 | } |
139 | 0 | } Unexecuted instantiation: array.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: bignum.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: class.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: complex.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: enumerator.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: error.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: eval.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: gc.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: hash.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: imemo.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: io.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: iseq.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: load.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: marshal.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: memory_view.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: node.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: node_dump.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: numeric.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: object.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: pack.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: proc.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: process.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: ractor.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: random.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: range.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: re.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: ruby.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: set.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: shape.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: string.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: struct.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: thread.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: time.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: variable.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: vm.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: vm_backtrace.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: vm_dump.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: vm_trace.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: builtin.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: ast.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: box.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: compile.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: cont.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: debug.c:RSTRUCT_SET_FIELDS_OBJ Unexecuted instantiation: parse.c:RSTRUCT_SET_FIELDS_OBJ |
140 | | #endif /* INTERNAL_STRUCT_H */ |