Skip to content

Commit 1ae750f

Browse files
author
Maxime Chevalier-Boisvert
committed
Fix bug in putobject found by @tenderlove
1 parent 9ca7240 commit 1ae750f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

ujit_codegen.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,19 @@ gen_putobject(jitstate_t* jit, ctx_t* ctx)
292292
{
293293
// Keep track of the fixnum type tag
294294
x86opnd_t stack_top = ctx_stack_push(ctx, T_FIXNUM);
295-
mov(cb, stack_top, imm_opnd((int64_t)arg));
295+
296+
x86opnd_t imm = imm_opnd((int64_t)arg);
297+
298+
// 64-bit immediates can't be directly written to memory
299+
if (imm.num_bits <= 32)
300+
{
301+
mov(cb, stack_top, imm);
302+
}
303+
else
304+
{
305+
mov(cb, REG0, imm);
306+
mov(cb, stack_top, REG0);
307+
}
296308
}
297309
else if (arg == Qtrue || arg == Qfalse)
298310
{

0 commit comments

Comments
 (0)