Skip to content

Commit 02ac609

Browse files
committed
Revert "simplify: fully port GetLength to C + fix PrimitiveBox signatures"
This reverts commit 88bef34.
1 parent 88bef34 commit 02ac609

3 files changed

Lines changed: 5 additions & 26 deletions

File tree

Python/jit/hir/simplify.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2772,12 +2772,8 @@ Register* simplifyInstr(Env& env, const Instr* instr) {
27722772
return r;
27732773
}
27742774

2775-
case Opcode::kGetLength: {
2776-
SimplifyEnv cenv = make_c_env();
2777-
auto *r = static_cast<Register*>(simplify_get_length_c(&cenv, instr));
2778-
sync_c_env(cenv);
2779-
return r;
2780-
}
2775+
case Opcode::kGetLength:
2776+
return simplifyGetLength(env, instr);
27812777

27822778
case Opcode::kIntConvert: {
27832779
SimplifyEnv cenv = make_c_env();

Python/jit/hir/simplify_c.c

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,9 @@ void *simplify_env_emit_long_compare(SimplifyEnv *env, int32_t op,
115115

116116
void *simplify_env_emit_primitive_box_bool(SimplifyEnv *env, void *src) {
117117
void *reg = hir_func_alloc_register(env->func);
118-
extern void *hir_c_create_primitive_box_bool_reg(void *dst, void *src);
119-
void *instr = hir_c_create_primitive_box_bool_reg(reg, src);
118+
extern void *hir_c_create_primitive_box(void *dst, void *src, HirType type);
119+
HirType t_cbool = HIR_TYPE_CBOOL;
120+
void *instr = hir_c_create_primitive_box(reg, src, t_cbool);
120121
return simplify_env_emit(env, instr);
121122
}
122123

@@ -198,23 +199,6 @@ void *simplify_env_emit_check_neg(SimplifyEnv *env, void *src, void *frame_state
198199
return simplify_env_emit(env, instr);
199200
}
200201

201-
/* ---- simplifyGetLength ----
202-
* If obj is a collection with known length field, emit LoadField + PrimitiveBox. */
203-
void *simplify_get_length_c(SimplifyEnv *env, const void *instr) {
204-
void *obj = hir_c_get_operand(instr, 0);
205-
void *size = emit_get_length_int64_c(env, obj);
206-
if (size == NULL) return NULL;
207-
208-
void *fs = hir_c_get_frame_state(instr);
209-
HirType t_cint64 = HIR_TYPE_CINT64;
210-
extern void *hir_c_create_primitive_box_reg(void *dst, void *src, HirType type);
211-
void *dst_reg = hir_func_alloc_register(env->func);
212-
void *box = hir_c_create_primitive_box_reg(dst_reg, size, t_cint64);
213-
extern void hir_c_copy_frame_state(void *dst, void *src);
214-
hir_c_copy_frame_state(box, (void *)instr);
215-
return simplify_env_emit(env, box);
216-
}
217-
218202
/* ---- simplifyStoreSubscr ----
219203
* If target is DictExact, call mp_ass_subscript directly + check_neg. */
220204
void *simplify_store_subscr_c(SimplifyEnv *env, const void *instr) {

Python/jit/hir/simplify_c.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ void *simplify_cint_to_cbool_c(SimplifyEnv *env, const void *instr);
4545
void *simplify_cond_branch_const_c(SimplifyEnv *env, const void *instr);
4646
void *simplify_compare_c(SimplifyEnv *env, const void *instr);
4747
void *simplify_is_neg_and_err_c(SimplifyEnv *env, const void *instr);
48-
void *simplify_get_length_c(SimplifyEnv *env, const void *instr);
4948
void *simplify_store_subscr_c(SimplifyEnv *env, const void *instr);
5049
void *simplify_load_var_object_size_c(SimplifyEnv *env, const void *instr);
5150

0 commit comments

Comments
 (0)