Fix a bug in the X86 ABI. The size of a struct is different from the size of a

pointer to that struct...
This commit is contained in:
Frits van Bommel
2009-03-06 21:15:13 +01:00
parent 1c6c4bc361
commit 5af82ee8d3
4 changed files with 46 additions and 7 deletions

View File

@@ -373,6 +373,16 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
else
{
Logger::println("doing normal arguments");
if (Logger::enabled()) {
Logger::println("Arguments so far: (%d)", (int)args.size());
Logger::indent();
for (size_t i = 0; i < args.size(); i++) {
Logger::cout() << *args[i] << '\n';
}
Logger::undent();
Logger::cout() << "Function type: " << tf->toChars() << '\n';
Logger::cout() << "LLVM functype: " << *callable->getType() << '\n';
}
size_t n = Argument::dim(tf->parameters);
@@ -386,9 +396,19 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
assert(fnarg);
DValue* argval = DtoArgument(fnarg, (Expression*)arguments->data[i]);
if (Logger::enabled()) {
Logger::cout() << "Argument before ABI: " << *argval->getRVal() << '\n';
Logger::cout() << "Argument type before ABI: " << *DtoType(argval->getType()) << '\n';
}
// give the ABI a say
LLValue* arg = tf->fty->putParam(argval->getType(), i, argval);
if (Logger::enabled()) {
Logger::cout() << "Argument after ABI: " << *arg << '\n';
Logger::cout() << "Argument type after ABI: " << *arg->getType() << '\n';
}
int j = tf->fty->reverseParams ? beg + n - i - 1 : beg + i;
// Hack around LDC assuming structs are in memory: