Commit 234e29df

234e29dfa690Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified

Description

fix(codegen): range#map allows bigint block return + unified bigint walker

Details

Commit
234e29dfa690
Parent
47d9e5be162e

spinel_codegen.rbmodifiedView file

@@ -34856,7 +34856,7 @@
3485634856 block_is_typed_array = (block_ret_r == "int_array" || block_ret_r == "str_array" ||
3485734857 block_ret_r == "float_array" || block_ret_r == "sym_array" ||
3485834858 is_ptr_array_type(block_ret_r) == 1 || block_ret_r == "poly_array")
34859- if block_ret_r != "int" && block_ret_r != "string" && block_ret_r != "float" && block_ret_r != "poly" && block_is_typed_array == false
34859+ if block_ret_r != "int" && block_ret_r != "string" && block_ret_r != "float" && block_ret_r != "poly" && block_ret_r != "bigint" && block_is_typed_array == false
3486034860 return "0"
3486134861 end
3486234862 @needs_int_array = 1
@@ -34969,26 +34969,8 @@
3496934969 end
3497034970 else
3497134971 # promote-mode block tail returning bigint into IntArray;
34972- # unbox before pushing. The plain infer_type doesn't catch the
34973- # arith-callnode-with-bigint-arg shape (cache stale at "int"), so
34974- # also peek the operator's arg side.
34975- tail_t_rng = infer_type(stmts_r2.last)
34976- if tail_t_rng != "bigint" && @nd_type[stmts_r2.last] == "CallNode"
34977- tn_mn = @nd_name[stmts_r2.last]
34978- if tn_mn == "+" || tn_mn == "-" || tn_mn == "*" || tn_mn == "/" || tn_mn == "%" || tn_mn == "**"
34979- tn_recv = @nd_receiver[stmts_r2.last]
34980- tn_args_id = @nd_arguments[stmts_r2.last]
34981- if tn_recv >= 0 && base_type(infer_type(tn_recv)) == "bigint"
34982- tail_t_rng = "bigint"
34983- elsif tn_args_id >= 0
34984- tn_aa = get_args(tn_args_id)
34985- if tn_aa.length > 0 && base_type(infer_type(tn_aa[0])) == "bigint"
34986- tail_t_rng = "bigint"
34987- end
34988- end
34989- end
34990- end
34991- if tail_t_rng == "bigint"
34972+ # unbox before pushing.
34973+ if infer_type(stmts_r2.last) == "bigint" || expr_emit_is_bigint(stmts_r2.last) == 1
3499234974 @needs_bigint = 1
3499334975 lastv_r = "sp_bigint_to_int((sp_Bigint *)" + lastv_r + ")"
3499434976 end