cvsuser 04/11/18 03:14:25
Modified: ops core.ops ops.num
runtime/parrot/library/Stream Sub.imc Writer.imc
src thread.c
Log:
add returncc opcode
* returncc replaces return P1 or similar
* adapt bits of streams code
Revision Changes Path
1.375 +16 -4 parrot/ops/core.ops
Index: core.ops
===================================================================
RCS file: /cvs/public/parrot/ops/core.ops,v
retrieving revision 1.374
retrieving revision 1.375
diff -u -r1.374 -r1.375
--- core.ops 12 Nov 2004 10:45:48 -0000 1.374
+++ core.ops 18 Nov 2004 11:14:20 -0000 1.375
@@ -89,9 +89,9 @@
Don't use.
(Must be op #6, CORE_OPS_prederef__ ).
-=item B<reserved>(in INT)
+=item B<reserved>(inconst INT)
-Reserve 2 more fixed entries.
+Reserve 1 more fix entry.
=item B<load_bytecode>(in STR)
@@ -136,8 +136,8 @@
goto OFFSET(0);
}
-inline op reserved(in INT) {
- goto NEXT(); /* reserve 2 entries */
+inline op reserved(inconst INT) {
+ goto NEXT(); /* reserve 1 entries */
}
inline op load_bytecode(in STR) :load_file {
@@ -408,6 +408,10 @@
when any context stuff was changed between creating the return continuation
and invoke'ing it.
+=item B<returncc>()
+
+Return from the sub or method via the current continuatio.
+
=cut
inline op invoke() {
@@ -465,6 +469,14 @@
goto NEXT();
}
+inline op returncc() {
+ opcode_t *dest;
+ PMC * p = interpreter->ctx.current_cont;
+
+ dest = (opcode_t *)p->vtable->invoke(interpreter, p, expr NEXT());
+ goto ADDRESS(dest);
+}
+
########################################
=item B<set_addr>(out INT, labelconst INT)
1.44 +2 -2 parrot/ops/ops.num
Index: ops.num
===================================================================
RCS file: /cvs/public/parrot/ops/ops.num,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- ops.num 12 Nov 2004 10:45:48 -0000 1.43
+++ ops.num 18 Nov 2004 11:14:20 -0000 1.44
@@ -30,8 +30,8 @@
check_events__ 4
wrapper__ 5
prederef__ 6
-reserved_i 7
-reserved_ic 8
+reserved_ic 7
+returncc 8
# other ops
load_bytecode_s 9
load_bytecode_sc 10
1.6 +2 -1 parrot/runtime/parrot/library/Stream/Sub.imc
Index: Sub.imc
===================================================================
RCS file: /cvs/public/parrot/runtime/parrot/library/Stream/Sub.imc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Sub.imc 5 Nov 2004 16:26:28 -0000 1.5
+++ Sub.imc 18 Nov 2004 11:14:22 -0000 1.6
@@ -120,7 +120,8 @@
typeof $I0, temp
if $I0 == .PerlUndef goto END
classoffset $I0, self, "Stream::Sub"
- $P0 = clone P1
+ .include "interpinfo.pasm"
+ $P0 = interpinfo .INTERPINFO_CURRENT_CONT
setattribute self, $I0, $P0
str = temp( self )
1.5 +6 -4 parrot/runtime/parrot/library/Stream/Writer.imc
Index: Writer.imc
===================================================================
RCS file: /cvs/public/parrot/runtime/parrot/library/Stream/Writer.imc,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Writer.imc 2 Nov 2004 17:52:18 -0000 1.4
+++ Writer.imc 18 Nov 2004 11:14:22 -0000 1.5
@@ -54,12 +54,12 @@
.sub _reader_stub method
.local pmc source
- getprop source, "CALL", P0
+ getprop source, "CALL", P0 # XXX
source()
# close the source
source = find_global "Stream::Base", "close"
- P2 = self
+ P2 = self # XXX
source()
# mark it as closed
@@ -133,7 +133,8 @@
.local pmc status
classoffset $I0, self, "Stream::Writer"
- $P0 = clone P1
+ .include "interpinfo.pasm"
+ $P0 = interpinfo .INTERPINFO_CURRENT_CONT
setattribute self, $I0, $P0
inc $I0
getattribute status, self, $I0
@@ -146,7 +147,8 @@
WRITE:
classoffset $I0, self, "Stream::Writer"
- $P0 = clone P1
+ .include "interpinfo.pasm"
+ $P0 = interpinfo .INTERPINFO_CURRENT_CONT
setattribute self, $I0, $P0
source = self."source"()
1.30 +3 -2 parrot/src/thread.c
Index: thread.c
===================================================================
RCS file: /cvs/public/parrot/src/thread.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- thread.c 15 Nov 2004 16:23:51 -0000 1.29
+++ thread.c 18 Nov 2004 11:14:25 -0000 1.30
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: thread.c,v 1.29 2004/11/15 16:23:51 leo Exp $
+$Id: thread.c,v 1.30 2004/11/18 11:14:25 leo Exp $
=head1 NAME
@@ -118,7 +118,8 @@
* are working - create it in the new interpreters mem space
*/
ret_c = pmc_new(d, enum_class_RetContinuation);
- INTERP_REG_PMC(d, 1) = ret_c;
+ INTERP_REG_PMC(d, 1) = /* XXX remove when done pdd03 */
+ d->ctx.current_cont = ret_c;
}
/*