Skip to content

Commit b4f3b9d

Browse files
committed
Redesigned thread safety mechanism - nua nua
1 parent 633a1c3 commit b4f3b9d

23 files changed

+699
-741
lines changed

Zend/Zend.dsp

Lines changed: 8 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Zend/ZendTS.dsp

Lines changed: 10 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Zend/zend.c

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ static void register_standard_class(void)
250250
}
251251

252252

253-
static void zend_set_default_compile_time_values(CLS_D)
253+
static void zend_set_default_compile_time_values(TSRMLS_D)
254254
{
255255
/* default compile-time values */
256256
CG(asp_tags) = 0;
@@ -276,7 +276,7 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS
276276
zend_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
277277
zend_hash_copy(compiler_globals->class_table, global_class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry));
278278

279-
zend_set_default_compile_time_values(CLS_C);
279+
zend_set_default_compile_time_values(TSRMLS_C);
280280

281281
CG(interactive) = 0;
282282
}
@@ -316,9 +316,9 @@ static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS
316316
}
317317

318318

319-
static void alloc_globals_ctor(zend_alloc_globals *alloc_globals TSRMLS_DC)
319+
static void alloc_globals_ctor(zend_alloc_globals *alloc_globals_p TSRMLS_DC)
320320
{
321-
start_memory_manager(ALS_C);
321+
start_memory_manager(TSRMLS_C);
322322
}
323323

324324
#endif
@@ -348,7 +348,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
348348

349349
ts_allocate_id(&alloc_globals_id, sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, NULL);
350350
#else
351-
start_memory_manager(ALS_C);
351+
start_memory_manager(TSRMLS_C);
352352
#endif
353353

354354
#ifdef __FreeBSD__
@@ -406,7 +406,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
406406
GLOBAL_CONSTANTS_TABLE = EG(zend_constants);
407407
#else
408408
zend_startup_constants();
409-
zend_set_default_compile_time_values(CLS_C);
409+
zend_set_default_compile_time_values(TSRMLS_C);
410410
EG(user_error_handler) = NULL;
411411
#endif
412412
zend_register_standard_constants(TSRMLS_C);
@@ -468,7 +468,6 @@ void zenderror(char *error)
468468
BEGIN_EXTERN_C()
469469
ZEND_API void _zend_bailout(char *filename, uint lineno)
470470
{
471-
CLS_FETCH();
472471
TSRMLS_FETCH();
473472

474473
if (!EG(bailout_set)) {
@@ -510,12 +509,12 @@ ZEND_API char *get_zend_version()
510509
}
511510

512511

513-
void zend_activate(CLS_D TSRMLS_DC)
512+
void zend_activate(TSRMLS_D)
514513
{
515514
EG(bailout_set) = 0;
516-
init_compiler(CLS_C TSRMLS_CC);
517-
init_executor(CLS_C TSRMLS_CC);
518-
startup_scanner(CLS_C);
515+
init_compiler(TSRMLS_C);
516+
init_executor(TSRMLS_C);
517+
startup_scanner(TSRMLS_C);
519518
}
520519

521520

@@ -534,21 +533,21 @@ void zend_deactivate_modules()
534533
} zend_end_try();
535534
}
536535

537-
void zend_deactivate(CLS_D TSRMLS_DC)
536+
void zend_deactivate(TSRMLS_D)
538537
{
539538
/* we're no longer executing anything */
540539
EG(opline_ptr) = NULL;
541540
EG(active_symbol_table) = NULL;
542541

543542
zend_try {
544-
shutdown_scanner(CLS_C);
543+
shutdown_scanner(TSRMLS_C);
545544
} zend_end_try();
546545

547546
/* shutdown_executor() takes care of its own bailout handling */
548547
shutdown_executor(TSRMLS_C);
549548

550549
zend_try {
551-
shutdown_compiler(CLS_C);
550+
shutdown_compiler(TSRMLS_C);
552551
} zend_end_try();
553552

554553
zend_try {
@@ -589,7 +588,6 @@ ZEND_API void zend_error(int type, const char *format, ...)
589588
uint error_lineno;
590589
zval *orig_user_error_handler;
591590
TSRMLS_FETCH();
592-
CLS_FETCH();
593591

594592
/* Obtain relevant filename and lineno */
595593
switch (type) {
@@ -608,8 +606,8 @@ ZEND_API void zend_error(int type, const char *format, ...)
608606
case E_USER_WARNING:
609607
case E_USER_NOTICE:
610608
if (zend_is_compiling()) {
611-
error_filename = zend_get_compiled_filename(CLS_C);
612-
error_lineno = zend_get_compiled_lineno(CLS_C);
609+
error_filename = zend_get_compiled_filename(TSRMLS_C);
610+
error_lineno = zend_get_compiled_lineno(TSRMLS_C);
613611
} else if (zend_is_executing()) {
614612
error_filename = zend_get_executed_filename(TSRMLS_C);
615613
error_lineno = zend_get_executed_lineno(TSRMLS_C);
@@ -711,7 +709,7 @@ ZEND_API void zend_error(int type, const char *format, ...)
711709
va_end(args);
712710

713711
if (type==E_PARSE) {
714-
zend_init_compiler_data_structures(CLS_C);
712+
zend_init_compiler_data_structures(TSRMLS_C);
715713
}
716714
}
717715

@@ -742,7 +740,7 @@ ZEND_API void zend_output_debug_string(zend_bool trigger_break, char *format, ..
742740
}
743741

744742

745-
ZEND_API int zend_execute_scripts(int type CLS_DC TSRMLS_DC, int file_count, ...)
743+
ZEND_API int zend_execute_scripts(int type TSRMLS_DC, int file_count, ...)
746744
{
747745
va_list files;
748746
int i;
@@ -755,8 +753,8 @@ ZEND_API int zend_execute_scripts(int type CLS_DC TSRMLS_DC, int file_count, ...
755753
if (!file_handle) {
756754
continue;
757755
}
758-
EG(active_op_array) = zend_compile_file(file_handle, ZEND_INCLUDE CLS_CC);
759-
zend_destroy_file_handle(file_handle CLS_CC);
756+
EG(active_op_array) = zend_compile_file(file_handle, ZEND_INCLUDE TSRMLS_CC);
757+
zend_destroy_file_handle(file_handle TSRMLS_CC);
760758
if (EG(active_op_array)) {
761759
zend_execute(EG(active_op_array) TSRMLS_CC);
762760
zval_ptr_dtor(EG(return_value_ptr_ptr));
@@ -783,12 +781,11 @@ ZEND_API char *zend_make_compiled_string_description(char *name)
783781
char *cur_filename;
784782
int cur_lineno;
785783
char *compiled_string_description;
786-
CLS_FETCH();
787784
TSRMLS_FETCH();
788785

789786
if (zend_is_compiling()) {
790-
cur_filename = zend_get_compiled_filename(CLS_C);
791-
cur_lineno = zend_get_compiled_lineno(CLS_C);
787+
cur_filename = zend_get_compiled_filename(TSRMLS_C);
788+
cur_lineno = zend_get_compiled_lineno(TSRMLS_C);
792789
} else if (zend_is_executing()) {
793790
cur_filename = zend_get_executed_filename(TSRMLS_C);
794791
cur_lineno = zend_get_executed_lineno(TSRMLS_C);

Zend/zend.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
#define ZEND_VERSION "1.0.7"
2525

26-
#include "../TSRM/TSRM.h"
27-
2826
#ifdef __cplusplus
2927
#define BEGIN_EXTERN_C() extern "C" {
3028
#define END_EXTERN_C() }

Zend/zend_API.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ int zend_register_functions(zend_function_entry *functions, HashTable *function_
10331033
int count=0,unload=0;
10341034
HashTable *target_function_table = function_table;
10351035
int error_type;
1036-
CLS_FETCH();
1036+
TSRMLS_FETCH();
10371037

10381038
if (type==MODULE_PERSISTENT) {
10391039
error_type = E_CORE_WARNING;
@@ -1083,7 +1083,7 @@ void zend_unregister_functions(zend_function_entry *functions, int count, HashTa
10831083
zend_function_entry *ptr = functions;
10841084
int i=0;
10851085
HashTable *target_function_table = function_table;
1086-
CLS_FETCH();
1086+
TSRMLS_FETCH();
10871087

10881088
if (!target_function_table) {
10891089
target_function_table = CG(function_table);
@@ -1199,7 +1199,7 @@ int zend_next_free_module(void)
11991199
ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name)
12001200
{
12011201
zend_class_entry *register_class;
1202-
CLS_FETCH();
1202+
TSRMLS_FETCH();
12031203

12041204
if (!parent_ce && parent_name) {
12051205
if (zend_hash_find(CG(class_table), parent_name, strlen(parent_name)+1, (void **) &parent_ce)==FAILURE) {
@@ -1219,7 +1219,7 @@ ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_
12191219
{
12201220
zend_class_entry *register_class;
12211221
char *lowercase_name = zend_strndup(class_entry->name, class_entry->name_length);
1222-
CLS_FETCH();
1222+
TSRMLS_FETCH();
12231223

12241224
zend_str_tolower(lowercase_name, class_entry->name_length);
12251225

@@ -1292,7 +1292,7 @@ static zend_function_entry disabled_function[] = {
12921292

12931293
ZEND_API int zend_disable_function(char *function_name, uint function_name_length)
12941294
{
1295-
CLS_FETCH();
1295+
TSRMLS_FETCH();
12961296

12971297
if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) {
12981298
return FAILURE;

0 commit comments

Comments
 (0)