Skip to content

Commit b617f4f

Browse files
[mono][jit] Zero extend the return when we might be invoking llvm generated code (#74991)
Co-authored-by: Vlad Brezae <brezaevlad@gmail.com>
1 parent b8fed32 commit b617f4f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/mono/mono/mini/method-to-ir.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2232,7 +2232,16 @@ static MonoInst*
22322232
mono_emit_widen_call_res (MonoCompile *cfg, MonoInst *ins, MonoMethodSignature *fsig)
22332233
{
22342234
if (!MONO_TYPE_IS_VOID (fsig->ret)) {
2235-
if ((fsig->pinvoke || LLVM_ENABLED) && !m_type_is_byref (fsig->ret)) {
2235+
// FIXME
2236+
// LLVM code doesn't uses zero extend the full word while jit expects it.
2237+
// A proper fix would be to detect if we are actually using llvm code from aot images
2238+
// or make sure llvm code actually zero extends the return.
2239+
#ifdef MONO_ARCH_LLVM_SUPPORTED
2240+
gboolean might_use_llvm = TRUE;
2241+
#else
2242+
gboolean might_use_llvm = FALSE;
2243+
#endif
2244+
if ((fsig->pinvoke || might_use_llvm) && !m_type_is_byref (fsig->ret)) {
22362245
int widen_op = -1;
22372246

22382247
/*

0 commit comments

Comments
 (0)