зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1249448 - Handled unified (C4) constructors, r=terrence
--HG-- extra : rebase_source : 0cb4b233c588db1fb1c69bb71c28b18d37b7bff3
This commit is contained in:
Родитель
ab3550c2df
Коммит
8624ceb0db
|
@ -303,6 +303,43 @@ for (var nameIndex = minStream; nameIndex <= maxStream; nameIndex++) {
|
|||
}
|
||||
}
|
||||
|
||||
// Further note: from http://mentorembedded.github.io/cxx-abi/abi.html the
|
||||
// different kinds of constructors/destructors are:
|
||||
// C1 # complete object constructor
|
||||
// C2 # base object constructor
|
||||
// C3 # complete object allocating constructor
|
||||
// D0 # deleting destructor
|
||||
// D1 # complete object destructor
|
||||
// D2 # base object destructor
|
||||
//
|
||||
// In actual practice, I have observed a C4 constructor generated by gcc
|
||||
// 4.9.3 (but not 4.7.3). The gcc source code says:
|
||||
//
|
||||
// /* This is the old-style "[unified]" constructor.
|
||||
// In some cases, we may emit this function and call
|
||||
// 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) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
xdb.free_string(name);
|
||||
xdb.free_string(data);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче