#include <jit/jit.h>
+#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)
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_INT:
case PSI_T_ENUM:
return jit_type_sys_int;
- case PSI_T_LONG:
- return jit_type_sys_long;
case PSI_T_FLOAT:
return jit_type_sys_float;
case PSI_T_DOUBLE:
}
}
-static inline jit_abi_t psi_jit_abi(const char *convention)
+static inline jit_abi_t psi_jit_abi(zend_string *convention)
{
- if (!strcasecmp(convention, "stdcall")) {
+ if (zend_string_equals_literal(convention, "stdcall")) {
return jit_abi_stdcall;
}
- if (!strcasecmp(convention, "fastcall")) {
+ if (zend_string_equals_literal(convention, "fastcall")) {
return jit_abi_fastcall;
}
return jit_abi_cdecl;
continue;
}
- zf->fname = impl->func->name + (impl->func->name[0] == '\\');
+ zf->fname = impl->func->name->val + (impl->func->name->val[0] == '\\');
zf->handler = ((struct psi_jit_impl_info *) impl->info)->closure;
zf->num_args = psi_plist_count(impl->func->args);
zf->arg_info = psi_internal_arginfo(impl);
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,