Repository navigation
Commit 19bc25e
committed
W27a python#5: emitPrimitiveUnaryOp → C body + delegation stub
PRIMITIVE_UNARY_OP (Static Python) opcode handler. Per W27a Step A scope
final commit (5 of 5).
C body: hir_builder_emit_primitive_unary_op_c (~50 lines). Inlines the
PRIM_OP_* unary-op switch:
- NEG_INT/INV_INT/NOT_INT: emit primitive_unary_op directly
- NEG_DBL: special-case via load_const(-1.0) + double_multiply (no
native double-negate primitive). hir_type_from_cdouble handles
Type::fromCDouble C-side equivalent.
PHX_PRIM_UOP_* values are in a SEPARATE namespace from binary/compare
(per classloader.h:110-113 — unary uses 0..3, distinct from binary
0..23). Defined separately to avoid identifier collision.
C primitives used: hir_c_create_primitive_unary_op + hir_c_create_load_const
+ hir_c_create_double_binary_op + hir_type_from_cdouble +
hir_builder_temps_alloc_stack (all existing).
C++ HIRBuilder::emitPrimitiveUnaryOp → 4-line delegation stub (passes
current_func_ for AllocateRegister equivalent).
Verification: cmake --build target jit/phoenix_jit clean (BUILD_EXIT=0).
W27a CLOSURE: 5/5 emit-methods converted (PrimitiveBox/Unbox/BinaryOp/
Compare/UnaryOp). Pure-C++ count: 20 → 15 (5 delegation stubs added).1 parent 55de520 commit 19bc25e
2 files changed
Lines changed: 54 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4098 | 4098 | | |
4099 | 4099 | | |
4100 | 4100 | | |
| 4101 | + | |
| 4102 | + | |
| 4103 | + | |
4101 | 4104 | | |
4102 | 4105 | | |
4103 | 4106 | | |
4104 | | - | |
4105 | | - | |
4106 | | - | |
4107 | | - | |
4108 | | - | |
4109 | | - | |
4110 | | - | |
4111 | | - | |
4112 | | - | |
4113 | | - | |
4114 | | - | |
4115 | | - | |
4116 | | - | |
4117 | | - | |
4118 | | - | |
4119 | | - | |
4120 | | - | |
4121 | | - | |
4122 | | - | |
4123 | | - | |
4124 | | - | |
4125 | | - | |
4126 | | - | |
4127 | | - | |
4128 | | - | |
4129 | | - | |
4130 | | - | |
4131 | | - | |
4132 | | - | |
4133 | | - | |
4134 | | - | |
4135 | | - | |
| 4107 | + | |
| 4108 | + | |
4136 | 4109 | | |
4137 | 4110 | | |
4138 | 4111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3856 | 3856 | | |
3857 | 3857 | | |
3858 | 3858 | | |
| 3859 | + | |
| 3860 | + | |
| 3861 | + | |
| 3862 | + | |
| 3863 | + | |
| 3864 | + | |
| 3865 | + | |
| 3866 | + | |
| 3867 | + | |
| 3868 | + | |
| 3869 | + | |
| 3870 | + | |
| 3871 | + | |
| 3872 | + | |
| 3873 | + | |
| 3874 | + | |
| 3875 | + | |
| 3876 | + | |
| 3877 | + | |
| 3878 | + | |
| 3879 | + | |
| 3880 | + | |
| 3881 | + | |
| 3882 | + | |
| 3883 | + | |
| 3884 | + | |
| 3885 | + | |
| 3886 | + | |
| 3887 | + | |
| 3888 | + | |
| 3889 | + | |
| 3890 | + | |
| 3891 | + | |
| 3892 | + | |
| 3893 | + | |
| 3894 | + | |
| 3895 | + | |
| 3896 | + | |
| 3897 | + | |
| 3898 | + | |
| 3899 | + | |
| 3900 | + | |
| 3901 | + | |
| 3902 | + | |
| 3903 | + | |
| 3904 | + | |
| 3905 | + | |
| 3906 | + | |
| 3907 | + | |
3859 | 3908 | | |
0 commit comments