Re: Switch Table Extension for PHP

From: Date: Fri, 01 Aug 2008 14:54:31 +0000
Subject: Re: Switch Table Extension for PHP
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-39543@lists.php.net to get a copy of this message
The whole idea is great, but it'll work without problems only if switch-tables are constructed at compile (or optimization) time. The idea also won't work with variables and unresolved constants as "case" labels (I saw your extension already carries about this limitation). I think the proper way to implement the idea is introducing a new opcode ZEND_SWITCH which has switch table as IS_CONSTANT_ARRAY operand. Thanks. Dmitry. Stefan Esser wrote: > Hi Dmitry, > >> As you set the extended_value in shared memory to point into process >> memory the other process will read it and look into it's own memory, and >> of course it won't find proper switch-table there. > > In case the opcode cache directly uses op_array mapped in shared memory > the extension should result in a slow down because every . However it > SHOULD detect that the extended_value points to an invalid memory > address, because it checks if it points into the memory allocated. The > heap should be random enough to catch this most of the time. > > But yeah I know that there are some (potential) problems ;) That is why > it is experimental. The bigger question is however if the whole idea > fails with some switch() constructs. > > Stefan Esser

« previous php.internals (#39543) next »