|
|
|
@ -1181,8 +1181,8 @@ function gen_vm($def, $skel) { |
|
|
|
out($f, $GLOBALS['header_text']); |
|
|
|
|
|
|
|
fputs($f, "#ifndef ZEND_VM_OPCODES_H\n#define ZEND_VM_OPCODES_H\n\n"); |
|
|
|
fputs($f, "extern ZEND_API const char *zend_vm_opcodes_map[".($max_opcode + 1)."];\n\n"); |
|
|
|
|
|
|
|
fputs($f, "ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);\n\n"); |
|
|
|
|
|
|
|
foreach ($opcodes as $code => $dsc) { |
|
|
|
$code = str_pad((string)$code,$code_len," ",STR_PAD_LEFT); |
|
|
|
$op = str_pad($dsc["op"],$max_opcode_len); |
|
|
|
@ -1198,14 +1198,19 @@ function gen_vm($def, $skel) { |
|
|
|
|
|
|
|
// Insert header
|
|
|
|
out($f, $GLOBALS['header_text']); |
|
|
|
fputs($f,"#include <stdio.h>\n\n"); |
|
|
|
|
|
|
|
fputs($f,"#include <stdio.h>\n"); |
|
|
|
fputs($f,"#include <zend.h>\n\n"); |
|
|
|
|
|
|
|
fputs($f,"const char *zend_vm_opcodes_map[".($max_opcode + 1)."] = {\n"); |
|
|
|
for ($i = 0; $i <= $max_opcode; $i++) { |
|
|
|
fputs($f,"\t".(isset($opcodes[$i]["op"])?'"'.$opcodes[$i]["op"].'"':"NULL").",\n"); |
|
|
|
} |
|
|
|
fputs($f, "};\n"); |
|
|
|
|
|
|
|
fputs($f, "};\n\n"); |
|
|
|
|
|
|
|
fputs($f, "ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {\n"); |
|
|
|
fputs($f, "\treturn zend_vm_opcodes_map[opcode];\n"); |
|
|
|
fputs($f, "}\n"); |
|
|
|
|
|
|
|
fclose($f); |
|
|
|
echo "zend_vm_opcodes.c generated successfully.\n"; |
|
|
|
|
|
|
|
|