-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Introduce zend_vm_opcode_handler_t / zend_vm_opcode_handler_func_t #19006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1813,11 +1813,11 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name) | |
out($f,"#define SPEC_RULE_OBSERVER 0x02000000\n"); | ||
out($f,"\n"); | ||
out($f,"static const uint32_t *zend_spec_handlers;\n"); | ||
out($f,"static const void * const *zend_opcode_handlers;\n"); | ||
out($f,"static zend_vm_opcode_handler_t const *zend_opcode_handlers;\n"); | ||
out($f,"static int zend_handlers_count;\n"); | ||
if ($kind == ZEND_VM_KIND_HYBRID) { | ||
out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n"); | ||
out($f,"static const void * const * zend_opcode_handler_funcs;\n"); | ||
out($f,"static zend_vm_opcode_handler_func_t const * zend_opcode_handler_funcs;\n"); | ||
out($f,"static zend_op hybrid_halt_op;\n"); | ||
out($f,"#endif\n"); | ||
} | ||
|
@@ -2097,7 +2097,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name) | |
out($f,$prolog."\tstatic const void * const labels[] = {\n"); | ||
gen_labels($f, $spec, ($kind == ZEND_VM_KIND_HYBRID) ? ZEND_VM_KIND_GOTO : $kind, $prolog."\t\t", $specs); | ||
out($f,$prolog."\t};\n"); | ||
out($f,$prolog."\tzend_opcode_handlers = (const void **) labels;\n"); | ||
out($f,$prolog."\tzend_opcode_handlers = (zend_vm_opcode_handler_t*) labels;\n"); | ||
out($f,$prolog."\tzend_handlers_count = sizeof(labels) / sizeof(void*);\n"); | ||
if ($kind == ZEND_VM_KIND_HYBRID) { | ||
out($f,$prolog."\tmemset(&hybrid_halt_op, 0, sizeof(hybrid_halt_op));\n"); | ||
|
@@ -2212,7 +2212,11 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name) | |
out($f,$prolog."zend_spec_handlers = specs;\n"); | ||
out($f,$prolog.$executor_name."_ex(NULL);\n"); | ||
} else { | ||
out($f,$prolog."static const void * const labels[] = {\n"); | ||
out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n"); | ||
out($f,$prolog."static zend_vm_opcode_handler_func_t const labels[] = {\n"); | ||
out($f,"#else\n"); | ||
out($f,$prolog."static zend_vm_opcode_handler_t const labels[] = {\n"); | ||
out($f,"#endif\n"); | ||
gen_labels($f, $spec, ($kind == ZEND_VM_KIND_HYBRID) ? ZEND_VM_KIND_CALL : $kind, $prolog."\t", $specs, $switch_labels); | ||
out($f,$prolog."};\n"); | ||
out($f,$prolog."static const uint32_t specs[] = {\n"); | ||
|
@@ -2359,6 +2363,17 @@ function gen_vm_opcodes_header( | |
$str .= "# endif\n"; | ||
$str .= "#endif\n"; | ||
$str .= "\n"; | ||
$str .= "#if ZEND_VM_KIND == ZEND_VM_KIND_HYBRID\n"; | ||
$str .= "typedef const void* zend_vm_opcode_handler_t;\n"; | ||
$str .= "typedef void (ZEND_FASTCALL *zend_vm_opcode_handler_func_t)(void);\n"; | ||
$str .= "#elif ZEND_VM_KIND == ZEND_VM_KIND_CALL\n"; | ||
$str .= "typedef const struct _zend_op *(ZEND_FASTCALL *zend_vm_opcode_handler_t)(struct _zend_execute_data *execute_data, const struct _zend_op *opline);\n"; | ||
$str .= "typedef const struct _zend_op *(ZEND_FASTCALL *zend_vm_opcode_handler_func_t)(struct _zend_execute_data *execute_data, const struct _zend_op *opline);\n"; | ||
$str .= "#else\n"; | ||
$str .= "typedef const void* zend_vm_opcode_handler_t;\n"; | ||
$str .= "typedef const void* zend_vm_opcode_handler_func_t;\n"; | ||
Comment on lines
+2372
to
+2374
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose |
||
$str .= "#endif\n"; | ||
$str .= "\n"; | ||
foreach ($vm_op_flags as $name => $val) { | ||
$str .= sprintf("#define %-24s 0x%08x\n", $name, $val); | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments that explain the conceptual difference for all VM types would be helpful.