summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-07-03 01:02:25 +0400
committerDmitry Stogov <dmitry@zend.com>2014-07-03 01:02:25 +0400
commit0a77dcd4b9046adb7c8f719ded19c5eff0c8976a (patch)
tree8fdd3343db9b3a7345ded20de1b20da68bcc1705 /Zend
parent63c057e3313918a800ad7faebdb648216ddba4c0 (diff)
downloadphp-git-0a77dcd4b9046adb7c8f719ded19c5eff0c8976a.tar.gz
Removed EG(in_execution). If EG(currentent_execute_data) is not NULL we are executing something.
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend.c10
-rw-r--r--Zend/zend_API.c4
-rw-r--r--Zend/zend_alloc.c2
-rw-r--r--Zend/zend_constants.c4
-rw-r--r--Zend/zend_execute_API.c3
-rw-r--r--Zend/zend_globals.h1
-rw-r--r--Zend/zend_objects.c8
-rw-r--r--Zend/zend_vm_execute.h5
-rw-r--r--Zend/zend_vm_execute.skl4
-rw-r--r--Zend/zend_vm_gen.php5
10 files changed, 19 insertions, 27 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index 68ed5c9fd1..14045914b6 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -559,7 +559,6 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS
EG(lambda_count) = 0;
ZVAL_UNDEF(&EG(user_error_handler));
ZVAL_UNDEF(&EG(user_exception_handler));
- EG(in_execution) = 0;
EG(in_autoload) = NULL;
EG(current_execute_data) = NULL;
EG(current_module) = NULL;
@@ -880,7 +879,7 @@ ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */
}
CG(unclean_shutdown) = 1;
CG(active_class_entry) = NULL;
- CG(in_compilation) = EG(in_execution) = 0;
+ CG(in_compilation) = 0;
EG(current_execute_data) = NULL;
LONGJMP(*EG(bailout), FAILURE);
}
@@ -1097,7 +1096,12 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
error_lineno = zend_get_compiled_lineno(TSRMLS_C);
} else if (zend_is_executing(TSRMLS_C)) {
error_filename = zend_get_executed_filename(TSRMLS_C);
- error_lineno = zend_get_executed_lineno(TSRMLS_C);
+ if (error_filename[0] == '[') { /* [no active file] */
+ error_filename = NULL;
+ error_lineno = 0;
+ } else {
+ error_lineno = zend_get_executed_lineno(TSRMLS_C);
+ }
} else {
error_filename = NULL;
error_lineno = 0;
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 36b615ba1b..6474fd6ad7 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -1072,7 +1072,7 @@ static int zval_update_class_constant(zval *pp, int is_static, int offset TSRMLS
{
ZVAL_DEREF(pp);
if (Z_CONSTANT_P(pp)) {
- zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry);
+ zend_class_entry **scope = EG(current_execute_data) ? &EG(scope) : &CG(active_class_entry);
if ((*scope)->parent) {
zend_class_entry *ce = *scope;
@@ -1136,7 +1136,7 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
}
if ((class_type->ce_flags & ZEND_ACC_CONSTANTS_UPDATED) == 0) {
- zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry);
+ zend_class_entry **scope = EG(current_execute_data) ? &EG(scope) : &CG(active_class_entry);
zend_class_entry *old_scope = *scope;
zval *val;
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index 1f6b62eb23..35a201b21c 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -1761,7 +1761,7 @@ static void zend_mm_safe_error(zend_mm_heap *heap,
zend_string *str = zend_get_compiled_filename(TSRMLS_C);
error_filename = str ? str->val : NULL;
error_lineno = zend_get_compiled_lineno(TSRMLS_C);
- } else if (EG(in_execution) && EG(current_execute_data)) {
+ } else if (EG(current_execute_data)) {
zend_execute_data *ex = EG(current_execute_data);
while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->type))) {
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
index 4930d1fdd4..5366845519 100644
--- a/Zend/zend_constants.c
+++ b/Zend/zend_constants.c
@@ -231,7 +231,7 @@ static zend_constant *zend_get_special_constant(const char *name, uint name_len
zend_constant *c;
static char haltoff[] = "__COMPILER_HALT_OFFSET__";
- if (!EG(in_execution)) {
+ if (!EG(current_execute_data)) {
return NULL;
} else if (name_len == sizeof("__CLASS__")-1 &&
!memcmp(name, "__CLASS__", sizeof("__CLASS__")-1)) {
@@ -354,7 +354,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
lcname = do_alloca(class_name_len + 1, use_heap);
zend_str_tolower_copy(lcname, name, class_name_len);
if (!scope) {
- if (EG(in_execution)) {
+ if (EG(current_execute_data)) {
scope = EG(scope);
} else {
scope = CG(active_class_entry);
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 7e66b64d98..dc23ff85e0 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -150,7 +150,6 @@ void init_executor(TSRMLS_D) /* {{{ */
EG(function_table) = CG(function_table);
EG(class_table) = CG(class_table);
- EG(in_execution) = 0;
EG(in_autoload) = NULL;
EG(autoload_func) = NULL;
EG(error_handling) = EH_NORMAL;
@@ -483,7 +482,7 @@ ZEND_API uint zend_get_executed_lineno(TSRMLS_D) /* {{{ */
ZEND_API zend_bool zend_is_executing(TSRMLS_D) /* {{{ */
{
- return EG(in_execution);
+ return EG(current_execute_data) != 0;
}
/* }}} */
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
index c3105ec47b..6792811003 100644
--- a/Zend/zend_globals.h
+++ b/Zend/zend_globals.h
@@ -194,7 +194,6 @@ struct _zend_executor_globals {
int ticks_count;
- zend_bool in_execution;
HashTable *in_autoload;
zend_function *autoload_func;
zend_bool full_tables_cleanup;
diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c
index 1ef0e1d7e7..af0070c5fb 100644
--- a/Zend/zend_objects.c
+++ b/Zend/zend_objects.c
@@ -77,11 +77,11 @@ ZEND_API void zend_objects_destroy_object(zend_object *object TSRMLS_DC)
if (object->ce != EG(scope)) {
zend_class_entry *ce = object->ce;
- zend_error(EG(in_execution) ? E_ERROR : E_WARNING,
+ zend_error(EG(current_execute_data) ? E_ERROR : E_WARNING,
"Call to private %s::__destruct() from context '%s'%s",
ce->name->val,
EG(scope) ? EG(scope)->name->val : "",
- EG(in_execution) ? "" : " during shutdown ignored");
+ EG(current_execute_data) ? "" : " during shutdown ignored");
return;
}
} else {
@@ -90,11 +90,11 @@ ZEND_API void zend_objects_destroy_object(zend_object *object TSRMLS_DC)
if (!zend_check_protected(zend_get_function_root_class(destructor), EG(scope))) {
zend_class_entry *ce = object->ce;
- zend_error(EG(in_execution) ? E_ERROR : E_WARNING,
+ zend_error(EG(current_execute_data) ? E_ERROR : E_WARNING,
"Call to protected %s::__destruct() from context '%s'%s",
ce->name->val,
EG(scope) ? EG(scope)->name->val : "",
- EG(in_execution) ? "" : " during shutdown ignored");
+ EG(current_execute_data) ? "" : " during shutdown ignored");
return;
}
}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index fb41fd41a3..57fb40bc13 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -337,13 +337,9 @@ static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* o
ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC)
{
DCL_OPLINE
- zend_bool original_in_execution;
- original_in_execution = EG(in_execution);
- EG(in_execution) = 1;
-
LOAD_REGS();
LOAD_OPLINE();
@@ -358,7 +354,6 @@ ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC)
if ((ret = OPLINE->handler(execute_data TSRMLS_CC)) > 0) {
switch (ret) {
case 1:
- EG(in_execution) = original_in_execution;
return;
case 2:
case 3:
diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl
index 41a834de95..656c0fcd9e 100644
--- a/Zend/zend_vm_execute.skl
+++ b/Zend/zend_vm_execute.skl
@@ -3,15 +3,11 @@
ZEND_API void {%EXECUTOR_NAME%}_ex(zend_execute_data *execute_data TSRMLS_DC)
{
DCL_OPLINE
- zend_bool original_in_execution;
{%HELPER_VARS%}
{%INTERNAL_LABELS%}
- original_in_execution = EG(in_execution);
- EG(in_execution) = 1;
-
LOAD_REGS();
LOAD_OPLINE();
diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php
index bdc6cc79b8..b0a642084d 100644
--- a/Zend/zend_vm_gen.php
+++ b/Zend/zend_vm_gen.php
@@ -941,7 +941,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
out($f,"#define LOAD_REGS()\n");
out($f,"#define ZEND_VM_CONTINUE() goto zend_vm_continue\n");
- out($f,"#define ZEND_VM_RETURN() EG(in_execution) = original_in_execution; return\n");
+ out($f,"#define ZEND_VM_RETURN() return\n");
out($f,"#define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n");
out($f,"#define ZEND_VM_DISPATCH(opcode, opline) dispatch_handler = zend_vm_get_opcode_handler(opcode, opline); goto zend_vm_dispatch;\n\n");
@@ -973,7 +973,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
}
out($f,"#define LOAD_REGS()\n");
out($f,"#define ZEND_VM_CONTINUE() goto *(void**)(OPLINE->handler)\n");
- out($f,"#define ZEND_VM_RETURN() EG(in_execution) = original_in_execution; return\n");
+ out($f,"#define ZEND_VM_RETURN() return\n");
out($f,"#define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n");
out($f,"#define ZEND_VM_DISPATCH(opcode, opline) goto *(void**)(zend_vm_get_opcode_handler(opcode, opline));\n\n");
@@ -1043,7 +1043,6 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
// Executor is defined as a set of functions
out($f, $m[1]."switch (ret) {\n" .
$m[1]."\tcase 1:\n" .
- $m[1]."\t\tEG(in_execution) = original_in_execution;\n".
$m[1]."\t\treturn;\n".
$m[1]."\tcase 2:\n" .
$m[1]."\tcase 3:\n" .