Skip to content

Commit dc9cc44

Browse files
committed
Redesign JIT/FFI API
1 parent 4a765fd commit dc9cc44

File tree

9 files changed

+92
-83
lines changed

9 files changed

+92
-83
lines changed

Zend/zend.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,8 @@ ZEND_API void (*zend_accel_schedule_restart_hook)(int reason) = NULL;
9898
ZEND_ATTRIBUTE_NONNULL ZEND_API zend_result (*zend_random_bytes)(void *bytes, size_t size, char *errstr, size_t errstr_size) = NULL;
9999
ZEND_ATTRIBUTE_NONNULL ZEND_API void (*zend_random_bytes_insecure)(zend_random_bytes_insecure_state *state, void *bytes, size_t size) = NULL;
100100

101-
ZEND_API zend_class_entry *zend_ffi_ce = NULL;
102-
ZEND_API zend_class_entry *zend_ffi_cdata_ce = NULL;
103-
ZEND_API zend_ffi_cdata* (*zend_ffi_cdata_create)(void *ptr, zend_ffi_type *type) = NULL;
104-
ZEND_API zend_ffi_dcl* (*zend_ffi_cache_type_get)(zend_string *str, void *context) = NULL;
105-
ZEND_API zend_ffi_dcl* (*zend_ffi_cache_type_add)(zend_string *str, zend_ffi_dcl *dcl, void *context) = NULL;
106-
ZEND_API zend_ffi_scope* (*zend_ffi_cache_scope_get)(zend_string *str) = NULL;
107-
ZEND_API zend_ffi_scope* (*zend_ffi_cache_scope_add)(zend_string *str, zend_ffi_scope *scope) = NULL;
108-
ZEND_API void (*zend_ffi_type_print)(FILE *f, const zend_ffi_type *type) = NULL;
101+
/* FFI/OPCache interopability API */
102+
ZEND_API struct _zend_ffi_api *zend_ffi_api = NULL;
109103

110104
/* This callback must be signal handler safe! */
111105
void (*zend_on_timeout)(int seconds);

Zend/zend.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -408,20 +408,7 @@ extern ZEND_API zend_class_entry *zend_standard_class_def;
408408
extern ZEND_API zend_utility_values zend_uv;
409409

410410
/* FFI/OPCache interopability API */
411-
extern ZEND_API zend_class_entry *zend_ffi_ce;
412-
extern ZEND_API zend_class_entry *zend_ffi_cdata_ce;
413-
414-
typedef struct _zend_ffi_dcl zend_ffi_dcl;
415-
typedef struct _zend_ffi_scope zend_ffi_scope;
416-
typedef struct _zend_ffi_cdata zend_ffi_cdata;
417-
typedef struct _zend_ffi_type zend_ffi_type;
418-
419-
ZEND_API extern zend_ffi_cdata* (*zend_ffi_cdata_create)(void *ptr, zend_ffi_type *type);
420-
ZEND_API extern zend_ffi_dcl* (*zend_ffi_cache_type_get)(zend_string *str, void *context);
421-
ZEND_API extern zend_ffi_dcl* (*zend_ffi_cache_type_add)(zend_string *str, zend_ffi_dcl *dcl, void *context);
422-
ZEND_API extern zend_ffi_scope* (*zend_ffi_cache_scope_get)(zend_string *str);
423-
ZEND_API extern zend_ffi_scope* (*zend_ffi_cache_scope_add)(zend_string *str, zend_ffi_scope *scope);
424-
ZEND_API extern void (*zend_ffi_type_print)(FILE *f, const zend_ffi_type *type);
411+
extern ZEND_API struct _zend_ffi_api *zend_ffi_api;
425412

426413
/* If DTrace is available and enabled */
427414
extern ZEND_API bool zend_dtrace_enabled;

ext/ffi/ffi.c

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,12 @@ static const char *zend_ffi_tag_kind_name[3] = {"enum", "struct", "union"};
6767
#define ZEND_FFI_SIZEOF_ARG \
6868
MAX(FFI_SIZEOF_ARG, sizeof(double))
6969

70+
static struct _zend_ffi_api ffi_api;
71+
7072
static zend_class_entry *zend_ffi_exception_ce;
7173
static zend_class_entry *zend_ffi_parser_exception_ce;
74+
static zend_class_entry *zend_ffi_ce;
75+
static zend_class_entry *zend_ffi_cdata_ce;
7276
static zend_class_entry *zend_ffi_ctype_ce;
7377

7478
static zend_object_handlers zend_ffi_handlers;
@@ -91,7 +95,7 @@ static ZEND_FUNCTION(ffi_trampoline);
9195
static ZEND_COLD void zend_ffi_return_unsupported(zend_ffi_type *type);
9296
static ZEND_COLD void zend_ffi_pass_unsupported(zend_ffi_type *type);
9397
static ZEND_COLD void zend_ffi_assign_incompatible(zval *arg, zend_ffi_type *type);
94-
//???static bool zend_ffi_is_compatible_type(zend_ffi_type *dst_type, zend_ffi_type *src_type);
98+
static bool zend_ffi_is_compatible_type(zend_ffi_type *dst_type, zend_ffi_type *src_type);
9599

96100
#if FFI_CLOSURES
97101
static void *zend_ffi_create_callback(zend_ffi_type *type, zval *value);
@@ -177,7 +181,7 @@ static bool zend_ffi_func_ptr_are_compatible(zend_ffi_type *dst_type, zend_ffi_t
177181
}
178182
/* }}} */
179183

180-
PHP_FFI_API bool zend_ffi_is_compatible_type(zend_ffi_type *dst_type, zend_ffi_type *src_type) /* {{{ */
184+
static bool zend_ffi_is_compatible_type(zend_ffi_type *dst_type, zend_ffi_type *src_type) /* {{{ */
181185
{
182186
while (1) {
183187
if (dst_type == src_type) {
@@ -352,7 +356,7 @@ static ffi_type *zend_ffi_get_type(zend_ffi_type *type) /* {{{ */
352356
}
353357
/* }}} */
354358

355-
static zend_ffi_cdata* _zend_ffi_cdata_create(void *ptr, zend_ffi_type *type) /* {{{ */
359+
static zend_ffi_cdata* zend_ffi_cdata_create(void *ptr, zend_ffi_type *type) /* {{{ */
356360
{
357361
zend_ffi_cdata *cdata = emalloc(sizeof(zend_ffi_cdata));
358362

@@ -2935,8 +2939,8 @@ ZEND_METHOD(FFI, cdef) /* {{{ */
29352939
FFI_G(tags) = NULL;
29362940

29372941
if (code && ZSTR_LEN(code)) {
2938-
if (zend_ffi_cache_scope_get) {
2939-
zend_ffi_scope *scope = zend_ffi_cache_scope_get(code);
2942+
if (ffi_api.cache_scope_get) {
2943+
zend_ffi_scope *scope = ffi_api.cache_scope_get(code);
29402944
if (scope) {
29412945
ffi = (zend_ffi*)zend_ffi_new(zend_ffi_ce);
29422946
ffi->lib = handle;
@@ -2990,12 +2994,12 @@ ZEND_METHOD(FFI, cdef) /* {{{ */
29902994
} ZEND_HASH_FOREACH_END();
29912995
}
29922996

2993-
if (zend_ffi_cache_scope_add) {
2997+
if (ffi_api.cache_scope_add) {
29942998
zend_ffi_scope scope, *cached_scope;
29952999

29963000
scope.symbols = FFI_G(symbols);
29973001
scope.tags = FFI_G(tags);
2998-
cached_scope = zend_ffi_cache_scope_add(code, &scope);
3002+
cached_scope = ffi_api.cache_scope_add(code, &scope);
29993003
if (cached_scope) {
30003004
if (FFI_G(symbols)) {
30013005
zend_hash_destroy(FFI_G(symbols));
@@ -3262,8 +3266,8 @@ static zend_ffi *zend_ffi_load(const char *filename, bool preload) /* {{{ */
32623266
close(fd);
32633267
ZSTR_VAL(code)[code_size] = 0;
32643268

3265-
if (!preload && zend_ffi_cache_scope_get) {
3266-
zend_ffi_scope *scope = zend_ffi_cache_scope_get(code);
3269+
if (!preload && ffi_api.cache_scope_get) {
3270+
zend_ffi_scope *scope = ffi_api.cache_scope_get(code);
32673271
if (scope) {
32683272
ffi = (zend_ffi*)zend_ffi_new(zend_ffi_ce);
32693273
ffi->lib = handle;
@@ -3473,12 +3477,12 @@ static zend_ffi *zend_ffi_load(const char *filename, bool preload) /* {{{ */
34733477
ffi->tags = scope->tags;
34743478
ffi->persistent = 1;
34753479
} else {
3476-
if (zend_ffi_cache_scope_add) {
3480+
if (ffi_api.cache_scope_add) {
34773481
zend_ffi_scope scope, *cached_scope;
34783482

34793483
scope.symbols = FFI_G(symbols);
34803484
scope.tags = FFI_G(tags);
3481-
cached_scope = zend_ffi_cache_scope_add(code, &scope);
3485+
cached_scope = ffi_api.cache_scope_add(code, &scope);
34823486
if (cached_scope) {
34833487
if (FFI_G(symbols)) {
34843488
zend_hash_destroy(FFI_G(symbols));
@@ -3802,8 +3806,8 @@ ZEND_METHOD(FFI, new) /* {{{ */
38023806

38033807
FFI_G(default_type_attr) = 0;
38043808

3805-
if (zend_ffi_cache_type_get
3806-
&& (cached_dcl = zend_ffi_cache_type_get(type_def, FFI_G(symbols)))) {
3809+
if (ffi_api.cache_type_get
3810+
&& (cached_dcl = ffi_api.cache_type_get(type_def, FFI_G(symbols)))) {
38073811
memcpy(&dcl, cached_dcl, sizeof(zend_ffi_dcl));
38083812
} else if (zend_ffi_parse_type(ZSTR_VAL(type_def), ZSTR_LEN(type_def), &dcl) == FAILURE) {
38093813
zend_ffi_type_dtor(dcl.type);
@@ -3823,8 +3827,8 @@ ZEND_METHOD(FFI, new) /* {{{ */
38233827
zend_ffi_tags_cleanup(&dcl);
38243828
}
38253829

3826-
if (zend_ffi_cache_type_add) {
3827-
cached_dcl = zend_ffi_cache_type_add(type_def, &dcl, FFI_G(symbols));
3830+
if (zend_ffi_api->cache_type_add) {
3831+
cached_dcl = zend_ffi_api->cache_type_add(type_def, &dcl, FFI_G(symbols));
38283832
if (cached_dcl) {
38293833
if (ZEND_FFI_TYPE_IS_OWNED(dcl.type)) {
38303834
_zend_ffi_type_dtor(dcl.type);
@@ -3967,8 +3971,8 @@ ZEND_METHOD(FFI, cast) /* {{{ */
39673971

39683972
FFI_G(default_type_attr) = 0;
39693973

3970-
if (zend_ffi_cache_type_get
3971-
&& (cached_dcl = zend_ffi_cache_type_get(type_def, FFI_G(symbols)))) {
3974+
if (ffi_api.cache_type_get
3975+
&& (cached_dcl = ffi_api.cache_type_get(type_def, FFI_G(symbols)))) {
39723976
memcpy(&dcl, cached_dcl, sizeof(zend_ffi_dcl));
39733977
} else if (zend_ffi_parse_type(ZSTR_VAL(type_def), ZSTR_LEN(type_def), &dcl) == FAILURE) {
39743978
zend_ffi_type_dtor(dcl.type);
@@ -3988,8 +3992,8 @@ ZEND_METHOD(FFI, cast) /* {{{ */
39883992
zend_ffi_tags_cleanup(&dcl);
39893993
}
39903994

3991-
if (zend_ffi_cache_type_add) {
3992-
cached_dcl = zend_ffi_cache_type_add(type_def, &dcl, FFI_G(symbols));
3995+
if (ffi_api.cache_type_add) {
3996+
cached_dcl = ffi_api.cache_type_add(type_def, &dcl, FFI_G(symbols));
39933997
if (cached_dcl) {
39943998
if (ZEND_FFI_TYPE_IS_OWNED(dcl.type)) {
39953999
_zend_ffi_type_dtor(dcl.type);
@@ -4154,8 +4158,8 @@ ZEND_METHOD(FFI, type) /* {{{ */
41544158

41554159
FFI_G(default_type_attr) = 0;
41564160

4157-
if (zend_ffi_cache_type_get
4158-
&& (cached_dcl = zend_ffi_cache_type_get(type_def, FFI_G(symbols)))) {
4161+
if (ffi_api.cache_type_get
4162+
&& (cached_dcl = ffi_api.cache_type_get(type_def, FFI_G(symbols)))) {
41594163
memcpy(&dcl, cached_dcl, sizeof(zend_ffi_dcl));
41604164
} else if (zend_ffi_parse_type(ZSTR_VAL(type_def), ZSTR_LEN(type_def), &dcl) == FAILURE) {
41614165
zend_ffi_type_dtor(dcl.type);
@@ -4175,8 +4179,8 @@ ZEND_METHOD(FFI, type) /* {{{ */
41754179
zend_ffi_tags_cleanup(&dcl);
41764180
}
41774181

4178-
if (zend_ffi_cache_type_add) {
4179-
cached_dcl = zend_ffi_cache_type_add(type_def, &dcl, FFI_G(symbols));
4182+
if (ffi_api.cache_type_add) {
4183+
cached_dcl = ffi_api.cache_type_add(type_def, &dcl, FFI_G(symbols));
41804184
if (cached_dcl) {
41814185
if (ZEND_FFI_TYPE_IS_OWNED(dcl.type)) {
41824186
_zend_ffi_type_dtor(dcl.type);
@@ -5311,7 +5315,7 @@ static ZEND_INI_DISP(zend_ffi_enable_displayer_cb) /* {{{ */
53115315
}
53125316
/* }}} */
53135317

5314-
static void _zend_ffi_type_print(FILE *f, const zend_ffi_type *type) /* {{{ */
5318+
static void zend_ffi_type_print(FILE *f, const zend_ffi_type *type) /* {{{ */
53155319
{
53165320
zend_ffi_ctype_name_buf buf;
53175321

@@ -5604,8 +5608,16 @@ ZEND_MINIT_FUNCTION(ffi)
56045608
zend_ffi_ctype_handlers.get_properties = zend_fake_get_properties;
56055609
zend_ffi_ctype_handlers.get_gc = zend_fake_get_gc;
56065610

5607-
zend_ffi_cdata_create = _zend_ffi_cdata_create;
5608-
zend_ffi_type_print = _zend_ffi_type_print;
5611+
memset(&ffi_api, 0, sizeof(ffi_api));
5612+
5613+
ffi_api.scope_ce = zend_ffi_ce;
5614+
ffi_api.cdata_ce = zend_ffi_cdata_ce;
5615+
5616+
ffi_api.cdata_create = zend_ffi_cdata_create;
5617+
ffi_api.type_print = zend_ffi_type_print;
5618+
ffi_api.is_compatible_type = zend_ffi_is_compatible_type;
5619+
5620+
zend_ffi_api = &ffi_api;
56095621

56105622
if (FFI_G(preload)) {
56115623
return zend_ffi_preload(FFI_G(preload));

ext/ffi/php_ffi.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,18 @@ typedef struct _zend_ffi {
413413
#define ZEND_FFI_TYPE_MAKE_OWNED(t) \
414414
((zend_ffi_type*)(((uintptr_t)(t)) | ZEND_FFI_TYPE_OWNED))
415415

416-
PHP_FFI_API bool zend_ffi_is_compatible_type(zend_ffi_type *dst_type, zend_ffi_type *src_type);
416+
struct _zend_ffi_api {
417+
zend_class_entry *scope_ce;
418+
zend_class_entry *cdata_ce;
419+
420+
zend_ffi_cdata* (*cdata_create)(void *ptr, zend_ffi_type *type);
421+
void (*type_print)(FILE *f, const zend_ffi_type *type);
422+
bool (*is_compatible_type)(zend_ffi_type *dst_type, zend_ffi_type *src_type);
423+
424+
zend_ffi_dcl* (*cache_type_get)(zend_string *str, void *context);
425+
zend_ffi_dcl* (*cache_type_add)(zend_string *str, zend_ffi_dcl *dcl, void *context);
426+
zend_ffi_scope* (*cache_scope_get)(zend_string *str);
427+
zend_ffi_scope* (*cache_scope_add)(zend_string *str, zend_ffi_scope *scope);
428+
};
417429

418430
#endif /* PHP_FFI_H */

ext/opcache/ZendAccelerator.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3860,10 +3860,12 @@ static zend_result accel_post_startup(void)
38603860
zend_inheritance_cache_add = zend_accel_inheritance_cache_add;
38613861

38623862
#if HAVE_FFI
3863-
zend_ffi_cache_type_get = accel_ffi_cache_type_get;
3864-
zend_ffi_cache_type_add = accel_ffi_cache_type_add;
3865-
zend_ffi_cache_scope_get = accel_ffi_cache_scope_get;
3866-
zend_ffi_cache_scope_add = accel_ffi_cache_scope_add;
3863+
if (zend_ffi_api) {
3864+
zend_ffi_api->cache_type_get = accel_ffi_cache_type_get;
3865+
zend_ffi_api->cache_type_add = accel_ffi_cache_type_add;
3866+
zend_ffi_api->cache_scope_get = accel_ffi_cache_scope_get;
3867+
zend_ffi_api->cache_scope_add = accel_ffi_cache_scope_add;
3868+
}
38673869
#endif
38683870
}
38693871

@@ -3920,10 +3922,12 @@ void accel_shutdown(void)
39203922
zend_inheritance_cache_add = accelerator_orig_inheritance_cache_add;
39213923

39223924
#if HAVE_FFI
3923-
zend_ffi_cache_type_get = NULL;
3924-
zend_ffi_cache_type_add = NULL;
3925-
zend_ffi_cache_scope_get = NULL;
3926-
zend_ffi_cache_scope_add = NULL;
3925+
if (zend_ffi_api) {
3926+
zend_ffi_api->cache_type_get = NULL;
3927+
zend_ffi_api->cache_type_add = NULL;
3928+
zend_ffi_api->cache_scope_get = NULL;
3929+
zend_ffi_api->cache_scope_add = NULL;
3930+
}
39273931
#endif
39283932

39293933
if ((ini_entry = zend_hash_str_find_ptr(EG(ini_directives), "include_path", sizeof("include_path")-1)) != NULL) {

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3383,8 +3383,8 @@ static void ZEND_FASTCALL zend_jit_zval_ffi_ptr(zval *zv, zend_ffi_type *type, v
33833383
GC_SET_REFCOUNT(&cdata->std, 1);
33843384
GC_TYPE_INFO(&cdata->std) = GC_OBJECT | (IS_OBJ_DESTRUCTOR_CALLED << GC_FLAGS_SHIFT);
33853385
cdata->std.extra_flags = 0;
3386-
cdata->std.ce = zend_ffi_cdata_ce;
3387-
cdata->std.handlers = zend_ffi_cdata_ce->default_object_handlers; /* zend_ffi_cdata_handlers */
3386+
cdata->std.ce = zend_ffi_api->cdata_ce;
3387+
cdata->std.handlers = zend_ffi_api->cdata_ce->default_object_handlers; /* zend_ffi_cdata_handlers */
33883388
cdata->std.properties = NULL;
33893389
zend_objects_store_put(&cdata->std);
33903390
cdata->type = type;
@@ -3409,8 +3409,8 @@ static void ZEND_FASTCALL zend_jit_zval_ffi_obj(zval *zv, zend_ffi_type *type, v
34093409
GC_SET_REFCOUNT(&cdata->std, 1);
34103410
GC_TYPE_INFO(&cdata->std) = GC_OBJECT | (IS_OBJ_DESTRUCTOR_CALLED << GC_FLAGS_SHIFT);
34113411
cdata->std.extra_flags = 0;
3412-
cdata->std.ce = zend_ffi_cdata_ce;
3413-
cdata->std.handlers = zend_ffi_cdata_ce->default_object_handlers; /* zend_ffi_cdata_handlers */
3412+
cdata->std.ce = zend_ffi_api->cdata_ce;
3413+
cdata->std.handlers = zend_ffi_api->cdata_ce->default_object_handlers; /* zend_ffi_cdata_handlers */
34143414
cdata->std.properties = NULL;
34153415
zend_objects_store_put(&cdata->std);
34163416
cdata->type = type;

ext/opcache/jit/zend_jit_ir_ffi.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -708,16 +708,16 @@ static int zend_jit_ffi_guard(zend_jit_ctx *jit,
708708
{
709709
if (ssa->var_info
710710
&& use >= 0
711-
&& ssa->var_info[use].ce != zend_ffi_cdata_ce) {
712-
if (!zend_jit_class_guard(jit, opline, ref, zend_ffi_cdata_ce)) {
711+
&& ssa->var_info[use].ce != zend_ffi_api->cdata_ce) {
712+
if (!zend_jit_class_guard(jit, opline, ref, zend_ffi_api->cdata_ce)) {
713713
return 0;
714714
}
715715
ssa->var_info[use].type |= MAY_BE_CLASS_GUARD;
716-
ssa->var_info[use].ce = zend_ffi_cdata_ce;
716+
ssa->var_info[use].ce = zend_ffi_api->cdata_ce;
717717
ssa->var_info[use].is_instanceof = 0;
718718
if (def >= 0) {
719719
ssa->var_info[def].type |= MAY_BE_CLASS_GUARD;
720-
ssa->var_info[def].ce = zend_ffi_cdata_ce;
720+
ssa->var_info[def].ce = zend_ffi_api->cdata_ce;
721721
ssa->var_info[def].is_instanceof = 0;
722722
}
723723
}
@@ -753,17 +753,17 @@ static int zend_jit_ffi_symbols_guard(zend_jit_ctx *jit,
753753

754754
if (ssa->var_info
755755
&& use >= 0
756-
&& ssa->var_info[use].ce != zend_ffi_ce) {
756+
&& ssa->var_info[use].ce != zend_ffi_api->scope_ce) {
757757
ref = jit_Z_PTR(jit, addr);
758-
if (!zend_jit_class_guard(jit, opline, ref, zend_ffi_ce)) {
758+
if (!zend_jit_class_guard(jit, opline, ref, zend_ffi_api->scope_ce)) {
759759
return 0;
760760
}
761761
ssa->var_info[use].type |= MAY_BE_CLASS_GUARD;
762-
ssa->var_info[use].ce = zend_ffi_ce;
762+
ssa->var_info[use].ce = zend_ffi_api->scope_ce;
763763
ssa->var_info[use].is_instanceof = 0;
764764
if (def >= 0) {
765765
ssa->var_info[def].type |= MAY_BE_CLASS_GUARD;
766-
ssa->var_info[def].ce = zend_ffi_ce;
766+
ssa->var_info[def].ce = zend_ffi_api->scope_ce;
767767
ssa->var_info[def].is_instanceof = 0;
768768
}
769769
}
@@ -835,7 +835,7 @@ static int zend_jit_ffi_fetch_dim(zend_jit_ctx *jit,
835835

836836
if (opline->opcode == ZEND_FETCH_DIM_W || opline->opcode == ZEND_FETCH_DIM_RW) {
837837
jit_set_Z_PTR(jit, res_addr,
838-
ir_CALL_2(IR_ADDR, ir_CONST_FUNC(zend_ffi_cdata_create),
838+
ir_CALL_2(IR_ADDR, ir_CONST_FUNC(zend_ffi_api->cdata_create),
839839
ptr, ir_CONST_ADDR(el_type)));
840840
jit_set_Z_TYPE_INFO(jit, res_addr, IS_OBJECT_EX);
841841
} else {
@@ -1445,7 +1445,7 @@ static int zend_jit_ffi_fetch_obj(zend_jit_ctx *jit,
14451445

14461446
if (opline->opcode == ZEND_FETCH_OBJ_W) {
14471447
jit_set_Z_PTR(jit, res_addr,
1448-
ir_CALL_2(IR_ADDR, ir_CONST_FUNC(zend_ffi_cdata_create),
1448+
ir_CALL_2(IR_ADDR, ir_CONST_FUNC(zend_ffi_api->cdata_create),
14491449
ptr, ir_CONST_ADDR(field_type)));
14501450
jit_set_Z_TYPE_INFO(jit, res_addr, IS_OBJECT_EX);
14511451
} else {
@@ -1492,7 +1492,7 @@ static int zend_jit_ffi_fetch_val(zend_jit_ctx *jit,
14921492

14931493
if (opline->opcode == ZEND_FETCH_OBJ_W) {
14941494
jit_set_Z_PTR(jit, res_addr,
1495-
ir_CALL_2(IR_ADDR, ir_CONST_FUNC(zend_ffi_cdata_create),
1495+
ir_CALL_2(IR_ADDR, ir_CONST_FUNC(zend_ffi_api->cdata_create),
14961496
ptr, ir_CONST_ADDR(op1_ffi_type)));
14971497
jit_set_Z_TYPE_INFO(jit, res_addr, IS_OBJECT_EX);
14981498
} else {
@@ -1540,7 +1540,7 @@ static int zend_jit_ffi_fetch_sym(zend_jit_ctx *jit,
15401540

15411541
if (opline->opcode == ZEND_FETCH_OBJ_W) {
15421542
jit_set_Z_PTR(jit, res_addr,
1543-
ir_CALL_2(IR_ADDR, ir_CONST_FUNC(zend_ffi_cdata_create),
1543+
ir_CALL_2(IR_ADDR, ir_CONST_FUNC(zend_ffi_api->cdata_create),
15441544
ptr, ir_CONST_ADDR(sym_type)));
15451545
jit_set_Z_TYPE_INFO(jit, res_addr, IS_OBJECT_EX);
15461546
} else {

0 commit comments

Comments
 (0)