- if (closures && SUCCESS != zend_register_functions(NULL, closures, NULL, MODULE_PERSISTENT)) {
- psi_error(E_WARNING, "Failed to register functions!");
- }
- //PSI_CompilerDtor(&C);
- }
- jit_context_build_end(ctx);
- }
- PSI_ValidatorDtor(&V);
+ REGISTER_INI_ENTRIES();
+
+ INIT_NS_CLASS_ENTRY(ce, "psi", "object", NULL);
+ psi_class_entry = zend_register_internal_class_ex(&ce, NULL);
+ psi_class_entry->create_object = psi_object_init;
+
+ memcpy(&psi_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ psi_object_handlers.offset = XtOffsetOf(psi_object, std);
+ psi_object_handlers.free_obj = psi_object_free;
+ psi_object_handlers.clone_obj = NULL;
+
+#ifdef HAVE_LIBJIT
+ if (!strcasecmp(PSI_G(engine), "jit")) {
+ ops = psi_libjit_ops();
+ } else
+#endif
+#ifdef HAVE_LIBFFI
+ ops = psi_libffi_ops();
+#endif
+
+ if (!ops) {
+ php_error(E_WARNING, "No PSI engine found");
+ return FAILURE;