Possible fix for issue #938.

The functions for all arrayops are compiler-generated but the functions
which are also defined in druntime are never emitted. This prevents
inlining of the function body and causes issue #938.

The fix is to emit the arrayops if inlining is enabled and otherwise
use the druntime provided implementations.

An alternative approach could be to always emit the arrayops and
never use the druntime version.
This commit is contained in:
Kai Nacke 2015-05-23 22:12:10 +02:00
parent f104af4462
commit f1c4cf92ff
2 changed files with 4 additions and 3 deletions

View file

@ -733,7 +733,7 @@ static llvm::GlobalValue::LinkageTypes lowerFuncLinkage(FuncDeclaration* fdecl)
// Generated array op functions behave like templates in that they might be
// emitted into many different modules.
if (fdecl->isArrayOp && !isDruntimeArrayOp(fdecl))
if (fdecl->isArrayOp && (willInline() || !isDruntimeArrayOp(fdecl)))
return templateLinkage;
// A body-less declaration always needs to be marked as external in LLVM
@ -782,7 +782,7 @@ void DtoDefineFunction(FuncDeclaration* fd)
}
// Skip array ops implemented in druntime
if (fd->isArrayOp && isDruntimeArrayOp(fd))
if (fd->isArrayOp && !willInline() && isDruntimeArrayOp(fd))
{
IF_LOG Logger::println("No code generation for array op %s implemented in druntime", fd->toChars());
fd->ir.setDefined();