summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>1999-05-22 16:10:51 +0000
committerZeev Suraski <zeev@php.net>1999-05-22 16:10:51 +0000
commit1250c43a39cb562659076859bcf7c77260e45ffd (patch)
tree082c64d5b12b875659a5fd416c77a4cb959dd54d
parent165280264178a9b561eac1e4b5985e0649c906a2 (diff)
downloadphp-git-1250c43a39cb562659076859bcf7c77260e45ffd.tar.gz
* Add struct name to all typedef's so that they can be debugged with MSVC
* Fix an AiCount bug - list(...) = $var was using $var multiple times, and thus causing AiCount to be decreased multiple times even though it was increased only once for $var. Mark all FETCH_DIM's so that they won't decrease AiCount, and only decrease AiCount on the last FETCH_DIM. * Fix a stupid bug - forgot to pass CLS_C to some compiler function. For some reason MSVC doesn't report these :I
-rw-r--r--Zend/zend-parser.y2
-rw-r--r--Zend/zend-scanner.h4
-rw-r--r--Zend/zend.h12
-rw-r--r--Zend/zend_alloc.c4
-rw-r--r--Zend/zend_alloc.h2
-rw-r--r--Zend/zend_compile.c11
-rw-r--r--Zend/zend_compile.h15
-rw-r--r--Zend/zend_constants.h2
-rw-r--r--Zend/zend_execute.c3
-rw-r--r--Zend/zend_execute.h2
-rw-r--r--Zend/zend_execute_API.c18
-rw-r--r--Zend/zend_extensions.h2
-rw-r--r--Zend/zend_highlight.h2
-rw-r--r--Zend/zend_list.h4
-rw-r--r--Zend/zend_llist.h2
-rw-r--r--Zend/zend_ptr_stack.h2
-rw-r--r--Zend/zend_stack.h2
17 files changed, 54 insertions, 35 deletions
diff --git a/Zend/zend-parser.y b/Zend/zend-parser.y
index 7d338c97e2..2e285ff734 100644
--- a/Zend/zend-parser.y
+++ b/Zend/zend-parser.y
@@ -362,7 +362,7 @@ for_expr:
expr_without_variable:
- T_LIST '(' { do_list_init(); } assignment_list ')' '=' expr { do_list_end(&$$, &$7 CLS_CC); }
+ T_LIST '(' { do_list_init(CLS_C); } assignment_list ')' '=' expr { do_list_end(&$$, &$7 CLS_CC); }
| w_cvar '=' expr { do_assign(&$$, &$1, &$3 CLS_CC); }
| w_cvar '=' '&' w_cvar { do_assign_ref(&$$, &$1, &$4 CLS_CC); }
| w_cvar '=' T_NEW class_name { do_extended_fcall_begin(CLS_C); do_begin_new_object(&$2, &$1, &$3, &$4 CLS_CC); } ctor_arguments { do_end_new_object(&$4, &$3, &$6 CLS_CC); do_extended_fcall_end(CLS_C); $$ = $2;}
diff --git a/Zend/zend-scanner.h b/Zend/zend-scanner.h
index bdc1ee9f06..283862c07e 100644
--- a/Zend/zend-scanner.h
+++ b/Zend/zend-scanner.h
@@ -30,7 +30,7 @@ public:
#ifndef ZTS
-typedef struct {
+typedef struct _zend_lex_state {
YY_BUFFER_STATE buffer_state;
int state;
uint return_offset;
@@ -39,7 +39,7 @@ typedef struct {
char *filename;
} zend_lex_state;
#else
-typedef struct {
+typedef struct _zend_lex_state {
ZendFlexLexer *ZFL;
istream *input_file;
} zend_lex_state;
diff --git a/Zend/zend.h b/Zend/zend.h
index 4318c5dd21..a0e375e53b 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -65,7 +65,7 @@
typedef struct _zval_struct zval;
typedef struct _zend_class_entry zend_class_entry;
-typedef union {
+typedef union _zvalue_value {
long lval; /* long value */
double dval; /* double value */
struct {
@@ -91,14 +91,14 @@ struct _zval_struct {
-typedef struct {
+typedef struct _zend_function_entry {
char *fname;
void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
unsigned char *func_arg_types;
} zend_function_entry;
-typedef struct {
+typedef struct _zend_property_reference {
int type; /* read, write or r/w */
zval **object;
zend_llist elements_list;
@@ -106,7 +106,7 @@ typedef struct {
-typedef struct {
+typedef struct _zend_overloaded_element {
int type; /* array offset or object proprety */
zval element;
} zend_overloaded_element;
@@ -130,7 +130,7 @@ struct _zend_class_entry {
-typedef struct {
+typedef struct _zend_utility_functions {
void (*error_function)(int type, const char *format, ...);
int (*printf_function)(const char *format, ...);
int (*write_function)(const char *str, uint str_length);
@@ -141,7 +141,7 @@ typedef struct {
} zend_utility_functions;
-typedef struct {
+typedef struct _zend_utility_values {
unsigned char short_tags;
unsigned char asp_tags;
} zend_utility_values;
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index d54f00608b..917f4949a3 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -357,7 +357,7 @@ ZEND_API void shutdown_memory_manager(int silent, int clean_cache)
/* flush old leak */
if (leak_count>0) {
if (!silent && leak_count>1) {
- zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *) leak_count-1);
+ zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *) (leak_count-1));
}
leak_count=0;
total_bytes=0;
@@ -382,7 +382,7 @@ ZEND_API void shutdown_memory_manager(int silent, int clean_cache)
}
#if ZEND_DEBUG
if (!silent && leak_count>1) {
- zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *) leak_count-1);
+ zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *) (leak_count-1));
}
#endif
}
diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h
index 161c4685f4..2c3b074cdd 100644
--- a/Zend/zend_alloc.h
+++ b/Zend/zend_alloc.h
@@ -37,7 +37,7 @@ typedef struct _mem_header {
unsigned int cached:1;
} mem_header;
-typedef union {
+typedef union _align_test {
void *ptr;
double dbl;
long lng;
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index f13d3b07d1..5224033258 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -216,6 +216,7 @@ void fetch_array_dim(znode *result, znode *parent, znode *dim CLS_DC)
opline->result.u.var = get_temporary_variable(CG(active_op_array));
opline->op1 = *parent;
opline->op2 = *dim;
+ opline->extended_value = ZEND_FETCH_STANDARD;
*result = opline->result;
zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
@@ -1435,7 +1436,7 @@ void do_add_list_element(znode *element CLS_DC)
{
list_llist_element lle;
- if(element) {
+ if (element) {
lle.var = *element;
zend_llist_copy(&lle.dimensions, &CG(dimension_llist));
zend_llist_add_element(&CG(list_llist), &lle);
@@ -1453,7 +1454,6 @@ void do_new_list_begin(CLS_D)
void do_new_list_end(CLS_D)
{
-
zend_llist_remove_tail(&CG(dimension_llist));
(*((int *)CG(dimension_llist).tail->data))++;
}
@@ -1503,6 +1503,11 @@ void do_list_end(znode *result, znode *expr CLS_DC)
opline->op2.u.constant.value.lval = *((int *) dimension->data);
opline->op2.u.constant.refcount = 1;
opline->op2.u.constant.is_ref = 0;
+ if (le == CG(list_llist).tail) {
+ opline->extended_value = ZEND_FETCH_STANDARD;
+ } else {
+ opline->extended_value = ZEND_FETCH_NO_AI_COUNT;
+ }
last_container = opline->result;
dimension = dimension->next;
}
@@ -1682,6 +1687,7 @@ void do_foreach_cont(znode *value, znode *key, znode *as_token CLS_DC)
opline->op2.op_type = IS_CONST;
opline->op2.u.constant.type = IS_LONG;
opline->op2.u.constant.value.lval = 0;
+ opline->extended_value = ZEND_FETCH_STANDARD; /* ignored in fetch_dim_tmp_var, but what the hell. */
result_value = opline->result;
if (key->op_type != IS_UNUSED) {
@@ -1694,6 +1700,7 @@ void do_foreach_cont(znode *value, znode *key, znode *as_token CLS_DC)
opline->op2.op_type = IS_CONST;
opline->op2.u.constant.type = IS_LONG;
opline->op2.u.constant.value.lval = 1;
+ opline->extended_value = ZEND_FETCH_STANDARD; /* ignored in fetch_dim_tmp_var, but what the hell. */
result_key = opline->result;
}
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index f2ea910f07..e48acf4f2f 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -51,7 +51,7 @@
typedef struct _zend_op_array zend_op_array;
-typedef struct {
+typedef struct _znode {
int op_type;
union {
zval constant;
@@ -78,7 +78,7 @@ typedef struct _zend_op {
} zend_op;
-typedef struct {
+typedef struct _zend_brk_cont_element {
int cont;
int brk;
int parent;
@@ -117,7 +117,7 @@ struct _zend_op_array {
};
-typedef struct {
+typedef struct _zend_internal_function {
int type; /* MUST be the first element of this struct! */
unsigned char *arg_types; /* MUST be the second element of this struct */
@@ -127,7 +127,7 @@ typedef struct {
} zend_internal_function;
-typedef union {
+typedef union _zend_function {
int type; /* MUST be the first element of this struct! */
struct {
int type; /* never used */
@@ -146,14 +146,14 @@ typedef struct _zend_function_state {
} zend_function_state;
-typedef struct {
+typedef struct _zend_switch_entry {
znode cond;
int default_case;
int control_var;
} zend_switch_entry;
-typedef struct {
+typedef struct _list_llist_element {
znode var;
zend_llist dimensions;
znode value;
@@ -532,4 +532,7 @@ int zendlex(znode *zendlval CLS_DC);
#define ZEND_DECLARE_CLASS 1
#define ZEND_DECLARE_FUNCTION 2
+#define ZEND_FETCH_STANDARD 0
+#define ZEND_FETCH_NO_AI_COUNT 1
+
#endif /* _COMPILE_H */
diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h
index f7c85476f1..d36ae6ba61 100644
--- a/Zend/zend_constants.h
+++ b/Zend/zend_constants.h
@@ -22,7 +22,7 @@
#define CONST_CS 0x1 /* Case Sensitive */
#define CONST_PERSISTENT 0x2
-typedef struct {
+typedef struct _zend_constant {
zval value;
int flags;
char *name;
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 37aa6400a5..48cd850255 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1041,6 +1041,9 @@ binary_assign_op_addr: {
zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_IS ELS_CC);
break;
case ZEND_FETCH_DIM_R:
+ if (opline->extended_value == ZEND_FETCH_NO_AI_COUNT) {
+ EG(AiCount)++;
+ }
zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC);
break;
case ZEND_FETCH_DIM_W:
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index fc70585b14..2d88207f73 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -20,7 +20,7 @@
#include "zend_compile.h"
#include "zend_hash.h"
-typedef union {
+typedef union _temp_variable {
zval tmp_var;
zval **var;
struct {
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 526b965906..9e8b51ec10 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -37,13 +37,19 @@ static void zend_handle_sigsegv(int dummy)
fflush(stdout);
fflush(stderr);
signal(SIGSEGV, original_sigsegv_handler);
- fprintf(stderr, "SIGSEGV caught on opcode %d on opline %d of %s() at %s:%d\n\n",
- active_opline->opcode,
- active_opline-EG(active_op_array)->opcodes,
- get_active_function_name(),
- zend_get_executed_filename(),
- zend_get_executed_lineno());
+ /*
+ {
+ ELS_FETCH();
+
+ fprintf(stderr, "SIGSEGV caught on opcode %d on opline %d of %s() at %s:%d\n\n",
+ active_opline->opcode,
+ active_opline-EG(active_op_array)->opcodes,
+ get_active_function_name(),
+ zend_get_executed_filename(ELS_C),
+ zend_get_executed_lineno(ELS_C));
+ }
original_sigsegv_handler(dummy);
+ */
}
diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h
index 9c11942bc1..7ecb83afed 100644
--- a/Zend/zend_extensions.h
+++ b/Zend/zend_extensions.h
@@ -21,7 +21,7 @@
#define ZEND_EXTENSION_API_NO 2
-typedef struct {
+typedef struct _zend_extension_version_info {
int zend_extension_api_no;
char *required_zend_version;
unsigned char thread_safe;
diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h
index 00b576a186..505022a2df 100644
--- a/Zend/zend_highlight.h
+++ b/Zend/zend_highlight.h
@@ -25,7 +25,7 @@
#define HL_KEYWORD_COLOR "#007700" /* green */
-typedef struct {
+typedef struct _zend_syntax_highlighter_ini {
char *highlight_html;
char *highlight_comment;
char *highlight_default;
diff --git a/Zend/zend_list.h b/Zend/zend_list.h
index da9d71bd96..796e1e836e 100644
--- a/Zend/zend_list.h
+++ b/Zend/zend_list.h
@@ -22,13 +22,13 @@
extern HashTable list_destructors;
-typedef struct {
+typedef struct _list_entry {
void *ptr;
int type;
int refcount;
} list_entry;
-typedef struct {
+typedef struct _list_destructors_entry {
void (*list_destructor)(void *);
void (*plist_destructor)(void *);
int module_number;
diff --git a/Zend/zend_llist.h b/Zend/zend_llist.h
index dd5bedb6bf..d25ff0e7b5 100644
--- a/Zend/zend_llist.h
+++ b/Zend/zend_llist.h
@@ -25,7 +25,7 @@ typedef struct _zend_llist_element {
char data[1]; /* Needs to always be last in the struct */
} zend_llist_element;
-typedef struct {
+typedef struct _zend_llist {
zend_llist_element *head;
zend_llist_element *tail;
size_t size;
diff --git a/Zend/zend_ptr_stack.h b/Zend/zend_ptr_stack.h
index 15f59de293..ac47b0f7cb 100644
--- a/Zend/zend_ptr_stack.h
+++ b/Zend/zend_ptr_stack.h
@@ -18,7 +18,7 @@
#ifndef _ZEND_PTR_STACK_H
#define _ZEND_PTR_STACK_H
-typedef struct {
+typedef struct _zend_ptr_stack {
short top, max;
void **elements;
void **top_element;
diff --git a/Zend/zend_stack.h b/Zend/zend_stack.h
index abd3652529..55da44c7bf 100644
--- a/Zend/zend_stack.h
+++ b/Zend/zend_stack.h
@@ -17,7 +17,7 @@
#ifndef _ZEND_STACK_H
#define _ZEND_STACK_H
-typedef struct {
+typedef struct _zend_stack {
int top, max;
void **elements;
} zend_stack;