mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-26 16:43:13 +01:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user