Skip to content

Commit f6d965a

Browse files
author
Reini Urban
committed
Replace unneeded QRPA with ResizablePMCArray
1 parent c528f06 commit f6d965a

File tree

7 files changed

+18
-2017
lines changed

7 files changed

+18
-2017
lines changed

src/vm/parrot/6model/serialization.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ static INTVAL perl6_lexpad_id = 0;
6161
static INTVAL ctmthunk_id = 0;
6262
static INTVAL ownedhash_id = 0;
6363
static INTVAL ownedrpa_id = 0;
64-
static INTVAL qrpa_id = 0;
6564

6665
/* Endian translation (file format is little endian, so on big endian we need
6766
* to twiddle. */
@@ -494,9 +493,6 @@ void write_ref_func(PARROT_INTERP, SerializationWriter *writer, PMC *ref) {
494493
else if (ref->vtable->base_type == ownedrpa_id) {
495494
discrim = REFVAR_VM_ARR_VAR;
496495
}
497-
else if (ref->vtable->base_type == qrpa_id) {
498-
discrim = REFVAR_VM_ARR_VAR;
499-
}
500496
else if (ref->vtable->base_type == enum_class_ResizableIntegerArray) {
501497
discrim = REFVAR_VM_ARR_INT;
502498
}
@@ -1041,7 +1037,6 @@ STRING * Serialization_serialize(PARROT_INTERP, PMC *sc, PMC *empty_string_heap)
10411037
ctmthunk_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "CTMThunk", 0));
10421038
ownedhash_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "OwnedHash", 0));
10431039
ownedrpa_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "OwnedResizablePMCArray", 0));
1044-
qrpa_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "QRPA", 0));
10451040

10461041
/* Initialize string heap so first entry is the NULL string. */
10471042
VTABLE_push_string(interp, empty_string_heap, STRINGNULL);

src/vm/parrot/6model/sixmodelobject.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ static INTVAL stable_id = 0;
1111
static INTVAL smo_id = 0;
1212
static INTVAL sc_id = 0;
1313
static INTVAL ownedrpa_id = 0;
14-
static INTVAL qrpa_id = 0;
1514
static INTVAL ownedhash_id = 0;
1615

1716
/* Cached strings. */
@@ -309,8 +308,6 @@ PMC * hllize(PARROT_INTERP, PMC *obj, INTVAL hll_id) {
309308
/* Otherwise, it's a Parrot type. */
310309
if (ownedrpa_id == 0)
311310
ownedrpa_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "OwnedResizablePMCArray", 0));
312-
if (qrpa_id == 0)
313-
qrpa_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "QRPA", 0));
314311
if (ownedhash_id == 0)
315312
ownedhash_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "OwnedHash", 0));
316313
if (obj->vtable->base_type == enum_class_String) {
@@ -368,9 +365,8 @@ PMC * hllize(PARROT_INTERP, PMC *obj, INTVAL hll_id) {
368365
return obj;
369366
}
370367
}
371-
else if (obj->vtable->base_type == enum_class_ResizablePMCArray
372-
|| obj->vtable->base_type == ownedrpa_id
373-
|| obj->vtable->base_type == qrpa_id) {
368+
else if (obj->vtable->base_type == enum_class_ResizablePMCArray /* XXX ResizableStringArray? */
369+
|| obj->vtable->base_type == ownedrpa_id) {
374370
if (VTABLE_exists_keyed_str(interp, config, Parrot_str_new_constant(interp, "foreign_transform_array"))) {
375371
PMC *result;
376372
PMC *code = VTABLE_get_pmc_keyed_str(interp, config, Parrot_str_new_constant(interp, "foreign_transform_array"));

src/vm/parrot/QAST/Operations.nqp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ QAST::Operations.add_core_op('list', :inlinable(1), -> $qastcomp, $op {
271271
# Create register for the resulting list and make an empty one.
272272
my $list_reg := $*REGALLOC.fresh_p();
273273
my $ops := PIRT::Ops.new(:result($list_reg));
274-
$ops.push_pirop('new', $list_reg, "'QRPA'");
274+
$ops.push_pirop('new', $list_reg, "'ResizablePMCArray'");
275275
if +$op.list > 1 {
276276
$ops.push_pirop('assign', $list_reg, +$op.list);
277277
$ops.push_pirop('assign', $list_reg, 0);

src/vm/parrot/ops/nqp.ops

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ static INTVAL initialized = 0;
3434
static INTVAL stable_id = 0;
3535
static INTVAL smo_id = 0;
3636
static INTVAL disp_id = 0;
37-
static INTVAL qrpa_id = 0;
3837
static INTVAL ohash_id = 0;
3938

4039
/* Built-in meta-objects. */
@@ -60,7 +59,7 @@ static PMC *empty_hash = NULL;
6059
/* SC write barrier for objects. */
6160
static void SC_write_barrier_obj(PARROT_INTERP, PMC *obj) {
6261
if (!sc_write_barrier_off_depth && VTABLE_get_bool(interp, compiling_scs)) {
63-
PMC *comp_sc = VTABLE_get_pmc_keyed_int(interp, compiling_scs, 0);
62+
const PMC *comp_sc = VTABLE_get_pmc_keyed_int(interp, compiling_scs, 0);
6463
if (SC_PMC(obj) != comp_sc) {
6564
SC_repossess_object(interp, comp_sc, SC_PMC(obj), obj);
6665
SC_PMC(obj) = comp_sc;
@@ -73,7 +72,7 @@ static void SC_write_barrier_obj(PARROT_INTERP, PMC *obj) {
7372
/* SC write barrier for STables. */
7473
static void SC_write_barrier_st(PARROT_INTERP, STable *st) {
7574
if (!sc_write_barrier_off_depth && VTABLE_get_bool(interp, compiling_scs)) {
76-
PMC *comp_sc = VTABLE_get_pmc_keyed_int(interp, compiling_scs, 0);
75+
const PMC *comp_sc = VTABLE_get_pmc_keyed_int(interp, compiling_scs, 0);
7776
if (st->sc != comp_sc) {
7877
SC_repossess_stable(interp, comp_sc, st->sc, st->stable_pmc);
7978
st->sc = comp_sc;
@@ -83,18 +82,18 @@ static void SC_write_barrier_st(PARROT_INTERP, STable *st) {
8382
}
8483
}
8584

86-
/* Test for something being a list (RPA or QRPA). */
85+
/* Test for something being a list (ResizablePMCArray or ResizableStringArray). */
8786
static INTVAL
8887
nqp_islist(PMC *pmc) {
89-
INTVAL type = pmc->vtable->base_type;
90-
return (INTVAL)(type == qrpa_id || type == enum_class_ResizablePMCArray
91-
|| type == enum_class_ResizableStringArray);
88+
const INTVAL type = pmc->vtable->base_type;
89+
return (INTVAL)(type == enum_class_ResizablePMCArray
90+
|| type == enum_class_ResizableStringArray);
9291
}
9392

9493
/* Test for something being a hash. */
9594
static INTVAL
9695
nqp_ishash(PMC *pmc) {
97-
INTVAL type = pmc->vtable->base_type;
96+
const INTVAL type = pmc->vtable->base_type;
9897
return (INTVAL)(type == enum_class_Hash || type == ohash_id);
9998
}
10099

@@ -136,14 +135,14 @@ revquicksort(INTVAL *arr, INTVAL elements) {
136135

137136
/* Does a run of the NFA. Produces a list of integers indicating the
138137
* chosen ordering. */
139-
static INTVAL * nqp_nfa_run(PARROT_INTERP, NFABody *nfa, STRING *target, INTVAL offset, INTVAL *total_fates_out) {
140-
INTVAL eos = Parrot_str_length(interp, target);
138+
static const INTVAL * nqp_nfa_run(PARROT_INTERP, NFABody *nfa, STRING *target, INTVAL offset, INTVAL *total_fates_out) {
139+
const INTVAL eos = Parrot_str_length(interp, target);
141140
INTVAL gen = 1;
142141
INTVAL numcur = 0;
143142
INTVAL numnext = 0;
144143
INTVAL *done, *fates, *curst, *nextst, *longlit;
145144
INTVAL i, fate_arr_len, num_states, total_fates, prev_fates, usedlonglit;
146-
INTVAL orig_offset = offset;
145+
const INTVAL orig_offset = offset;
147146

148147
/* Allocate "done states", "current states" and "next states" arrays. */
149148
num_states = nfa->num_states;
@@ -978,7 +977,6 @@ inline op nqp_dynop_setup() :base_core {
978977
/* Look up and cache some type IDs. */
979978
stable_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "STable", 0));
980979
smo_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "SixModelObject", 0));
981-
qrpa_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "QRPA", 0));
982980
ohash_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "OwnedHash", 0));
983981

984982
/* Initialize the object model. */
@@ -2878,7 +2876,7 @@ inline op repr_hint_for(out INT, invar PMC, in STR) :base_core {
28782876

28792877
=item nqp_islist
28802878

2881-
Checks if the type of thing in $2 is a nqp list (either QRPA or RPA).
2879+
Checks if the type of thing in $2 is a nqp list (either ResizablePMCArray or ResizableStringArray).
28822880

28832881
=cut
28842882

@@ -3278,7 +3276,7 @@ inline op nqp_push_label(invar PMC, in LABEL) :base_core {
32783276
inline op nqp_nfa_run_proto(out PMC, invar PMC, in STR, in INT) :base_core {
32793277
/* Run the NFA. */
32803278
INTVAL total_fates, i;
3281-
INTVAL *fates = nqp_nfa_run(interp, OBJECT_BODY($2), $3, $4, &total_fates);
3279+
const INTVAL *fates = nqp_nfa_run(interp, (NFABody *)OBJECT_BODY($2), $3, $4, &total_fates);
32823280

32833281
/* Copy results into an RIA. */
32843282
PMC *fatepmc = Parrot_pmc_new(interp, enum_class_ResizableIntegerArray);
@@ -3299,7 +3297,7 @@ inline op nqp_nfa_run_alt(invar PMC, in STR, in INT, invar PMC, invar PMC, invar
32993297

33003298
/* Run the NFA. */
33013299
INTVAL total_fates, i;
3302-
INTVAL *fates = nqp_nfa_run(interp, OBJECT_BODY(nfa), target, offset, &total_fates);
3300+
const INTVAL *fates = nqp_nfa_run(interp, (NFABody *)OBJECT_BODY(nfa), target, offset, &total_fates);
33033301

33043302
/* Push the results onto the bstack. */
33053303
INTVAL caps = VTABLE_defined(interp, cstack) ? VTABLE_elements(interp, cstack) : 0;

0 commit comments

Comments
 (0)