Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion One more thing...

Newsgroups: perl.perl6.internals
Path: controlnews3.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 30348 invoked from network); 12 May 2004 06:58:42 -0000
Received: from x1.develooper.com (63.251.223.170)
  by onion.develooper.com with SMTP; 12 May 2004 06:58:42 -0000
Received: (qmail 8012 invoked by uid 225); 12 May 2004 06:58:41 -0000
Delivered-To: perl6-intern...@perl.org
Received: (qmail 7990 invoked by alias); 12 May 2004 06:58:41 -0000
X-Spam-Status: No, hits=0.0 required=7.0
	tests=
X-Spam-Check-By: la.mx.develooper.com
Received: from mail.nextra.at (HELO mail.nextra.at) (195.170.70.48)
  by la.mx.develooper.com (qpsmtpd/0.27.1) with ESMTP; Tue, 11 May 2004 23:58:40 -0700
Received: from lux.leo.home (at24a01-dial-145.nextranet.at [195.170.73.145])
	by mail.nextra.at (8.13.0.Alpha0/8.13.0.Alpha0) with ESMTP id i4C6wUMS027878;
	Wed, 12 May 2004 08:58:34 +0200 (MEST)
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 49A05118023; Wed, 12 May 2004 08:47:14 +0200 (MEST)
Received: (from lt@localhost)
	by thu8.leo.home (8.10.2/8.10.2/SuSE Linux 8.10.0-0.3) id i4C6ae306361;
	Wed, 12 May 2004 08:36:40 +0200
Message-ID: <200405120636.i4C6ae306361@thu8.leo.home>
To: pdcaw...@bofh.org.uk (Piers Cawley)
Subject: Re: One more thing...
In-Reply-To: <m23c66dx22.fsf@obelisk.bofh.org.uk>
References: <a06100514bcb59e5f2c78@[10.0.1.3]> <200404300935.i3U9Zqg07670@thu8.leo.home> <a06100502bcb7f7775cfc@[10.0.1.3]> <200405051002.i45A2Kb13601@thu8.leo.home> <m2y8o4wfew.fsf@obelisk.bofh.org.uk> <200405071337.i47Dbpj30143@thu8.leo.home> <m2lljz2b2x.fsf@obelisk.bofh.org.uk> <40A135E4.1080308@toetsch.at> <m23c66dx22.fsf@obelisk.bofh.org.uk>
Reply-To: l...@toetsch.at
Cc: perl6-intern...@perl.org
Date: Wed, 12 May 2004 08:36:40 +0200
X-Virus-Scanned: clamd / ClamAV version 0.70, clamav-milter version 0.70j
X-Spam-Rating: onion.develooper.com 1.6.2 0/1000/N
Approved: n...@nntp.perl.org
From: l...@toetsch.at (Leopold Toetsch)

Piers Cawley <pdcaw...@bofh.org.uk> wrote:
> Leopold Toetsch <l...@toetsch.at> writes:

[ calculating registers to save ]

>> ... once per sub per location where the sub is called from. But there
>> isn't any knowledge that a sub might be called. So the cost is actually
>> more per PMC instruction that might eventually run a PASM MMD. This is,
>> when its done right, or ...

> No. Once per compilation unit.

An example:

 .sub foo

   # a lot of string handling code
   # and some PMCs
   $P0 = concat $P0, $S0            # <<< 1) calculate: save P, S here
   # now a lot of float code
   # no strings used any more
   # and no branch back to 1)
   $N1 = 47.11                      # $N1's live starts here
   $P0 = $P1 + $N1                  # <<< 2) calculate: save P, N regs
   $P2 = $P0 + $N1                  # <<< 3) calculate: save P regs
   # no N reg used here
 .end

At 1) the caller is not interested in preserving N-registers, these
aren't used there. Saving everything, the caller needs saving, ends up
with C<saveall> in non trivial subroutines.

Using your proposal would need a lot of storage for the saved
register ranges.

If the calculation is done based on the called subroutine, it's not
unlikely that only a few registers have to be preserved, e.g. no
N-registers for the overloaded C<concat> and no string registers for the
overloaded C<add>.

This doesn't violate the principle of caller saves: all that needs
preserving from the caller's POV is preserved.

leo