Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Traceback or call chain

View parsed - Show only message text

Newsgroups: perl.perl6.internals
Path: g2news1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.perl.org
Return-Path: <l...@toetsch.at>
Mailing-List: contact perl6-internals-h...@perl.org; run by ezmlm
Delivered-To: mailing list perl6-intern...@perl.org
Received: (qmail 27831 invoked from network); 2 Nov 2004 13:22:34 -0000
Received: from x1.develooper.com (63.251.223.170)
  by lists.develooper.com with SMTP; 2 Nov 2004 13:22:34 -0000
Received: (qmail 10370 invoked by uid 225); 2 Nov 2004 13:22:34 -0000
Delivered-To: perl6-intern...@perl.org
Received: (qmail 10361 invoked by alias); 2 Nov 2004 13:22:33 -0000
X-Spam-Status: No, hits=-4.9 required=8.0
	tests=BAYES_00
X-Spam-Check-By: la.mx.develooper.com
Received: from mail.nextra.at (HELO mail.nextra.at) (195.170.70.100)
  by la.mx.develooper.com (qpsmtpd/0.27.1) with ESMTP; Tue, 02 Nov 2004 05:22:31 -0800
Received: from lux.leo.home (at24a01-dial-180.nextranet.at [195.170.73.180])
	by mail.nextra.at (8.13.1/8.13.1) with ESMTP id iA2DMOSD000073
	for <perl6-intern...@perl.org>; Tue, 2 Nov 2004 14:22:26 +0100 (MET)
Received: from thu8.leo.home (thu8.leo.home [192.168.1.5])
	by lux.leo.home (Postfix on linux 2.0.36 (i386)) with ESMTP id 8A83F118023
	for <perl6-intern...@perl.org>; Tue,  2 Nov 2004 14:20:18 +0100 (MET)
Received: (from lt@localhost)
	by thu8.leo.home (8.10.2/8.10.2/SuSE Linux 8.10.0-0.3) id iA2DK9w03766;
	Tue, 2 Nov 2004 14:20:09 +0100
Message-ID: <200411021320.iA2DK9w03766@thu8.leo.home>
To: perl6-intern...@perl.org
Subject: Re: Traceback or call chain
In-Reply-To: <200411021016.iA2AGaX10959@thu8.leo.home>
References: <41821133.2020507@toetsch.at> <a0620060dbdac50bb7b91@[10.0.1.3]> <200411021016.iA2AGaX10959@thu8.leo.home>
Reply-To: l...@toetsch.at
Date: Tue, 2 Nov 2004 14:20:09 +0100
Approved: n...@nntp.perl.org
From: l...@toetsch.at (Leopold Toetsch)

Leopold Toetsch <l...@toetsch.at> wrote:
> Dan Sugalski <d...@sidhe.org> wrote:

>> Basically we want to be able to walk a continuation chain and get
>> access to everything.

> I think having methods is ok for that. It's in no way time critical to
> warrant opcodes.

I've now created two methods "caller" and "continuation" in the
Continuation PMC that allows walking the continuation chain. It's
slightly different then the previous example as Sub PMCs don't have a
context. To get at the previous caller, we have to get the continuation
of the continuation.

$ ./parrot call.imc
main foo
Bar bar
caller: foo
Bar foo
called from Sub 'bar' pc 146
called from Sub 'foo' pc 75
called from Sub 'main' pc 21
Bar foo
called from Sub 'main' pc 44
ok

$ cat call.imc
.sub main @MAIN
.include "interpinfo.pasm"
    foo()
    $P0 = find_global "Bar", "foo"
    $P0()
    print "ok\n"
.end
.sub foo
    print "main foo\n"
    $P0 = find_global "Bar", "bar"
    $P0()
.end
.namespace ["Bar"]
.sub bar
    print "Bar bar\n"
    $P1 = interpinfo .INTERPINFO_CURRENT_CONT
    $P0 = $P1."caller"()
    print "caller: "
    print $P0
    print "\n"
    foo()
.end
.sub foo
    print "Bar foo\n"
    $P1 = interpinfo .INTERPINFO_CURRENT_CONT
tb_loop:
    unless $P1 goto tb_end
    print $P1
    $P1 = $P1."continuation"()
    goto tb_loop
tb_end:
.end

leo

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google