@@ -883,14 +883,19 @@ function($matches) use ($spec, $prefix, $op1, $op2, $extra_spec) {
883
883
return "goto " . opcode_name ($ name , $ spec , $ op1 , $ op2 , $ extra_spec ) . "_LABEL " ;
884
884
} else {
885
885
// ZEND_VM_DISPATCH_TO_HELPER
886
+ if (is_hot_helper ($ matches [1 ])) {
887
+ if (isset ($ matches [2 ])) {
888
+ // extra args
889
+ $ args = preg_replace ("/,\s*([A-Za-z0-9_]*)\s*,\s*([^,)\s]*)\s*/ " , "$1 = $2; " , $ matches [2 ]);
890
+ return $ args . "goto " . helper_name ($ matches [1 ], $ spec , $ op1 , $ op2 , $ extra_spec ) . "_LABEL " ;
891
+ }
892
+ return "goto " . helper_name ($ matches [1 ], $ spec , $ op1 , $ op2 , $ extra_spec ) . "_LABEL " ;
893
+ }
886
894
if (isset ($ matches [2 ])) {
887
895
// extra args
888
896
$ args = substr (preg_replace ("/,\s*[A-Za-z0-9_]*\s*,\s*([^,)\s]*)\s*/ " , ", $1 " , $ matches [2 ]), 2 );
889
897
return "ZEND_VM_TAIL_CALL( " . helper_name ($ matches [1 ], $ spec , $ op1 , $ op2 , $ extra_spec ) . "( " . $ args . " ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC)) " ;
890
898
}
891
- if (is_hot_helper ($ matches [1 ])) {
892
- return "goto " . helper_name ($ matches [1 ], $ spec , $ op1 , $ op2 , $ extra_spec ) . "_LABEL " ;
893
- }
894
899
return "ZEND_VM_TAIL_CALL( " . helper_name ($ matches [1 ], $ spec , $ op1 , $ op2 , $ extra_spec ) . "(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU)) " ;
895
900
}
896
901
},
@@ -2065,14 +2070,22 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
2065
2070
out ($ f , $ m [1 ].$ executor_name .$ m [3 ]."\n" );
2066
2071
break ;
2067
2072
case "HELPER_VARS " :
2068
- if ($ kind != ZEND_VM_KIND_CALL && $ kind != ZEND_VM_KIND_HYBRID ) {
2069
- if ($ kind == ZEND_VM_KIND_SWITCH ) {
2070
- out ($ f ,$ m [1 ]."const void *dispatch_handler; \n" );
2073
+ if ($ kind == ZEND_VM_KIND_SWITCH ) {
2074
+ out ($ f ,$ m [1 ]."const void *dispatch_handler; \n" );
2075
+ }
2076
+ if ($ kind != ZEND_VM_KIND_CALL && count ($ params )) {
2077
+ if ($ kind == ZEND_VM_KIND_HYBRID ) {
2078
+ out ($ f , "#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) \n" );
2071
2079
}
2072
2080
// Emit local variables those are used for helpers' parameters
2073
2081
foreach ($ params as $ param => $ x ) {
2074
2082
out ($ f ,$ m [1 ].$ param ."; \n" );
2075
2083
}
2084
+ if ($ kind == ZEND_VM_KIND_HYBRID ) {
2085
+ out ($ f , "#endif \n" );
2086
+ }
2087
+ }
2088
+ if ($ kind != ZEND_VM_KIND_CALL && $ kind != ZEND_VM_KIND_HYBRID ) {
2076
2089
out ($ f ,"#ifdef ZEND_VM_FP_GLOBAL_REG \n" );
2077
2090
out ($ f ,$ m [1 ]."register zend_execute_data *execute_data __asm__(ZEND_VM_FP_GLOBAL_REG) = ex; \n" );
2078
2091
out ($ f ,"#else \n" );
@@ -2485,10 +2498,14 @@ function gen_vm($def, $skel) {
2485
2498
}
2486
2499
2487
2500
// Store parameters
2488
- foreach (explode (", " , $ param ) as $ p ) {
2489
- $ p = trim ($ p );
2490
- if ($ p !== "" ) {
2491
- $ params [$ p ] = 1 ;
2501
+ if (ZEND_VM_KIND == ZEND_VM_KIND_GOTO
2502
+ || ZEND_VM_KIND == ZEND_VM_KIND_SWITCH
2503
+ || (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID && $ hot )) {
2504
+ foreach (explode (", " , $ param ) as $ p ) {
2505
+ $ p = trim ($ p );
2506
+ if ($ p !== "" ) {
2507
+ $ params [$ p ] = 1 ;
2508
+ }
2492
2509
}
2493
2510
}
2494
2511
0 commit comments