Author: leo
Date: Thu Mar 9 15:00:40 2006
New Revision: 11842
Modified:
trunk/compilers/imcc/pbc.c
trunk/src/packfile.c
Log:
PBC - code cleanup
* remove special enum_class_Sub cases and such from PackFile code
* prepare for creating Subs in the flavor of the compiling HLL
Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c (original)
+++ trunk/compilers/imcc/pbc.c Thu Mar 9 15:00:40 2006
@@ -671,7 +671,13 @@
type = (r->pcc_sub->calls_a_sub & ITPCCYIELD) ?
enum_class_Coroutine :
unit->outer ? enum_class_Closure : enum_class_Sub;
- /* TODO constant - see also src/packfile.c
+ /*
+ * use a possible type mapping for the Sub PMCs
+ * XXX need to place HLL_id into context during compile to
+ * make this actually working
+ */
+ type = Parrot_get_ctx_HLL_type(interpreter, type);
+ /* TODO create constant - see also src/packfile.c
*/
sub_pmc = pmc_new(interpreter, type);
PObj_get_FLAGS(sub_pmc) |= (r->pcc_sub->pragma & SUB_FLAG_PF_MASK);
Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c (original)
+++ trunk/src/packfile.c Thu Mar 9 15:00:40 2006
@@ -448,28 +448,22 @@
internal_exception(1,
"Illegal fixup offset (%d) in enum_fixup_sub");
sub_pmc = ct->constants[ci]->u.key;
- switch (sub_pmc->vtable->base_type) {
- case enum_class_Sub:
- case enum_class_Closure:
- case enum_class_Coroutine:
- PMC_sub(sub_pmc)->eval_pmc = eval_pmc;
- if ((PObj_get_FLAGS(sub_pmc) & SUB_FLAG_PF_MASK) &&
- sub_pragma(interpreter, action, sub_pmc)) {
- result = do_1_sub_pragma(interpreter,
- sub_pmc, action);
- /*
- * replace the Sub PMC with the result of the
- * computation
- */
- if (action == PBC_IMMEDIATE &&
- !PMC_IS_NULL(result)) {
- ft->fixups[i]->type = enum_fixup_none;
- ct->constants[ci]->u.key = result;
- }
- }
- break;
+ PMC_sub(sub_pmc)->eval_pmc = eval_pmc;
+ if ((PObj_get_FLAGS(sub_pmc) & SUB_FLAG_PF_MASK) &&
+ sub_pragma(interpreter, action, sub_pmc)) {
+ result = do_1_sub_pragma(interpreter,
+ sub_pmc, action);
+ /*
+ * replace the Sub PMC with the result of the
+ * computation
+ */
+ if (action == PBC_IMMEDIATE &&
+ !PMC_IS_NULL(result)) {
+ ft->fixups[i]->type = enum_fixup_none;
+ ct->constants[ci]->u.key = result;
+ }
}
- /* goon */
+ break;
case enum_fixup_label:
/* fill in current bytecode seg */
ft->fixups[i]->seg = self;