rfc:error-optimizations
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:error-optimizations [2010/08/22 15:20] – kalle | rfc:error-optimizations [2010/08/25 04:24] – kalle | ||
---|---|---|---|
Line 15: | Line 15: | ||
===== Implementation ===== | ===== Implementation ===== | ||
- | This RFC's implementation, | + | This RFC's implementation, |
<code c> | <code c> | ||
... | ... | ||
Line 22: | Line 22: | ||
zend_error_arguments error_stack[]; | zend_error_arguments error_stack[]; | ||
int error_stack_size: | int error_stack_size: | ||
+ | ... | ||
</ | </ | ||
- | The new structure, " | + | The new structure, " |
<code c> | <code c> | ||
Line 30: | Line 31: | ||
/* Message format */ | /* Message format */ | ||
const char *format; | const char *format; | ||
+ | |||
+ | /* Error type */ | ||
+ | const short type; | ||
/* File, and line number, if any */ | /* File, and line number, if any */ | ||
Line 47: | Line 51: | ||
zend_error_arguments arguments; | zend_error_arguments arguments; | ||
- | ... | + | /* put the data into the arguments structure */ |
if (EG(error_stack_enabled) && EG(error_stack_logging)) { | if (EG(error_stack_enabled) && EG(error_stack_logging)) { | ||
Line 54: | Line 58: | ||
if (EG(error_stack_logging)) { | if (EG(error_stack_logging)) { | ||
/* dispatch to error logging hook */ | /* dispatch to error logging hook */ | ||
+ | } else { | ||
+ | /* no logging, increase the stack size */ | ||
+ | |||
+ | ++EG(error_stack_size); | ||
} | } | ||
} else { | } else { | ||
- | | + | |
} | } | ||
</ | </ | ||
Line 66: | Line 74: | ||
<code c> | <code c> | ||
if (EG(error_stack_enabled) && EG(error_stack_size)) { | if (EG(error_stack_enabled) && EG(error_stack_size)) { | ||
- | char *error; | + | char *error |
+ | int error_length; | ||
- | /* Dispatch | + | /* dispatch |
+ | /* NOTE: This is just a pseudo function name for formatting */ | ||
+ | zend_format_error_arguments(& | ||
- | | + | |
} else { | } else { | ||
- | | + | |
} | } | ||
</ | </ | ||
+ | |||
+ | ==== $php_errormsg ==== | ||
+ | |||
+ | This one is a tricky one, as we do not have any hooks for altering variables at reading, nor do we have JIT assignments. I think the best solution here is to simply remove $php_errormsg and require userland to use error_get_last() if they *REALLY* want the last errors, without depending on the track_errors ini options to be on. | ||
+ | |||
+ | If its not removed, then we cannot gain any optimization with track_errors = On at all, so if thats the case, it has to be taken into account when initializing the error_stack executor globals. | ||
==== Memory usage ==== | ==== Memory usage ==== | ||
Line 80: | Line 97: | ||
Obvious the memory usage here can grow quite rapidly, but people who would use this feature already takes great care of their code to not assume the opposite. | Obvious the memory usage here can grow quite rapidly, but people who would use this feature already takes great care of their code to not assume the opposite. | ||
- | ===== Notes ===== | + | ==== ZTS performance |
- | * This is a very early WIP, the idea may change, or render obsolete | + | Since the error stack is hooked into the executor globals, which requires tsrm_ls to be available |
rfc/error-optimizations.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1