Date: 11/03/00
- Next message: eschmid <email protected>: "[PHP-DEV] PHP 4.0 Bug #7622: Servlet API. VM crashes with session_start()"
- Previous message: snickl <email protected>: "[PHP-DEV] PHP 4.0 Bug #7618: libxml2-2.2.7 XML_GLOBAL_NAMESPACE deprecate"
- In reply to: Dan Kalowsky: "[PHP-DEV] Bizarre includes on PHP CVS build"
- Next in thread: Ron Chmara: "Re: [PHP-DEV] Bizarre includes on PHP CVS build"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I'm not 100% sure this is the right list for this, so please forgive me if
this is off topic. I originally sent it to Zeev, but I suspect hes probably
inundated with mail.
I'm currently about 80% of the way through finishing a PHP4 'compiler'
module, and have
just one or two problems left. The primary issue is with the union in the
znode structure. Basically, I'm serializing the data after the internal
compilation phase before the bytecode is passed to the executor. This works
fine, until I reach a znode, and have to decide which parts of the union to
serialize/deserialize. The op_type seems to have only 4 potential values...
IS_CONST
IS_TMP_VAR
IS_VAR
IS_UNUSED
Whilst the znode structure looks like...
typedef struct _znode {
int op_type;
union {
zval constant;
zend_uint var;
zend_uint opline_num;
zend_uint fetch_type;
zend_op_array *op_array;
struct {
zend_uint var;
zend_uint type;
} EA;
} u;
} znode;
During the serialize phase, I serialize the opcode, and for IS_CONSTANT, I
use the "zval constant" element. For TMP_VAR and VAR, I use the "zend_uint
var". I had assumed IS_UNUSED was not needed, but found it seems to hold the
target for conditionals, so saved opline_num in the case of UNUSED. However,
I'm now running into other minor problems that I suspect rely on other
elements of a znode that are not being reconstructed from the compiled
bytecode file correctly.
I'm pretty sure op_array is a pointer to the scope holder of the op_array
that this znode was 'found' in, and I can reconstruct this correctly. EA,
and fetch_type, however, elude me. So, the point of this whole email was to
ask, in what situations are these elements of the union set? Being a union,
I cannot serialize the entire block and still hope for an accurate
reconstruction. Are they unused at the end of compile time? (which is where
the my serializer is called in 'compiler' mode.), or are there other
possibilities for op_type that I've overlooked?
I'm hoping this is the last major obstacle to my finishing this project, as
it already compiles simple to medium complexity scripts without issue
(function calls, recursion, conditionals all work fine, most of the time),
and then reexecutes them on another machine from the compiled bytecode. I
obviously plan to release the patch (which is actually to the Zend engine,
hence allowing 'compliation' of any Zend driven system) as open source when
I'm happy this works correctly.
Many thanks for any help anyone could offer.
Adam Wright
adam <email protected>
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: eschmid <email protected>: "[PHP-DEV] PHP 4.0 Bug #7622: Servlet API. VM crashes with session_start()"
- Previous message: snickl <email protected>: "[PHP-DEV] PHP 4.0 Bug #7618: libxml2-2.2.7 XML_GLOBAL_NAMESPACE deprecate"
- In reply to: Dan Kalowsky: "[PHP-DEV] Bizarre includes on PHP CVS build"
- Next in thread: Ron Chmara: "Re: [PHP-DEV] Bizarre includes on PHP CVS build"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

