X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Flibjit.c;h=eaf3b164e4bff18c762d799df84919416aabbb0d;hp=ceafb3184c438f5f7f626e852b351df0324e9224;hb=6ec1a060415f860bc3eb4c74fbce1c43f5aa7e55;hpb=de9b3ba972626195328a82bb108cac86312bd288 diff --git a/src/libjit.c b/src/libjit.c index ceafb31..eaf3b16 100644 --- a/src/libjit.c +++ b/src/libjit.c @@ -32,6 +32,11 @@ #include +#if HAVE_INT128 +static jit_type_t jit_type_llong; +static jit_type_t jit_type_ullong; +#endif + static inline jit_type_t psi_jit_decl_arg_type(struct psi_decl_arg *darg); static inline jit_type_t psi_jit_token_type(token_t t) @@ -58,6 +63,12 @@ static inline jit_type_t psi_jit_token_type(token_t t) return jit_type_long; case PSI_T_UINT64: return jit_type_ulong; +#if HAVE_INT128 + case PSI_T_INT128: + return jit_type_llong; + case PSI_T_UINT128: + return jit_type_ullong; +#endif case PSI_T_BOOL: return jit_type_sys_bool; case PSI_T_ENUM: @@ -643,7 +654,31 @@ static void *psi_jit_query(struct psi_context *C, enum psi_context_query q, return NULL; } +static ZEND_RESULT_CODE psi_jit_load(void) +{ +#if HAVE_INT128 + jit_type_t ll_fields[2], ull_fields[2]; + + ll_fields[0] = ll_fields[1] = jit_type_long; + jit_type_llong = jit_type_create_struct(ll_fields, 2, 1); + + ull_fields[0] = ull_fields[1] = jit_type_ulong; + jit_type_ullong = jit_type_create_struct(ull_fields, 2, 1); +#endif + return SUCCESS; +} + +static void psi_jit_free(void) +{ +#if HAVE_INT128 + jit_type_free(jit_type_llong); + jit_type_free(jit_type_ullong); +#endif +} + static struct psi_context_ops ops = { + psi_jit_load, + psi_jit_free, psi_jit_init, psi_jit_dtor, psi_jit_compile,