diff --git a/src/pmc/packfilebytecodesegment.pmc b/src/pmc/packfilebytecodesegment.pmc index 498c66684c..f75565a248 100644 --- a/src/pmc/packfilebytecodesegment.pmc +++ b/src/pmc/packfilebytecodesegment.pmc @@ -29,8 +29,9 @@ spec. #include "pmc/pmc_packfileopmap.h" pmclass PackfileBytecodeSegment auto_attrs extends PackfileSegment { - ATTR PMC *ops; /* RIA of executable opcodes */ - ATTR PMC *op_map; /* OpMap PMC */ + ATTR PMC *ops; /* RIA of executable opcodes */ + ATTR PMC *op_map; /* OpMap PMC */ + ATTR INTVAL main_sub; /* Index of :main sub */ @@ -98,6 +99,7 @@ Return a pointer to a PackFile_ByteCode* built from this PMC's data. bc->base.type = PF_BYTEC_SEG; /* Create proper ByteCode structure from internal PMCs */ + GET_ATTR_main_sub(INTERP, SELF, bc->main_sub); /* Copy ops into ByteCode */ GET_ATTR_ops(INTERP, SELF, ops); @@ -261,6 +263,41 @@ Fetch an integer's worth of data from the segment. /* +=item C + +=item C + +=item C + +Get the number of elements in the array. + +=cut + +*/ + VTABLE INTVAL elements() { + return VTABLE_elements(INTERP, + PARROT_PACKFILEBYTECODESEGMENT(SELF)->ops); + } + + VTABLE INTVAL get_integer() { + return STATICSELF.elements(); + } + + VTABLE FLOATVAL get_number() { + return STATICSELF.elements(); + } + + + METHOD main_sub(INTVAL main_sub :optional, INTVAL got_main :opt_flag) { + if (got_main) { + SET_ATTR_main_sub(INTERP, SELF, main_sub); + } + GET_ATTR_main_sub(INTERP, SELF, main_sub); + RETURN(INTVAL main_sub); + } + +/* + =back =cut