Skip to content
Browse files

* 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
  • Loading branch information...
1 parent 1652802 commit 1250c43a39cb562659076859bcf7c77260e45ffd @zsuraski zsuraski committed May 22, 1999
View
2 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;}
View
4 Zend/zend-scanner.h
@@ -30,7 +30,7 @@ class ZendFlexLexer : public yyFlexLexer
#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;
View
12 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,22 +91,22 @@ 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;
} zend_property_reference;
-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;
View
4 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
}
View
2 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;
View
11 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;
}
View
15 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 */
View
2 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;
View
3 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:
View
2 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 {
View
18 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);
+ */
}
View
2 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;
View
2 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;
View
4 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;
View
2 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;
View
2 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;
View
2 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;

0 comments on commit 1250c43

Please sign in to comment.
Something went wrong with that request. Please try again.