Skip to content

Commit 29cecf5

Browse files
committed
Simplify NQPLexInfo by removing unused bits.
1 parent 54c8c67 commit 29cecf5

File tree

1 file changed

+3
-64
lines changed

1 file changed

+3
-64
lines changed

src/vm/parrot/pmc/nqplexinfo.pmc

Lines changed: 3 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,11 @@ pmclass NQPLexInfo
1818
* value. */
1919
ATTR PMC *name_to_register_map;
2020

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-
3021
/* 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. */
3223
ATTR PMC *static_slots_cache;
3324

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. */
3626
ATTR PMC *static_values_cache;
3727

3828
/* Matching PMC array of the pre-init flags. */
@@ -56,14 +46,10 @@ pmclass NQPLexInfo
5646
}
5747

5848
VTABLE void mark() {
59-
PMC *name_to_register_map, *static_values, *static_flags;
49+
PMC *name_to_register_map;
6050
PMC *static_slots_cache, *static_values_cache, *static_flags_cache;
6151
GET_ATTR_name_to_register_map(INTERP, SELF, name_to_register_map);
6252
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);
6753
GET_ATTR_static_slots_cache(INTERP, SELF, static_slots_cache);
6854
Parrot_gc_mark_PMC_alive(INTERP, static_slots_cache);
6955
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.
132118
VTABLE_set_integer_keyed_str(INTERP, name_to_register_map, name, preg);
133119
}
134120

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-
182121
METHOD setup_static_lexpad(PMC *names, PMC *values, PMC *flags) {
183122
/* Need to turn name list into slot list. */
184123
PMC *slots = Parrot_pmc_new(interp, enum_class_ResizableIntegerArray);

0 commit comments

Comments
 (0)