зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1259850 - Handle D4 destructors, r=terrence
MozReview-Commit-ID: 1hArAcAxvZV --HG-- extra : rebase_source : d9d65df85ac312bab022847843d4b75b25ecd55e
This commit is contained in:
Родитель
c6f370b8e1
Коммит
3cb5c6a3e8
|
@ -372,7 +372,7 @@ function process(functionName, functionBodies)
|
|||
// Bug 1056410: Oh joy. GCC does something even funkier internally,
|
||||
// where it generates calls to ~Foo() but a body for ~Foo(int32) even
|
||||
// though it uses the same mangled name for both. So we need to add a
|
||||
// synthetic edge from the former to the latter.
|
||||
// synthetic edge from ~Foo() -> ~Foo(int32).
|
||||
//
|
||||
// inChargeXTor will have the (int32).
|
||||
if (functionName.indexOf("::~") > 0) {
|
||||
|
@ -390,7 +390,7 @@ function process(functionName, functionBodies)
|
|||
// D1 # complete object destructor
|
||||
// D2 # base object destructor
|
||||
//
|
||||
// In actual practice, I have observed a C4 constructor generated by gcc
|
||||
// In actual practice, I have observed C4 and D4 xtors generated by gcc
|
||||
// 4.9.3 (but not 4.7.3). The gcc source code says:
|
||||
//
|
||||
// /* This is the old-style "[unified]" constructor.
|
||||
|
@ -398,23 +398,29 @@ function process(functionName, functionBodies)
|
|||
// it from the clones in order to share code and save space. */
|
||||
//
|
||||
// Unfortunately, that "call... from the clones" does not seem to appear in
|
||||
// the CFG we get from GCC. So if we see a C4 constructor, inject an edge
|
||||
// to it from C1, C2, and C3. (Note that C3 isn't even used in current GCC,
|
||||
// but add the edge anyway just in case.)
|
||||
if (functionName.indexOf("C4E") != -1) {
|
||||
// the CFG we get from GCC. So if we see a C4 constructor or D4 destructor,
|
||||
// inject an edge to it from C1, C2, and C3 (or D1, D2, and D3). (Note that
|
||||
// C3 isn't even used in current GCC, but add the edge anyway just in
|
||||
// case.)
|
||||
if (functionName.indexOf("C4E") != -1 || functionName.indexOf("D4Ev") != -1) {
|
||||
var [ mangled, unmangled ] = splitFunction(functionName);
|
||||
// E terminates the method name (and precedes the method parameters).
|
||||
if (mangled.indexOf("C4E") != -1) {
|
||||
// If "C4E" shows up in the mangled name for another reason, this
|
||||
// will create bogus edges in the callgraph. But that shouldn't
|
||||
// matter too much, and is somewhat difficult to avoid, so we will
|
||||
// live with it.
|
||||
var C1 = mangled.replace("C4E", "C1E");
|
||||
var C2 = mangled.replace("C4E", "C2E");
|
||||
var C3 = mangled.replace("C4E", "C3E");
|
||||
print("D " + memo(C1) + " " + memo(mangled));
|
||||
print("D " + memo(C2) + " " + memo(mangled));
|
||||
print("D " + memo(C3) + " " + memo(mangled));
|
||||
// If eg "C4E" shows up in the mangled name for another reason, this
|
||||
// will create bogus edges in the callgraph. But will affect little and
|
||||
// is somewhat difficult to avoid, so we will live with it.
|
||||
for (let [synthetic, variant] of [['C4E', 'C1E'],
|
||||
['C4E', 'C2E'],
|
||||
['C4E', 'C3E'],
|
||||
['D4Ev', 'D1Ev'],
|
||||
['D4Ev', 'D2Ev'],
|
||||
['D4Ev', 'D3Ev']])
|
||||
{
|
||||
if (mangled.indexOf(synthetic) == -1)
|
||||
continue;
|
||||
|
||||
let variant_mangled = mangled.replace(synthetic, variant);
|
||||
let variant_full = variant_mangled + "$" + unmangled;
|
||||
print("D " + memo(variant_full) + " " + memo(functionName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче