This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PR3256: Exceptions vs. delay slots



>> I am thinking that we need to change our delay-slot scheduler to not
>> pull instructions from beyond calls that might throw exceptions (i.e,
>> calls that are not marked `nothrow' when -fexceptions is turned on).
>> Obviously, you could pull instructions if they only affect things that
>> will go out of scope before the `catch', etc., etc., but first things
>> first.
>
> Cannot this be limited to sets to REG_USERVAR_P() registers?

I don't know.  But, we should adopt the mentality that unless you
can prove it's safe based on GCC's documented interfaces, then you
can't do it.  How do we know, for example, that it isn't contain
a register that contains a partial result of some computation?  For
example:

  int i = 1;

  try {
    g ();
    i = 3;
  } catch (...) {
  }

  return 2 * i;

Perhaps we cleverly change this into:

  int <temp> = 2;

  try {
    g ();
    <temp> = 6;
  } catch (...) {
  }

  return <temp>;

Now, temp is not a user variable, but the problem persists.  If
we don't do this today, we might do it tomorrow, and then the problem
would show up.

Essentially, you are depending on some property of REG_USERVAR_P that
you think exists, but that isn't documented anywhere.  I will code
defensively and let someone else convince themselves that a) any
pessimization is actually worth fixing, and b) there is a safe way to
do better.

-- 
Mark Mitchell                mark@codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]