Closed Bug 62996 Opened 21 years ago Closed 21 years ago

Linux speculative RTTI heuristics break in gcc-2.95.2


(Core :: XPCOM, defect, P3)






(Reporter: waterson, Assigned: waterson)



(2 files)

Urgh. Although the vtable layout is the same, the code generated for the RTTI 
stub has changed between egcs-1.1.2 and gcc-2.95.2. I spent half an hour trying 
to figure out how to update the heuristics, but the function prologue is now...

  push %ebp
  mov  %esp,%ebp
  sub  <some constant>,$esp

I've seen values of $0x8 and $0x14 as the constant; there may be others. (I'm 
not sure why it'd change...multiple inheritance?)

Anyway, filtering on this prologue is too weak: we end up calling a *lot* of 
routines, wreaking havoc along the way, and eventually aborting when we trollop 
through some static NSPR callback.

Need to fix this when we upgrade...
We'll need to fix this some day.
Target Milestone: --- → Future
I'm using gcc 2.96, and the typeinfo code that's checked in works.
While I was waiting for the build to complete, though, I implemented 
a different approach that also works and will probably work with 2.95 
too; I'll attach a patch.

Ack!! I'm really spazzing tonight.  Ignore that patch; I hacked
the wrong file.  Putting those changes in the right place causes
mozilla to crash.
I found a heuristic that works for gcc 2.96 on all the cases
that I thought it should.  As you probably know, that heuristic
only works for classes whose base class has no data members, because
the heuristic assumes the vtable is at the beginning of the object
and the compiler puts it at the end of the base class part of
the object.

I also modified infer_type() in to be able to match
stacks which are prefixes of other stacks in types.dat.  I thought
this was a good change because we can classify things as specifically
as we want while still falling back to less specific substacks.

I also updated types.dat.  As you say this is sweaty work!! :-)

waterson: if these changes look good will you check them in for
me please?  Still no CVS commit access.

[s]r=waterson, looks great. Shaver, sr= this patch, and sr= bug 87698, too.
Oops. Forgot to cc shaver. blizzard, maybe you could r= this, too.
I still need r= before I can check in my fix.  shaver?  blizzard?
The changes to nsTypeInfo.cpp and are very small, and
none of this stuff goes into the real buld.

I checked in nsTypeInfo.cpp.  After I get permission to check in
changes under tools, I'll check in the rest of the patch and close this
Checked in tools/trace-malloc changes.
Closed: 21 years ago
Resolution: --- → FIXED
Is this bug fixed?
You need to log in before you can comment on or make changes to this bug.