File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -2374,7 +2374,8 @@ function gen_vm_opcodes_header(
2374
2374
$ str .= "\n" ;
2375
2375
$ str .= "BEGIN_EXTERN_C() \n\n" ;
2376
2376
$ str .= "ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(zend_uchar opcode); \n" ;
2377
- $ str .= "ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(zend_uchar opcode); \n\n" ;
2377
+ $ str .= "ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(zend_uchar opcode); \n" ;
2378
+ $ str .= "ZEND_API zend_uchar zend_get_opcode_id(const char *name, size_t length); \n\n" ;
2378
2379
$ str .= "END_EXTERN_C() \n\n" ;
2379
2380
2380
2381
$ code_len = strlen ((string ) $ max_opcode );
@@ -2672,6 +2673,16 @@ function gen_vm($def, $skel) {
2672
2673
fputs ($ f , "\treturn zend_vm_opcodes_flags[opcode]; \n" );
2673
2674
fputs ($ f , "} \n" );
2674
2675
2676
+ fputs ($ f , "ZEND_API zend_uchar zend_get_opcode_id(const char *name, size_t length) { \n" );
2677
+ fputs ($ f , "\tzend_uchar opcode; \n" );
2678
+ fputs ($ f , "\tfor (opcode = 0; opcode < (sizeof(zend_vm_opcodes_names) / sizeof(zend_vm_opcodes_names[0])) - 1; opcode++) { \n" );
2679
+ fputs ($ f , "\t\tif (strncmp(zend_vm_opcodes_names[opcode], name, length) == 0) { \n" );
2680
+ fputs ($ f , "\t\t\treturn opcode; \n" );
2681
+ fputs ($ f , "\t\t} \n" );
2682
+ fputs ($ f , "\t} \n" );
2683
+ fputs ($ f , "\treturn ZEND_VM_LAST_OPCODE + 1; \n" );
2684
+ fputs ($ f , "} \n" );
2685
+
2675
2686
fclose ($ f );
2676
2687
echo "zend_vm_opcodes.c generated successfully. \n" ;
2677
2688
You can’t perform that action at this time.
0 commit comments