Skip to content

Commit b9275a7

Browse files
committed
fix: Windows build
1 parent 2ec90d3 commit b9275a7

2 files changed

Lines changed: 45 additions & 41 deletions

File tree

ext/opcache/zend_static_cache.c

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ static void zend_opcache_static_cache_init_partition_contexts(zend_opcache_stati
691691
partition->name = name != NULL ? strdup(name) : NULL;
692692
}
693693

694-
zend_opcache_static_cache_partition *zend_opcache_static_cache_partition_create(const char *name)
694+
ZEND_API zend_opcache_static_cache_partition *zend_opcache_static_cache_partition_create(const char *name)
695695
{
696696
zend_opcache_static_cache_partition *partition = calloc(1, sizeof(zend_opcache_static_cache_partition));
697697

@@ -706,7 +706,7 @@ zend_opcache_static_cache_partition *zend_opcache_static_cache_partition_create(
706706
return partition;
707707
}
708708

709-
bool zend_opcache_static_cache_partition_startup_before_request(zend_opcache_static_cache_partition *partition)
709+
ZEND_API bool zend_opcache_static_cache_partition_startup_before_request(zend_opcache_static_cache_partition *partition)
710710
{
711711
const char *failure_reason;
712712
zend_opcache_static_cache_context *previous_context;
@@ -751,17 +751,6 @@ bool zend_opcache_static_cache_partition_startup_before_request(zend_opcache_sta
751751
return true;
752752
}
753753

754-
void zend_opcache_static_cache_partition_activate(zend_opcache_static_cache_partition *partition)
755-
{
756-
zend_opcache_static_cache_active_partition = partition;
757-
zend_opcache_static_cache_active_context_ptr = NULL;
758-
}
759-
760-
void zend_opcache_static_cache_opt_in(void)
761-
{
762-
zend_opcache_static_cache_runtime_opted_in = true;
763-
}
764-
765754
static zend_always_inline bool zend_opcache_static_cache_begin_entry_mutation(zend_string *key, bool *release_entry_lock, bool throw_on_error)
766755
{
767756
ZEND_ASSERT(release_entry_lock != NULL);
@@ -1234,30 +1223,6 @@ static void zend_opcache_static_cache_partition_shutdown_all(void)
12341223
zend_opcache_static_cache_restore_context(previous_context);
12351224
}
12361225

1237-
void zend_opcache_static_cache_mshutdown(void)
1238-
{
1239-
zend_opcache_static_cache_context *previous_context;
1240-
1241-
zend_opcache_static_cache_unregister_hooks();
1242-
zend_opcache_static_cache_partition_shutdown_all();
1243-
zend_opcache_static_cache_active_partition = NULL;
1244-
1245-
previous_context = zend_opcache_static_cache_activate_context(zend_opcache_static_cache_active_volatile_context());
1246-
zend_opcache_static_cache_shutdown_storage();
1247-
zend_opcache_static_cache_reset_runtime();
1248-
zend_opcache_static_cache_activate_context(&zend_opcache_static_cache_pinned_context_state);
1249-
zend_opcache_static_cache_shutdown_storage();
1250-
zend_opcache_static_cache_reset_runtime();
1251-
zend_opcache_static_cache_restore_context(previous_context);
1252-
1253-
zend_opcache_static_cache_subsystem_disabled = false;
1254-
zend_opcache_static_cache_subsystem_failure_reason = NULL;
1255-
zend_opcache_static_cache_active_partition = NULL;
1256-
zend_opcache_static_cache_safe_direct_handlers_destroy();
1257-
zend_opcache_static_cache_reset_class_entries();
1258-
zend_accel_register_static_cache_handlers(NULL);
1259-
}
1260-
12611226
static zend_result zend_opcache_static_cache_rinit(void)
12621227
{
12631228
zend_opcache_static_cache_context *previous_context;
@@ -1307,6 +1272,17 @@ static void zend_opcache_static_cache_register_accelerator_handlers(void)
13071272
zend_accel_register_static_cache_handlers(&handlers);
13081273
}
13091274

1275+
ZEND_API void zend_opcache_static_cache_partition_activate(zend_opcache_static_cache_partition *partition)
1276+
{
1277+
zend_opcache_static_cache_active_partition = partition;
1278+
zend_opcache_static_cache_active_context_ptr = NULL;
1279+
}
1280+
1281+
ZEND_API void zend_opcache_static_cache_opt_in(void)
1282+
{
1283+
zend_opcache_static_cache_runtime_opted_in = true;
1284+
}
1285+
13101286
zend_result zend_opcache_static_cache_minit(void)
13111287
{
13121288
zend_opcache_static_cache_context *previous_context;
@@ -1329,6 +1305,30 @@ zend_result zend_opcache_static_cache_minit(void)
13291305
return SUCCESS;
13301306
}
13311307

1308+
void zend_opcache_static_cache_mshutdown(void)
1309+
{
1310+
zend_opcache_static_cache_context *previous_context;
1311+
1312+
zend_opcache_static_cache_unregister_hooks();
1313+
zend_opcache_static_cache_partition_shutdown_all();
1314+
zend_opcache_static_cache_active_partition = NULL;
1315+
1316+
previous_context = zend_opcache_static_cache_activate_context(zend_opcache_static_cache_active_volatile_context());
1317+
zend_opcache_static_cache_shutdown_storage();
1318+
zend_opcache_static_cache_reset_runtime();
1319+
zend_opcache_static_cache_activate_context(&zend_opcache_static_cache_pinned_context_state);
1320+
zend_opcache_static_cache_shutdown_storage();
1321+
zend_opcache_static_cache_reset_runtime();
1322+
zend_opcache_static_cache_restore_context(previous_context);
1323+
1324+
zend_opcache_static_cache_subsystem_disabled = false;
1325+
zend_opcache_static_cache_subsystem_failure_reason = NULL;
1326+
zend_opcache_static_cache_active_partition = NULL;
1327+
zend_opcache_static_cache_safe_direct_handlers_destroy();
1328+
zend_opcache_static_cache_reset_class_entries();
1329+
zend_accel_register_static_cache_handlers(NULL);
1330+
}
1331+
13321332
void zend_opcache_static_cache_invalidate_all(void)
13331333
{
13341334
zend_opcache_static_cache_invalidate_all_context(zend_opcache_static_cache_active_pinned_context());

ext/opcache/zend_static_cache.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,19 @@ struct _zend_opcache_static_cache_safe_direct_handlers {
7474

7575
BEGIN_EXTERN_C()
7676

77+
/* The opt-in/partition functions form the SAPI-facing API. They are called
78+
* from the SAPI binaries (cli, cli-server, fpm, phpdbg, embedders), which on
79+
* Windows are separate PE modules from the php8ts.dll that statically links
80+
* OPcache. They must therefore be exported across the module boundary. */
81+
ZEND_API void zend_opcache_static_cache_opt_in(void);
82+
ZEND_API zend_opcache_static_cache_partition *zend_opcache_static_cache_partition_create(const char *name);
83+
ZEND_API bool zend_opcache_static_cache_partition_startup_before_request(zend_opcache_static_cache_partition *partition);
84+
ZEND_API void zend_opcache_static_cache_partition_activate(zend_opcache_static_cache_partition *partition);
7785
zend_result zend_opcache_register_functions(int module_type);
7886
zend_result zend_opcache_static_cache_minit(void);
7987
void zend_opcache_static_cache_mshutdown(void);
8088
zend_result zend_opcache_static_cache_rshutdown(void);
81-
void zend_opcache_static_cache_opt_in(void);
8289
void zend_opcache_static_cache_invalidate_all(void);
83-
zend_opcache_static_cache_partition *zend_opcache_static_cache_partition_create(const char *name);
84-
bool zend_opcache_static_cache_partition_startup_before_request(zend_opcache_static_cache_partition *partition);
85-
void zend_opcache_static_cache_partition_activate(zend_opcache_static_cache_partition *partition);
8690
void zend_opcache_static_cache_volatile_get_status(zval *return_value);
8791
void zend_opcache_static_cache_pinned_get_status(zval *return_value);
8892
bool zend_opcache_static_cache_volatile_is_enabled(void);

0 commit comments

Comments
 (0)