diff options
| author | jvoisin | 2018-03-05 17:26:41 +0100 |
|---|---|---|
| committer | GitHub | 2018-03-05 17:26:41 +0100 |
| commit | 604761cdc0c2228c48ef394158ee24c3f61bfd3f (patch) | |
| tree | 1ba9fce065caf415cb556913ad8a5ec0775d6a65 | |
| parent | 309481168de02f2dee5a4266359d72866442f665 (diff) | |
Improve performances by a significant factor
Only check if a function should be disabled when we're after a `*CALL` opcode, end not on every single opcode.
Based on @blotus ideas ♥
| -rw-r--r-- | src/sp_execute.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/sp_execute.c b/src/sp_execute.c index 1517134..bb9f64e 100644 --- a/src/sp_execute.c +++ b/src/sp_execute.c | |||
| @@ -119,8 +119,24 @@ char *get_eval_filename(const char *const filename) { | |||
| 119 | static void sp_execute_ex(zend_execute_data *execute_data) { | 119 | static void sp_execute_ex(zend_execute_data *execute_data) { |
| 120 | is_in_eval_and_whitelisted(execute_data); | 120 | is_in_eval_and_whitelisted(execute_data); |
| 121 | 121 | ||
| 122 | if (UNEXPECTED(true == should_disable(execute_data, NULL, NULL, NULL))) { | 122 | if (!execute_data) { |
| 123 | sp_terminate(); | 123 | return; |
| 124 | } else if (!execute_data->prev_execute_data || | ||
| 125 | !execute_data->prev_execute_data->func || | ||
| 126 | !ZEND_USER_CODE(execute_data->prev_execute_data->func->type) || | ||
| 127 | !execute_data->prev_execute_data->opline) { | ||
| 128 | if (UNEXPECTED(true == should_disable(execute_data, NULL, NULL, NULL))) { | ||
| 129 | sp_terminate(); | ||
| 130 | } | ||
| 131 | } else if (execute_data->prev_execute_data != NULL) { | ||
| 132 | if ((execute_data->prev_execute_data->opline->opcode == ZEND_DO_FCALL || | ||
| 133 | execute_data->prev_execute_data->opline->opcode == ZEND_DO_UCALL || | ||
| 134 | execute_data->prev_execute_data->opline->opcode == | ||
| 135 | ZEND_DO_FCALL_BY_NAME)) { | ||
| 136 | if (UNEXPECTED(true == should_disable(execute_data, NULL, NULL, NULL))) { | ||
| 137 | sp_terminate(); | ||
| 138 | } | ||
| 139 | } | ||
| 124 | } | 140 | } |
| 125 | 141 | ||
| 126 | if (UNEXPECTED(EX(func)->op_array.type == ZEND_EVAL_CODE)) { | 142 | if (UNEXPECTED(EX(func)->op_array.type == ZEND_EVAL_CODE)) { |
