public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Graydon Hoare <graydon@redhat.com>
To: binutils@sources.redhat.com
Cc: cgen@sources.redhat.com
Subject: closing and re-opening CPUs in opcodes
Date: Wed, 01 May 2002 15:12:00 -0000	[thread overview]
Message-ID: <20020501181249.C1999@tomago.toronto.redhat.com> (raw)

Hi,

When doing multi-CPU simulation in sid, on cgen-generated CPU
cores, with --trace-disassemble, opcodes is called once per insn
to do the disassembly. If two calls come with different CPU
description handles, opcodes will *notice* this fact, via a
static handle it keeps in function scope telling it how it was
last called, and close/re-open the handle it's being called with.

This has a couple penalties associated with it. First, it reveals
a number of hidden memory leaks between CPU description open and
close (and I've not found all of them yet). Second, it is
actually quite expensive in terms of simulator cycles, since we
re-initialize a bunch of tables, rebuild assembly regexes, etc.
every time we re-open a CPU description. 

When you run with large-ish blocks between CPU yields, this is
not too bad. When you run the CPUs in lock-step, to give a good
"simulated concurrency", it is intolerably slow (and quickly eats
all available memory). Is there any particular reason why, in
opcodes' "handle oriented" interface, we're closing and
re-opening? Shouldn't the handles isolate all the resources
they're responsible for? 

I'll keep digging, but any additional insight would be
appreciated.

-graydon

             reply	other threads:[~2002-05-01 22:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-01 15:12 Graydon Hoare [this message]
2002-05-01 15:17 Graydon Hoare

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=20020501181249.C1999@tomago.toronto.redhat.com \
    --to=graydon@redhat.com \
    --cc=binutils@sources.redhat.com \
    --cc=cgen@sources.redhat.com \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).