@@ -18,21 +18,11 @@ pmclass NQPLexInfo
18
18
* value. */
19
19
ATTR PMC *name_to_register_map;
20
20
21
- /* Hash mapping names to static values. This is the authoritative
22
- * source of these, but we always build a more quickly usable
23
- * cache in the next two attributes. */
24
- ATTR PMC *static_values;
25
-
26
- /* Hash mapping names to static values flags (0 = static value,
27
- * 1 = container cloned per instantiation, 2 = state container). */
28
- ATTR PMC *static_flags;
29
-
30
21
/* Integer array of slots that we always want to pre-initialize
31
- * with static values; built from the static_values hash . */
22
+ * with static values. */
32
23
ATTR PMC *static_slots_cache;
33
24
34
- /* Matching PMC array of the values to pre-init with; built from
35
- * the static_values hash. */
25
+ /* Matching PMC array of the values to pre-init with. */
36
26
ATTR PMC *static_values_cache;
37
27
38
28
/* Matching PMC array of the pre-init flags. */
@@ -56,14 +46,10 @@ pmclass NQPLexInfo
56
46
}
57
47
58
48
VTABLE void mark() {
59
- PMC *name_to_register_map, *static_values, *static_flags ;
49
+ PMC *name_to_register_map;
60
50
PMC *static_slots_cache, *static_values_cache, *static_flags_cache;
61
51
GET_ATTR_name_to_register_map(INTERP, SELF, name_to_register_map);
62
52
Parrot_gc_mark_PMC_alive(INTERP, name_to_register_map);
63
- GET_ATTR_static_values(INTERP, SELF, static_values);
64
- Parrot_gc_mark_PMC_alive(INTERP, static_values);
65
- GET_ATTR_static_flags(INTERP, SELF, static_flags);
66
- Parrot_gc_mark_PMC_alive(INTERP, static_flags);
67
53
GET_ATTR_static_slots_cache(INTERP, SELF, static_slots_cache);
68
54
Parrot_gc_mark_PMC_alive(INTERP, static_slots_cache);
69
55
GET_ATTR_static_values_cache(INTERP, SELF, static_values_cache);
@@ -132,53 +118,6 @@ compiler calls this method in response to a ".lex STRING, PREG" directive.
132
118
VTABLE_set_integer_keyed_str(INTERP, name_to_register_map, name, preg);
133
119
}
134
120
135
- METHOD set_static_lexpad_value(STRING *key, PMC *value) {
136
- /* Stash static value in hash. */
137
- PMC *svs, *sfs;
138
- GET_ATTR_static_values(INTERP, SELF, svs);
139
- GET_ATTR_static_flags(INTERP, SELF, sfs);
140
- if (PMC_IS_NULL(svs)) {
141
- svs = Parrot_pmc_new(interp, enum_class_Hash);
142
- SET_ATTR_static_values(INTERP, SELF, svs);
143
- sfs = Parrot_pmc_new(interp, enum_class_Hash);
144
- SET_ATTR_static_flags(INTERP, SELF, sfs);
145
- }
146
- VTABLE_set_pmc_keyed_str(interp, svs, key, value);
147
- VTABLE_set_integer_keyed_str(interp, sfs, key, 0);
148
- }
149
-
150
- METHOD finish_static_lexpad() {
151
- /* Build caches from the static lexpad. */
152
- PMC *svs, *sfs;
153
- GET_ATTR_static_values(INTERP, SELF, svs);
154
- GET_ATTR_static_flags(INTERP, SELF, sfs);
155
- if (PMC_IS_NULL(svs) || !VTABLE_elements(interp, svs)) {
156
- /* No values; clear caches. */
157
- SET_ATTR_static_slots_cache(INTERP, SELF, PMCNULL);
158
- SET_ATTR_static_values_cache(INTERP, SELF, PMCNULL);
159
- SET_ATTR_static_flags_cache(INTERP, SELF, PMCNULL);
160
- }
161
- else {
162
- /* Build caches. */
163
- PMC *slots = Parrot_pmc_new(interp, enum_class_ResizableIntegerArray);
164
- PMC *values = Parrot_pmc_new(interp, enum_class_ResizablePMCArray);
165
- PMC *flags = Parrot_pmc_new(interp, enum_class_ResizableIntegerArray);
166
- PMC *iter = VTABLE_get_iter(interp, svs);
167
- while (VTABLE_get_bool(interp, iter)) {
168
- STRING *name = VTABLE_shift_string(interp, iter);
169
- INTVAL slot = VTABLE_get_integer_keyed_str(interp, SELF, name);
170
- PMC *value = VTABLE_get_pmc_keyed_str(interp, svs, name);
171
- INTVAL flag = VTABLE_get_integer_keyed_str(interp, sfs, name);
172
- VTABLE_push_integer(interp, slots, slot >> 2);
173
- VTABLE_push_pmc(interp, values, value);
174
- VTABLE_push_integer(interp, flags, flag);
175
- }
176
- SET_ATTR_static_slots_cache(INTERP, SELF, slots);
177
- SET_ATTR_static_values_cache(INTERP, SELF, values);
178
- SET_ATTR_static_flags_cache(INTERP, SELF, flags);
179
- }
180
- }
181
-
182
121
METHOD setup_static_lexpad(PMC *names, PMC *values, PMC *flags) {
183
122
/* Need to turn name list into slot list. */
184
123
PMC *slots = Parrot_pmc_new(interp, enum_class_ResizableIntegerArray);
0 commit comments