cvsuser 04/02/04 04:12:25
Modified: imcc parser_util.c
src packfile.c
t/pmc eval.t
Log:
fixup sub entries in compiled code
Revision Changes Path
1.55 +1 -0 parrot/imcc/parser_util.c
Index: parser_util.c
===================================================================
RCS file: /cvs/public/parrot/imcc/parser_util.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -w -r1.54 -r1.55
--- parser_util.c 17 Jan 2004 17:54:15 -0000 1.54
+++ parser_util.c 4 Feb 2004 12:10:56 -0000 1.55
@@ -454,6 +454,7 @@
DO_OP(pc, interp);
}
#endif
+ PackFile_fixup_subs(interp);
/* restore old byte_code, */
(void)Parrot_switch_to_cs(interp, pf_save->cur_cs);
sourcefile = source;
1.132 +4 -2 parrot/src/packfile.c
Index: packfile.c
===================================================================
RCS file: /cvs/public/parrot/src/packfile.c,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -w -r1.131 -r1.132
--- packfile.c 25 Jan 2004 19:33:27 -0000 1.131
+++ packfile.c 4 Feb 2004 12:11:48 -0000 1.132
@@ -2,7 +2,7 @@
Copyright (C) 2001-2002 Gregor N. Purdy. All rights reserved.
This program is free software. It is subject to the same license as
Parrot itself.
-$Id: packfile.c,v 1.131 2004/01/25 19:33:27 mikescott Exp $
+$Id: packfile.c,v 1.132 2004/02/04 12:11:48 leo Exp $
=head1 NAME
@@ -222,6 +222,8 @@
case enum_class_Closure:
case enum_class_Continuation:
case enum_class_Coroutine:
+ if (PObj_get_FLAGS(sub_pmc) & PObj_private1_FLAG)
+ continue;
rel = (INTVAL) sub_pmc->cache.struct_val *
sizeof(opcode_t);
rel += (INTVAL) self->cur_cs->base.data;
1.3 +40 -1 parrot/t/pmc/eval.t
Index: eval.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/eval.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- eval.t 16 Aug 2003 12:41:28 -0000 1.2
+++ eval.t 4 Feb 2004 12:12:25 -0000 1.3
@@ -1,6 +1,6 @@
#! perl -w
-use Parrot::Test tests => 3;
+use Parrot::Test tests => 5;
use Test::More;
# PASM1 is like PASM but appends an C<end> opcode
@@ -42,3 +42,42 @@
CODE
hello parrot
OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "call subs in evaled code ");
+ set S5, ".pcc_sub _foo:\n"
+ concat S5, "print \"foo\\n\"\n"
+ concat S5, "invoke P1\n"
+ compreg P1, "PASM"
+ compile P0, P1, S5
+ find_global P0, "_foo"
+ invokecc
+ print "back\n"
+ end
+CODE
+foo
+back
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "call 2 subs in evaled code ");
+ set S5, ".pcc_sub _foo:\n"
+ concat S5, "print \"foo\\n\"\n"
+ concat S5, "invoke P1\n"
+ concat S5, ".pcc_sub _bar:\n"
+ concat S5, "print \"bar\\n\"\n"
+ concat S5, "invoke P1\n"
+ compreg P1, "PASM"
+ compile P0, P1, S5
+ find_global P0, "_foo"
+ invokecc
+ print "back\n"
+ find_global P0, "_bar"
+ invokecc
+ print "fin\n"
+ end
+CODE
+foo
+back
+bar
+fin
+OUTPUT
+