@@ -41,21 +41,7 @@ typedef struct _zend_partial {
41
41
zend_partial_applied frame ;
42
42
} zend_partial ;
43
43
44
- zend_function * zend_partial_prototype (zend_object * zo ) {
45
- zend_partial * partial =
46
- (zend_partial * ) zo ;
47
-
48
- return & partial -> prototype ;
49
- }
50
-
51
- zend_function * zend_partial_function (zend_object * zo ) {
52
- zend_partial * partial =
53
- (zend_partial * ) zo ;
54
-
55
- return & partial -> func ;
56
- }
57
-
58
- zend_object * zend_partial_this (zend_object * object ) {
44
+ static zend_always_inline zend_object * zend_partial_this (zend_object * object ) {
59
45
while (object && instanceof_function (object -> ce , zend_ce_closure )) {
60
46
zend_partial * ptr = (zend_partial * ) object ;
61
47
@@ -73,7 +59,7 @@ zend_object* zend_partial_this(zend_object *object) {
73
59
return object ;
74
60
}
75
61
76
- static zend_always_inline zend_object * zend_partial_parent (zval * This ) {
62
+ static zend_always_inline zend_partial * zend_partial_parent (zval * This ) {
77
63
if (Z_TYPE_P (This ) != IS_OBJECT ) {
78
64
return NULL ;
79
65
}
@@ -88,14 +74,7 @@ static zend_always_inline zend_object* zend_partial_parent(zval *This) {
88
74
return NULL ;
89
75
}
90
76
91
- return Z_OBJ_P (This );
92
- }
93
-
94
- static zend_always_inline zend_partial_applied * zend_partial_frame (zend_object * zo ) {
95
- zend_partial * partial =
96
- (zend_partial * ) zo ;
97
-
98
- return & partial -> frame ;
77
+ return ptr ;
99
78
}
100
79
101
80
static zend_always_inline void zend_partial_prototype_u (zend_partial * partial , zend_function * prototype ) {
@@ -232,7 +211,7 @@ static zend_always_inline void i_zend_partial_trampoline(zend_partial *partial,
232
211
trampoline -> internal_function .function_name = ZSTR_KNOWN (ZEND_STR_MAGIC_INVOKE );
233
212
}
234
213
235
- static zend_object * zend_partial_new (zend_class_entry * type ) {
214
+ static zend_always_inline zend_object * zend_partial_new (zend_class_entry * type ) {
236
215
zend_partial * partial = ecalloc (1 , sizeof (zend_partial ));
237
216
238
217
zend_object_std_init (& partial -> std , type );
@@ -382,7 +361,7 @@ static zend_function *zend_partial_get_method(zend_object **object, zend_string
382
361
}
383
362
/* }}} */
384
363
385
- int zend_partial_get_trampoline (zend_object * obj , zend_class_entry * * ce_ptr , zend_function * * fptr_ptr , zend_object * * obj_ptr , bool check_only )
364
+ static int zend_partial_get_trampoline (zend_object * obj , zend_class_entry * * ce_ptr , zend_function * * fptr_ptr , zend_object * * obj_ptr , bool check_only )
386
365
{
387
366
zend_partial * partial =
388
367
(zend_partial * ) obj ;
@@ -541,25 +520,19 @@ ZEND_NAMED_FUNCTION(zend_partial_call_magic)
541
520
efree (fci .params );
542
521
}
543
522
544
- void zend_partial_apply (zval * res , zend_execute_data * call ) {
523
+ void zend_partial_apply (zval * result , zend_execute_data * call ) {
545
524
zend_function * function , * prototype = NULL ;
546
525
547
- ZVAL_OBJ (res , zend_partial_new (zend_ce_closure ));
526
+ ZVAL_OBJ (result , zend_partial_new (zend_ce_closure ));
548
527
549
- zend_partial * partial =
550
- (zend_partial * ) Z_OBJ_P (res );
551
-
552
- zend_object * parent =
553
- zend_partial_parent (& call -> This );
528
+ zend_partial * parent , * partial =
529
+ (zend_partial * ) Z_OBJ_P (result );
554
530
555
- if (parent ) {
556
- zend_partial_applied * frame =
557
- zend_partial_frame (parent );
558
-
559
- function =
560
- zend_partial_function (parent );
561
- prototype =
562
- zend_partial_prototype (parent );
531
+ if ((parent = zend_partial_parent (& call -> This ))) {
532
+ function = & parent -> func ;
533
+ prototype = & parent -> prototype ;
534
+
535
+ zend_partial_applied * frame = & parent -> frame ;
563
536
564
537
partial -> frame .argc = frame -> argc + ZEND_CALL_NUM_ARGS (call );
565
538
partial -> frame .argv = ecalloc (partial -> frame .argc , sizeof (zval ));
0 commit comments