cvs: pecl /bcompiler bcompiler.c php_bcompiler.h
| From: | val khokhlov | Date: | Wed, 06 Apr 2005 09:04:38 +0000 |
| Subject: | cvs: pecl /bcompiler bcompiler.c php_bcompiler.h | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-2931@lists.php.net to get a copy of this message | ||
val Wed Apr 6 05:04:38 2005 EDT
Modified files:
/pecl/bcompiler bcompiler.c php_bcompiler.h
Log:
fix a bug with not serializing a EA.type for IS_NULL constants (might result in "undefined
variable" notice)
http://cvs.php.net/diff.php/pecl/bcompiler/bcompiler.c?r1=1.84&r2=1.85&ty=u
Index: pecl/bcompiler/bcompiler.c
diff -u pecl/bcompiler/bcompiler.c:1.84 pecl/bcompiler/bcompiler.c:1.85
--- pecl/bcompiler/bcompiler.c:1.84 Wed Apr 6 03:54:46 2005
+++ pecl/bcompiler/bcompiler.c Wed Apr 6 05:04:37 2005
@@ -20,7 +20,7 @@
| Mike Bretz <mike@metropolis-ag.de> |
+----------------------------------------------------------------------+
*/
-/* $Id: bcompiler.c,v 1.84 2005/04/06 07:54:46 val Exp $ */
+/* $Id: bcompiler.c,v 1.85 2005/04/06 09:04:37 val Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -65,11 +65,11 @@
/* Bytecode version parameters */
#if defined(ZEND_ENGINE_2_1)
-#define BCOMPILER_CUR_VER 0x0007 /* current bytecode version: 0.7 */
-#define BCOMPILER_CAN_READ 7 /* can read bytecodes: 0.7 */
+#define BCOMPILER_CUR_VER 0x0009 /* current bytecode version: 0.9 */
+#define BCOMPILER_CAN_READ 7, 9 /* can read bytecodes: 0.7, 0.9 */
#elif defined(ZEND_ENGINE_2)
-#define BCOMPILER_CUR_VER 0x0006 /* current bytecode version: 0.6 */
-#define BCOMPILER_CAN_READ 4, 6 /* can read bytecodes: 0.4, 0.6 */
+#define BCOMPILER_CUR_VER 0x0008 /* current bytecode version: 0.9 */
+#define BCOMPILER_CAN_READ 4, 6, 8 /* can read bytecodes: 0.4, 0.6, 0.8 */
#else
#define BCOMPILER_CUR_VER 0x0005 /* current bytecode version: 0.5 */
#define BCOMPILER_CAN_READ 3, 5 /* can read bytecodes: 0.3, 0.5 */
@@ -2247,7 +2247,7 @@
/* type: zvalue_value */
-void apc_serialize_zvalue_value(zvalue_value* zv, int type TSRMLS_DC)
+void apc_serialize_zvalue_value(zvalue_value* zv, int type, znode *zn TSRMLS_DC)
{
/* A zvalue_value is a union, and as such we first need to
* determine exactly what it's type is, then serialize the
@@ -2267,6 +2267,13 @@
break;
case IS_NULL:
/* null value - it's used for temp_vars */
+#if defined(ZEND_ENGINE_2) || defined(ZEND_ENGINE_2_1)
+ if (zn && BCOMPILERG(current_write) >= 0x0008) {
+ SERIALIZE_SCALAR(zn->u.EA.var, zend_uint);
+ SERIALIZE_SCALAR(zn->u.EA.type, zend_uint);
+ }
+ break;
+#endif
if (BCOMPILERG(current_write) >= 0x0005) SERIALIZE_SCALAR(zv->lval, long);
break;
case IS_CONSTANT:
@@ -2302,7 +2309,7 @@
}
}
-void apc_deserialize_zvalue_value(zvalue_value* zv, int type TSRMLS_DC)
+void apc_deserialize_zvalue_value(zvalue_value* zv, int type, znode *zn TSRMLS_DC)
{
/* We peeked ahead in the calling routine to deserialize the
* type. Now we just deserialize. */
@@ -2315,6 +2322,13 @@
break;
case IS_NULL:
/* null value - it's used for temp_vars */
+#if defined(ZEND_ENGINE_2) || defined(ZEND_ENGINE_2_1)
+ if (zn && BCOMPILERG(current_version) >= 0x0008) {
+ DESERIALIZE_SCALAR(&zn->u.EA.var, zend_uint);
+ DESERIALIZE_SCALAR(&zn->u.EA.type, zend_uint);
+ }
+ break;
+#endif
if (BCOMPILERG(current_version) >= 0x0005) DESERIALIZE_SCALAR(&zv->lval, int);
break;
case IS_DOUBLE:
@@ -2352,25 +2366,25 @@
void apc_serialize_zval_ptr(zval** zv TSRMLS_DC)
{
- apc_serialize_zval(*zv TSRMLS_CC);
+ apc_serialize_zval(*zv, NULL TSRMLS_CC);
}
-void apc_serialize_zval(zval* zv TSRMLS_DC)
+void apc_serialize_zval(zval* zv, znode *zn TSRMLS_DC)
{
/* type is the switch for serializing zvalue_value */
SERIALIZE_SCALAR(zv->type, zend_uchar);
- apc_serialize_zvalue_value(&zv->value, zv->type TSRMLS_CC);
+ apc_serialize_zvalue_value(&zv->value, zv->type, zn TSRMLS_CC);
SERIALIZE_SCALAR(zv->is_ref, zend_uchar);
SERIALIZE_SCALAR(zv->refcount, zend_ushort);
}
-void apc_deserialize_zval(zval* zv TSRMLS_DC)
+void apc_deserialize_zval(zval* zv, znode *zn TSRMLS_DC)
{
/* type is the switch for deserializing zvalue_value */
DESERIALIZE_SCALAR(&zv->type, zend_uchar);
- apc_deserialize_zvalue_value(&zv->value, zv->type TSRMLS_CC);
+ apc_deserialize_zvalue_value(&zv->value, zv->type, zn TSRMLS_CC);
DESERIALIZE_SCALAR(&zv->is_ref, zend_uchar);
DESERIALIZE_SCALAR(&zv->refcount, zend_ushort);
}
@@ -2378,7 +2392,7 @@
void apc_create_zval(zval** zv TSRMLS_DC)
{
*zv = (zval*) emalloc(sizeof(zval));
- apc_deserialize_zval(*zv TSRMLS_CC);
+ apc_deserialize_zval(*zv, NULL TSRMLS_CC);
}
void apc_free_zval(zval** zv TSRMLS_DC)
{
@@ -2478,14 +2492,14 @@
void apc_serialize_zend_property_reference(zend_property_reference* zpr TSRMLS_DC)
{
SERIALIZE_SCALAR(zpr->type, int);
- apc_serialize_zval(zpr->object TSRMLS_CC);
+ apc_serialize_zval(zpr->object, NULL TSRMLS_CC);
apc_serialize_zend_llist(zpr->elements_list TSRMLS_CC);
}
void apc_deserialize_zend_property_reference(zend_property_reference* zpr TSRMLS_DC)
{
DESERIALIZE_SCALAR(&zpr->type, int);
- apc_deserialize_zval(zpr->object TSRMLS_CC);
+ apc_deserialize_zval(zpr->object, NULL TSRMLS_CC);
apc_create_zend_llist(&zpr->elements_list TSRMLS_CC);
}
#endif
@@ -2496,13 +2510,13 @@
void apc_serialize_zend_overloaded_element(zend_overloaded_element* zoe TSRMLS_DC)
{
SERIALIZE_SCALAR(zoe->type, zend_uchar);
- apc_serialize_zval(&zoe->element TSRMLS_CC);
+ apc_serialize_zval(&zoe->element, NULL TSRMLS_CC);
}
void apc_deserialize_zend_overloaded_element(zend_overloaded_element* zoe TSRMLS_DC)
{
DESERIALIZE_SCALAR(&zoe->type, zend_uchar);
- apc_deserialize_zval(&zoe->element TSRMLS_CC);
+ apc_deserialize_zval(&zoe->element, NULL TSRMLS_CC);
}
#endif
@@ -2860,10 +2874,10 @@
switch(zn->op_type) {
case IS_CONST:
-
- apc_serialize_zval(&zn->u.constant TSRMLS_CC);
+
+ apc_serialize_zval(&zn->u.constant, zn TSRMLS_CC);
break;
-
+
case IS_VAR:
case IS_TMP_VAR:
case IS_UNUSED:
@@ -2891,7 +2905,7 @@
switch(zn->op_type)
{
case IS_CONST:
- apc_deserialize_zval(&zn->u.constant TSRMLS_CC);
+ apc_deserialize_zval(&zn->u.constant, zn TSRMLS_CC);
break;
default:
/* make zn->u's size-safe */
@@ -3531,7 +3545,7 @@
void apc_serialize_zend_constant(zend_constant* zc TSRMLS_DC)
{
- apc_serialize_zval(&zc->value TSRMLS_CC);
+ apc_serialize_zval(&zc->value, NULL TSRMLS_CC);
SERIALIZE_SCALAR(zc->flags, int);
apc_serialize_string(zc->name TSRMLS_CC);
BCOMPILER_DEBUG(("serializing constant %s\n",zc->name));
@@ -3541,7 +3555,7 @@
void apc_deserialize_zend_constant(zend_constant* zc TSRMLS_DC)
{
- apc_deserialize_zval(&zc->value TSRMLS_CC);
+ apc_deserialize_zval(&zc->value, NULL TSRMLS_CC);
DESERIALIZE_SCALAR(&zc->flags, int);
apc_create_string(&zc->name TSRMLS_CC);
BCOMPILER_DEBUG(("deserializing constant %s\n",zc->name));
http://cvs.php.net/diff.php/pecl/bcompiler/php_bcompiler.h?r1=1.21&r2=1.22&ty=u
Index: pecl/bcompiler/php_bcompiler.h
diff -u pecl/bcompiler/php_bcompiler.h:1.21 pecl/bcompiler/php_bcompiler.h:1.22
--- pecl/bcompiler/php_bcompiler.h:1.21 Thu Oct 21 10:48:54 2004
+++ pecl/bcompiler/php_bcompiler.h Wed Apr 6 05:04:37 2005
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_bcompiler.h,v 1.21 2004/10/21 14:48:54 val Exp $ */
+/* $Id: php_bcompiler.h,v 1.22 2005/04/06 09:04:37 val Exp $ */
#include "ext/standard/file.h"
#ifndef PHP_BCOMPILER_H
@@ -136,13 +136,13 @@
/* routines for handling structures from zend.h */
-void apc_serialize_zvalue_value(zvalue_value* zvv, int type TSRMLS_DC);
-void apc_deserialize_zvalue_value(zvalue_value* zvv, int type TSRMLS_DC);
+void apc_serialize_zvalue_value(zvalue_value* zvv, int type, znode *zn TSRMLS_DC);
+void apc_deserialize_zvalue_value(zvalue_value* zvv, int type, znode *zn TSRMLS_DC);
void apc_serialize_zval_ptr(zval** zv TSRMLS_DC);
-void apc_serialize_zval(zval* zv TSRMLS_DC);
-void apc_deserialize_zval(zval* zv TSRMLS_DC);
+void apc_serialize_zval(zval* zv, znode *zn TSRMLS_DC);
+void apc_deserialize_zval(zval* zv, znode *zn TSRMLS_DC);
void apc_create_zval(zval** zv TSRMLS_DC);
void apc_free_zval(zval** zv TSRMLS_DC);