diff --git a/main/lib/jit/gb.jit/jit.h b/main/lib/jit/gb.jit/jit.h index 4c43514f6..fcd31f955 100644 --- a/main/lib/jit/gb.jit/jit.h +++ b/main/lib/jit/gb.jit/jit.h @@ -226,7 +226,7 @@ enum #define BORROW_s(_val) ({ GB_STRING _v = (_val); if ((_v).type == GB_T_STRING) GB.RefString(_v.value.addr); _v; }) #define BORROW_o(_val) ({ GB_OBJECT _v = (_val); GB.Ref(_v.value); _v; }) -#define BORROW_v(_val) ({ GB_VARIANT _v = (_val); GB.BorrowValue(&_v); _v; }) +#define BORROW_v(_val) ({ GB_VARIANT _v = (_val); GB.BorrowValue((GB_VALUE *)&_v); _v; }) #define RELEASE_s(_val) ({ GB_STRING _v = (_val); if ((_v).type == GB_T_STRING) GB.FreeString(&_v.value.addr); _v; }) #define RELEASE_o(_val) ({ GB_OBJECT _v = (_val); GB.Unref(&_v.value); _v; }) @@ -390,6 +390,11 @@ enum #define CONV_o_O(_val, _class) CONV(_val, o, o, CLASS(_class)) +#define GET_NULL_o() ({ GB_OBJECT temp; temp.type = GB_T_OBJECT; temp.value = NULL; temp; }) +#define GET_NULL_v() ({ GB_VARIANT temp; temp.type = GB_T_VARIANT; temp.value.type = GB_T_NULL; temp; }) +#define GET_NULL_s() GET_CSTRING("", 0, 0) +#define GET_NULL_d() ({ GB_DATE temp; temp.type = GB_T_DATE; temp.value.date = 0; temp.value.time = 0; temp; }) + #define PUSH_GOSUB(_label) ({ \ GB_VALUE_GOSUB *_p = (GB_VALUE_GOSUB *)sp; \ _p->type = GB_T_VOID; \ diff --git a/main/lib/jit/jit_body.c b/main/lib/jit/jit_body.c index 573ab5fdc..7b3a307e8 100644 --- a/main/lib/jit/jit_body.c +++ b/main/lib/jit/jit_body.c @@ -485,7 +485,13 @@ static char *get_conv_format(TYPE src, TYPE dest) if (src == T_NULL) { if (dest == T_OBJECT) - return "GET_OBJECT(NULL, GB_T_OBJECT)"; + return "GET_NULL_o()"; + else if (dest == T_VARIANT) + return "GET_NULL_v()"; + else if (dest == T_DATE) + return "GET_NULL_d()"; + else if (dest == T_STRING || dest == T_CSTRING) + return "GET_NULL_s()"; else { sprintf(buffer, "GET_OBJECT(NULL, CLASS(%p))", (CLASS *)dest);