+2008-12-11 Juan Jesus Garcia de Soria <juanj.g_soria@grupobbva.com>
+
+ * jit/jit-insn.c (jit_insn_call_native): extend small int return
+ values to full ints as native calls sometimes return garbage in MSB
+ of the return rigister.
+
2008-12-11 Aleksey Demakov <ademakov@gmail.com>
* configure.ac: bump version to 0.1.3
jit_value_t *new_args;
jit_value_t return_value;
jit_insn_t insn;
+ jit_type_t return_type;
/* Bail out if there is something wrong with the parameters */
if(!_jit_function_ensure_builder(func) || !native_func || !signature)
}
}
+ /* Make sure that returned byte / short values get zero / sign extended */
+ return_type = jit_type_normalize(return_value->type);
+ switch(return_type->kind)
+ {
+ case JIT_TYPE_SBYTE:
+ /* Force sbyte sign extension to int */
+ return_value = apply_unary_conversion(func, JIT_OP_TRUNC_SBYTE,
+ return_value, return_type);
+ break;
+ case JIT_TYPE_UBYTE:
+ /* Force ubyte zero extension to uint */
+ return_value = apply_unary_conversion(func, JIT_OP_TRUNC_UBYTE,
+ return_value, return_type);
+ break;
+ case JIT_TYPE_SHORT:
+ /* Force short sign extension to int */
+ return_value = apply_unary_conversion(func, JIT_OP_TRUNC_SHORT,
+ return_value, return_type);
+ break;
+ case JIT_TYPE_USHORT:
+ /* Force ushort zero extension to uint */
+ return_value = apply_unary_conversion(func, JIT_OP_TRUNC_USHORT,
+ return_value, return_type);
+ break;
+ }
+
/* Restore exception frame information after the call */
if(!restore_eh_frame_after_call(func, flags))
{