Permalink
Browse files

Whatnot:

* updated alloc_persist to use critical sections
* changed extension shutdown to two-phase
* updated dependencies
* PR support (don't remember if there was any really)
  • Loading branch information...
1 parent 2e8fb4e commit 342c6e0b2328db952709dd5a35c113e2b17c1e3d @zsuraski zsuraski committed Apr 18, 1999
View
@@ -70,20 +70,11 @@ if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
fi
-AC_CHECK_LIB(nsl, gethostname, [
- LIBS="-lnsl $LIBS"
- AC_DEFINE(HAVE_LIBNSL) ], [])
-
AC_CHECK_LIB(c, socket, [:], [
AC_CHECK_LIB(socket, socket, [
LIBS="-lsocket $LIBS"
AC_DEFINE(HAVE_LIBSOCKET) ], []) ])
-AC_CHECK_LIB(c, gethostbyaddr, [:], [
- AC_CHECK_LIB(nsl, gethostbyaddr, [
- LIBS="-lnsl $LIBS"
- AC_DEFINE(HAVE_LIBNSL) ], []) ])
-
AC_CHECK_LIB(c, dlopen, [
# fake it
AC_DEFINE(HAVE_LIBDL) ], [
@@ -96,24 +87,6 @@ dnl as well as res_search resides in libsocket
AC_CHECK_LIB(c, sin, [:], [
AC_CHECK_LIB(m, sin) ])
-dnl The res_search may be in libsocket as well, and if it is
-dnl make sure to check for dn_skipname in libresolv, or if res_search
-dnl is in neither of these libs, still check for dn_skipname in libresolv
-AC_CHECK_LIB(socket, res_search, [
- AC_CHECK_LIB(resolv, dn_skipname)
- AC_CHECK_LIB(resolv, __dn_skipname)
- LIBS="$LIBS -lsocket"
- AC_DEFINE(HAVE_LIBSOCKET)
-], [
- AC_CHECK_LIB(resolv, res_search, [
- LIBS="$LIBS -lresolv"
- AC_DEFINE(HAVE_LIBRESOLV)
- ], [
- AC_CHECK_LIB(resolv, dn_skipname)
- AC_CHECK_LIB(resolv, __dn_skipname)
- ])
-])
-
dnl Checks for header files.
AC_HEADER_STDC
View
@@ -243,7 +243,7 @@ zend_op_array *compile_filename(zval *filename CLS_DC)
}
file_handle.filename = filename->value.str.val;
file_handle.type = ZEND_HANDLE_FILENAME;
- retval = compile_files(0 CLS_CC, 1, &file_handle);
+ retval = zend_compile_files(0 CLS_CC, 1, &file_handle);
if (filename==&tmp) {
zval_dtor(&tmp);
}
View
@@ -154,6 +154,8 @@ static void register_standard_class()
standard_class.handle_function_call = NULL;
standard_class.handle_property_get = NULL;
standard_class.handle_property_set = NULL;
+ standard_class.refcount = (int *) malloc(sizeof(int));
+ *standard_class.refcount = 1;
zend_hash_add(CG(class_table), "stdClass", sizeof("stdClass"), &standard_class, sizeof(zend_class_entry), NULL);
}
@@ -206,7 +208,7 @@ void zend_shutdown()
free(CG(function_table));
zend_hash_destroy(CG(class_table));
free(CG(class_table));
- zend_llist_destroy(&zend_extensions);
+ zend_shutdown_extensions();
free(zend_version_info);
zend_shutdown_constants();
}
View
@@ -85,7 +85,7 @@ typedef struct {
char *fname;
void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
unsigned char *func_arg_types;
-} function_entry;
+} zend_function_entry;
typedef struct {
@@ -107,6 +107,7 @@ struct _zend_class_entry {
char *name;
uint name_length;
struct _zend_class_entry *parent;
+ int *refcount;
HashTable function_table;
HashTable default_properties;
View
@@ -592,9 +592,9 @@ ZEND_API int _register_list_destructors(void (*list_destructor)(void *), void (*
/* registers all functions in *library_functions in the function hash */
-int register_functions(function_entry *functions)
+int register_functions(zend_function_entry *functions)
{
- function_entry *ptr = functions;
+ zend_function_entry *ptr = functions;
zend_internal_function internal_function;
int count=0,unload=0;
CLS_FETCH();
@@ -633,9 +633,9 @@ int register_functions(function_entry *functions)
/* count=-1 means erase all functions, otherwise,
* erase the first count functions
*/
-void unregister_functions(function_entry *functions,int count)
+void unregister_functions(zend_function_entry *functions,int count)
{
- function_entry *ptr = functions;
+ zend_function_entry *ptr = functions;
int i=0;
CLS_FETCH();
@@ -753,6 +753,8 @@ zend_class_entry *register_internal_class(zend_class_entry *class_entry)
class_entry->type = ZEND_INTERNAL_CLASS;
class_entry->parent = NULL;
+ class_entry->refcount = (int *) malloc(sizeof(int));
+ *class_entry->refcount = 1;
zend_hash_init(&class_entry->default_properties, 0, NULL, PVAL_PTR_DTOR, 1);
zend_hash_init(&class_entry->function_table, 0, NULL, (void (*)(void *)) destroy_zend_function, 1);
View
@@ -21,6 +21,13 @@
#include "zend_list.h"
+#define ZEND_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
+#define ZEND_FUNCTION(name) ZEND_NAMED_FUNCTION(zend_if_##name)
+
+#define ZEND_NAMED_FE(runtime_name, name, arg_types) { #runtime_name, name, arg_types },
+#define ZEND_FE(name, arg_types) ZEND_NAMED_FE(name, zend_if_##name, arg_types)
+
+
int zend_next_free_module(void);
int getParameters(int ht, int param_count,...);
@@ -32,8 +39,8 @@ int getThis(zval **this);
int ParameterPassedByReference(int ht, uint n);
-int register_functions(function_entry *functions);
-void unregister_functions(function_entry *functions, int count);
+int register_functions(zend_function_entry *functions);
+void unregister_functions(zend_function_entry *functions, int count);
int register_module(zend_module_entry *module_entry);
zend_class_entry *register_internal_class(zend_class_entry *class_entry);
View
@@ -494,13 +494,16 @@ ZEND_API void _persist_alloc(void *ptr)
_mem_block_check(ptr, 1, filename, lineno);
#endif
+ HANDLE_BLOCK_INTERRUPTIONS();
+
/* remove the block from the non persistent list */
REMOVE_POINTER_FROM_LIST(p);
p->persistent = 1;
/* add the block to the persistent list */
ADD_POINTER_TO_LIST(p);
+ HANDLE_UNBLOCK_INTERRUPTIONS();
}
View
@@ -1107,6 +1107,8 @@ void do_begin_class_declaration(znode *class_name, znode *parent_class_name CLS_
CG(class_entry).type = ZEND_USER_CLASS;
CG(class_entry).name = class_name->u.constant.value.str.val;
CG(class_entry).name_length = class_name->u.constant.value.str.len;
+ CG(class_entry).refcount = (int *) emalloc(sizeof(int));
+ *CG(class_entry).refcount = 1;
zend_str_tolower(CG(class_entry).name, CG(class_entry).name_length);
View
@@ -100,13 +100,26 @@ int zend_load_extension(char *path)
#endif
}
-
-void zend_extension_dtor(zend_extension *extension)
+static void zend_extension_shutdown(zend_extension *extension)
{
#if ZEND_EXTENSIONS_SUPPORT
if (extension->shutdown) {
extension->shutdown(extension);
}
+#endif
+}
+
+
+void zend_shutdown_extensions()
+{
+ zend_llist_apply(&zend_extensions, (void (*)(void *)) zend_extension_shutdown);
+ zend_llist_destroy(&zend_extensions);
+}
+
+
+void zend_extension_dtor(zend_extension *extension)
+{
+#if ZEND_EXTENSIONS_SUPPORT
DL_UNLOAD(extension->handle);
#endif
}
View
@@ -86,5 +86,6 @@ void zend_extension_dtor(zend_extension *extension);
int zend_load_extension(char *path);
int zend_load_extensions(char **extension_paths);
void zend_append_version_info(zend_extension *extension);
+void zend_shutdown_extensions();
#endif /* _ZEND_EXTENSIONS_H */
View
@@ -187,6 +187,7 @@ struct _zend_executor_globals {
zend_ptr_stack argument_stack;
+ void *reserved[4];
#if SUPPORT_INTERACTIVE
int interactive;
#endif
View
@@ -72,18 +72,26 @@ ZEND_API void zend_llist_del_element(zend_llist *l, void *element)
ZEND_API void zend_llist_destroy(zend_llist *l)
{
- zend_llist_element *current=l->head, *next;
+ zend_llist_element *current, *next;
- while (current) {
- next = current->next;
- if (l->dtor) {
+ if (l->dtor) {
+ current = l->head;
+
+ while (current) {
l->dtor(current->data);
+ current = current->next;
}
+ }
+
+ current = l->head;
+ while (current) {
+ next = current->next;
pefree(current, l->persistent);
current = next;
}
}
+
ZEND_API void zend_llist_remove_tail(zend_llist *l)
{
zend_llist_element *old_tail;
View
@@ -28,7 +28,7 @@
typedef struct {
char *name;
- function_entry *functions;
+ zend_function_entry *functions;
int (*module_startup_func)(INIT_FUNC_ARGS);
int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS);
int (*request_startup_func)(INIT_FUNC_ARGS);
View
@@ -111,6 +111,9 @@ ZEND_API void destroy_zend_function(zend_function *function)
ZEND_API void destroy_zend_class(zend_class_entry *ce)
{
+ if (--(*ce->refcount)>0) {
+ return;
+ }
switch (ce->type) {
case ZEND_USER_CLASS:
efree(ce->name);

0 comments on commit 342c6e0

Please sign in to comment.