zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.dk
Subject: PATCH: Re: architecture independent wordcode files (.zwc)
Date: Tue, 15 May 2001 10:37:06 +0200 (MET DST)	[thread overview]
Message-ID: <200105150837.KAA09465@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: <15104.4136.595537.497564@paullew-ultra.cisco.com>

Paul Lew wrote:

> ...
> 
> I have lots of startup files for zsh, fortunately, the .zshenv is good
> enough to trigger the problem.  Attached below.

That helped.

Obviously I had only tried it with functions that were too small.

The zwc files contain the compiled versions for both endianesses, first
in the one for the machine the file was compiled on and after that the
one for the other endianess. When the shell has to use that other
version (with mapping), it has to calculate the offset into the zwc file
for the header (containing the directory of files/functions in the zwc
file including their positions relative to the header etc.). That worked
fine. But it also has to map the part of the part of the zwc it needs
and for that it has to adjust the offset to a page boundary. That worked
fine, too. But then it forgot to increment the length of the mapped
reagion by the difference between the real offset and the aligned one.
For large functions that happened to cross a page boundary that could
result in the string table of the function being not or only partially
mapped.

> ...
> 	dirs=(.)
> 	dirs=($dirs $artool/$bindir $artool/sh $artool/perl)
> 	dirs=($dirs /auto/insbu-cnstools/$bindir)		#cisco CNS
> 	dirs=($dirs /auto/insbu-cnstools/s$bindir)		#cisco CNS
>       ...

Ugh, that's pretty inefficient -- zsh has no problems with arrays
definitions spanning multiple lines.

Bye
  Sven

Index: Src/parse.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/parse.c,v
retrieving revision 1.19
diff -u -r1.19 parse.c
--- Src/parse.c	2001/03/07 12:58:41	1.19
+++ Src/parse.c	2001/05/15 08:25:50
@@ -2782,7 +2782,7 @@
 {
     FuncDump d;
     Wordcode addr;
-    int fd, off;
+    int fd, off, mlen;
 
     if (other) {
 	static size_t pgsz = 0;
@@ -2802,15 +2802,17 @@
 	    pgsz--;
 	}
 	off = len & ~pgsz;
-    } else
+        mlen = len + (len - off);
+    } else {
 	off = 0;
-
+        mlen = len;
+    }
     if ((fd = open(dump, O_RDONLY)) < 0)
 	return;
 
     fd = movefd(fd);
 
-    if ((addr = (Wordcode) mmap(NULL, len, PROT_READ, MAP_SHARED, fd, off)) ==
+    if ((addr = (Wordcode) mmap(NULL, mlen, PROT_READ, MAP_SHARED, fd, off)) ==
 	((Wordcode) -1)) {
 	close(fd);
 	return;

-- 
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


      reply	other threads:[~2001-05-15  8:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <15101.39024.899564.120545@paullew-ultra.cisco.com>
     [not found] ` <1010513004337.ZM7197@candle.brasslantern.com>
2001-05-13  5:00   ` Paul Lew
2001-05-13 17:10     ` Bart Schaefer
2001-05-13 17:48       ` Andrej Borsenkow
2001-05-14  7:15       ` Sven Wischnowsky
2001-05-14 17:04         ` Paul Lew
2001-05-15  8:37           ` Sven Wischnowsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200105150837.KAA09465@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).