zend_extension_fcall_begin_handler/zend_extension_fcall_end_handler problems

From: Date: Sun, 21 Jul 2002 08:54:03 +0000
Subject: zend_extension_fcall_begin_handler/zend_extension_fcall_end_handler problems
Groups: php.dev 
Request: Send a blank email to php-dev+get-86046@lists.php.net to get a copy of this message
hi, i'm working on some zend-extension right now (a real-time application profiler) and i need to track the function-stack. (yeh, i know - this will be part of ZE2 - but ZE2 will have the same basic problem - read on) the problem is that the extension hooks are called in a way that makes recording function calls in paramter-lists immpossible. $a = func1(func2(func3("hallo"))); will generate something like ZEND_EXT_FCALL_BEGIN // for func1 ZEND_EXT_FCALL_BEGIN // for func2 ZEND_EXT_FCALL_BEGIN // for func3 ZEND_SEND_VAL ZEND_DO_FCALL ZEND_EXT_FCALL_END // for func3 ZEND_SEND_VAR_NO_REF ZEND_DO_FCALL ZEND_EXT_FCALL_END // for func2 ZEND_SEND_VAR_NO_REF ZEND_DO_FCALL ZEND_EXT_FCALL_END // end func1 so i would record all time for func1. but the right way would be that the calls to func3 and func1 would be added to the time spend in __main as the above code is equvalent to: $a = func3("hallo"); $a = func2($a); $a = func1($a); i have digged thru this _a lot_ but there is no obvious solution. i see a few options: 1. generate the ZEND_EXT_FCALL_BEGIN and ZEND_EXT_FCALL_END _exactly_ around the actual ZEND_DO_FCALL* opcodes (but this might break existing extensions) 2. add some code that will keep al the needed data readonly in execute_data and call new callbacks (see below) around calls to zend_execute and calls to internal functions. i also like to suggest changing (or create new) the zend_llist_apply_with_argument stuff for the _EXT_ opcodes to simple indirect calls as done for zend_compile and zend_execute. that way we can easily send more parameters "down the extensions throat" and we would be faster. calling the next-extensions callback would then be the jobs of every extension. comments? tc

« previous php.dev (#86046) next »