@@ -1660,7 +1660,7 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl
1660
1660
{
1661
1661
zend_persistent_script * new_persistent_script ;
1662
1662
zend_op_array * orig_active_op_array ;
1663
- HashTable * orig_function_table , * orig_class_table ;
1663
+ HashTable * orig_class_table ;
1664
1664
zval orig_user_error_handler ;
1665
1665
zend_op_array * op_array ;
1666
1666
int do_bailout = 0 ;
@@ -1724,12 +1724,10 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl
1724
1724
1725
1725
/* Save the original values for the op_array, function table and class table */
1726
1726
orig_active_op_array = CG (active_op_array );
1727
- orig_function_table = CG (function_table );
1728
1727
orig_class_table = CG (class_table );
1729
1728
ZVAL_COPY_VALUE (& orig_user_error_handler , & EG (user_error_handler ));
1730
1729
1731
1730
/* Override them with ours */
1732
- CG (function_table ) = & ZCG (function_table );
1733
1731
EG (class_table ) = CG (class_table ) = & new_persistent_script -> script .class_table ;
1734
1732
ZVAL_UNDEF (& EG (user_error_handler ));
1735
1733
@@ -1739,6 +1737,7 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl
1739
1737
CG (compiler_options ) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES ;
1740
1738
CG (compiler_options ) |= ZEND_COMPILE_DELAYED_BINDING ;
1741
1739
CG (compiler_options ) |= ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION ;
1740
+ CG (compiler_options ) |= ZEND_COMPILE_IGNORE_OTHER_FILES ;
1742
1741
#ifdef HAVE_OPCACHE_FILE_CACHE
1743
1742
if (ZCG (accel_directives ).file_cache ) {
1744
1743
CG (compiler_options ) |= ZEND_COMPILE_WITH_FILE_CACHE ;
@@ -1754,14 +1753,12 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl
1754
1753
1755
1754
/* Restore originals */
1756
1755
CG (active_op_array ) = orig_active_op_array ;
1757
- CG (function_table ) = orig_function_table ;
1758
1756
EG (class_table ) = CG (class_table ) = orig_class_table ;
1759
1757
EG (user_error_handler ) = orig_user_error_handler ;
1760
1758
1761
1759
if (!op_array ) {
1762
1760
/* compilation failed */
1763
1761
free_persistent_script (new_persistent_script , 1 );
1764
- zend_accel_free_user_functions (& ZCG (function_table ));
1765
1762
if (do_bailout ) {
1766
1763
zend_bailout ();
1767
1764
}
@@ -1772,12 +1769,12 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl
1772
1769
Here we aren't sure we would store it, but we will need it
1773
1770
further anyway.
1774
1771
*/
1775
- zend_accel_move_user_functions (& ZCG (function_table ), & new_persistent_script -> script .function_table );
1772
+ new_persistent_script -> script .main_op_array = * op_array ;
1773
+ zend_accel_move_user_functions (CG (function_table ), & new_persistent_script -> script );
1776
1774
new_persistent_script -> script .first_early_binding_opline =
1777
1775
(op_array -> fn_flags & ZEND_ACC_EARLY_BINDING ) ?
1778
1776
zend_build_delayed_early_binding_list (op_array ) :
1779
1777
(uint32_t )-1 ;
1780
- new_persistent_script -> script .main_op_array = * op_array ;
1781
1778
1782
1779
efree (op_array ); /* we have valid persistent_script, so it's safe to free op_array */
1783
1780
@@ -2304,11 +2301,6 @@ static void accel_activate(void)
2304
2301
return ;
2305
2302
}
2306
2303
2307
- if (!ZCG (function_table ).nTableSize ) {
2308
- zend_hash_init (& ZCG (function_table ), zend_hash_num_elements (CG (function_table )), NULL , ZEND_FUNCTION_DTOR , 1 );
2309
- zend_accel_copy_internal_functions ();
2310
- }
2311
-
2312
2304
/* PHP-5.4 and above return "double", but we use 1 sec precision */
2313
2305
ZCG (auto_globals_mask ) = 0 ;
2314
2306
ZCG (request_time ) = (time_t )sapi_get_request_time ();
@@ -2317,11 +2309,6 @@ static void accel_activate(void)
2317
2309
ZCG (include_path_key_len ) = 0 ;
2318
2310
ZCG (include_path_check ) = 1 ;
2319
2311
2320
- /* check if ZCG(function_table) wasn't somehow polluted on the way */
2321
- if (ZCG (internal_functions_count ) != (zend_long )zend_hash_num_elements (& ZCG (function_table ))) {
2322
- zend_accel_error (ACCEL_LOG_WARNING , "Internal functions count changed - was %d, now %d" , ZCG (internal_functions_count ), zend_hash_num_elements (& ZCG (function_table )));
2323
- }
2324
-
2325
2312
ZCG (cwd ) = NULL ;
2326
2313
ZCG (cwd_key_len ) = 0 ;
2327
2314
ZCG (cwd_check ) = 1 ;
@@ -2605,14 +2592,6 @@ static void accel_globals_ctor(zend_accel_globals *accel_globals)
2605
2592
accel_gen_system_id ();
2606
2593
}
2607
2594
2608
- static void accel_globals_dtor (zend_accel_globals * accel_globals )
2609
- {
2610
- if (accel_globals -> function_table .nTableSize ) {
2611
- accel_globals -> function_table .pDestructor = NULL ;
2612
- zend_hash_destroy (& accel_globals -> function_table );
2613
- }
2614
- }
2615
-
2616
2595
#define ZEND_BIN_ID "BIN_" ZEND_TOSTR(SIZEOF_CHAR) ZEND_TOSTR(SIZEOF_INT) ZEND_TOSTR(SIZEOF_LONG) ZEND_TOSTR(SIZEOF_SIZE_T) ZEND_TOSTR(SIZEOF_ZEND_LONG) ZEND_TOSTR(ZEND_MM_ALIGNMENT)
2617
2596
2618
2597
static void accel_gen_system_id (void )
@@ -2752,7 +2731,7 @@ static void accel_move_code_to_huge_pages(void)
2752
2731
static int accel_startup (zend_extension * extension )
2753
2732
{
2754
2733
#ifdef ZTS
2755
- accel_globals_id = ts_allocate_id (& accel_globals_id , sizeof (zend_accel_globals ), (ts_allocate_ctor ) accel_globals_ctor , ( ts_allocate_dtor ) accel_globals_dtor );
2734
+ accel_globals_id = ts_allocate_id (& accel_globals_id , sizeof (zend_accel_globals ), (ts_allocate_ctor ) accel_globals_ctor , NULL );
2756
2735
#else
2757
2736
accel_globals_ctor (& accel_globals );
2758
2737
#endif
@@ -2941,15 +2920,6 @@ static int accel_post_startup(void)
2941
2920
return SUCCESS ;
2942
2921
}
2943
2922
2944
- static void accel_free_ts_resources ()
2945
- {
2946
- #ifndef ZTS
2947
- accel_globals_dtor (& accel_globals );
2948
- #else
2949
- ts_free_id (accel_globals_id );
2950
- #endif
2951
- }
2952
-
2953
2923
void accel_shutdown (void )
2954
2924
{
2955
2925
zend_ini_entry * ini_entry ;
@@ -2960,7 +2930,9 @@ void accel_shutdown(void)
2960
2930
zend_accel_blacklist_shutdown (& accel_blacklist );
2961
2931
2962
2932
if (!ZCG (enabled ) || !accel_startup_ok ) {
2963
- accel_free_ts_resources ();
2933
+ #ifdef ZTS
2934
+ ts_free_id (accel_globals_id );
2935
+ #endif
2964
2936
return ;
2965
2937
}
2966
2938
@@ -2970,7 +2942,9 @@ void accel_shutdown(void)
2970
2942
2971
2943
accel_reset_pcre_cache ();
2972
2944
2973
- accel_free_ts_resources ();
2945
+ #ifdef ZTS
2946
+ ts_free_id (accel_globals_id );
2947
+ #endif
2974
2948
2975
2949
if (!_file_cache_only ) {
2976
2950
zend_shared_alloc_shutdown ();
0 commit comments