@@ -38,6 +38,11 @@ static PMC *KnowHOWAttribute = NULL;
38
38
static PMC *nqpevent_fh = NULL;
39
39
static INTVAL nqpdebflags_i = 0;
40
40
41
+ /* Serialization context upside-down stack (element 0 is the latest, new entries
42
+ * unshifted). Tracks the SC (if any) that we are currently in; stack because we
43
+ * may have multiple on the go due to compiling nested module dependencies. */
44
+ PMC *compiling_scs = NULL;
45
+
41
46
END_OPS_PREAMBLE
42
47
43
48
/*
@@ -60,6 +65,10 @@ inline op nqp_dynop_setup() :base_core {
60
65
61
66
/* Initialize the object model. */
62
67
SixModelObject_initialize(interp, &KnowHOW, &KnowHOWAttribute);
68
+
69
+ /* Initialize compiling SCs list. */
70
+ compiling_scs = Parrot_pmc_new(interp, enum_class_ResizablePMCArray);
71
+ Parrot_pmc_gc_register(interp, compiling_scs);
63
72
}
64
73
}
65
74
@@ -1638,6 +1647,34 @@ inline op nqp_get_sc_for_object(out PMC, in PMC) :base_core {
1638
1647
}
1639
1648
1640
1649
1650
+ /*
1651
+
1652
+ =item nqp_push_compiling_sc()
1653
+
1654
+ Pushes an SC on to the stack of those currently being compiled.
1655
+
1656
+ =cut
1657
+
1658
+ */
1659
+ inline op nqp_push_compiling_sc(in PMC) :base_core {
1660
+ VTABLE_unshift_pmc(interp, compiling_scs, $1);
1661
+ }
1662
+
1663
+
1664
+ /*
1665
+
1666
+ =item nqp_pop_compiling_sc()
1667
+
1668
+ Pops an SC off the stack of those currently being compiled.
1669
+
1670
+ =cut
1671
+
1672
+ */
1673
+ inline op nqp_pop_compiling_sc() :base_core {
1674
+ VTABLE_shift_pmc(interp, compiling_scs);
1675
+ }
1676
+
1677
+
1641
1678
/*
1642
1679
1643
1680
=item nqp_get_package_through_who
0 commit comments