summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/zend_mm_structs.h
diff options
context:
space:
mode:
authorRasmus Lerdorf <rasmus@php.net>2014-10-26 16:58:45 -0700
committerRasmus Lerdorf <rasmus@php.net>2014-10-26 16:58:45 -0700
commit8d84b1f67adb71bdb2394b62faad04b22f6226f3 (patch)
tree0c1c1ed2aaef8eee971575eb5e336631295f4951 /sapi/phpdbg/zend_mm_structs.h
parentfb85d0322d39d49f37e32df6f68c9769f2cce0e4 (diff)
parent09da8952d0434b53e740ffaca66a8051cd39cf93 (diff)
downloadphp-git-8d84b1f67adb71bdb2394b62faad04b22f6226f3.tar.gz
Merge branch 'master' of git.php.net:php-src
* 'master' of git.php.net:php-src: (240 commits) Do not execute anything after quit or clean command Fix last commit, and do not output unnecessary information Stabilize execution, always run destructors and extended file breakpoints Fix nullptr dereference in clean without exec context remove dodgy param parser, bring userland breakpoint api inline with PHP7 disable output buffering by default Add question to reset execution in run/exec/clean - Updated to version 2014.9 (2014i) actually remove this disable output buffering, better breakpoint api for userland, remove hand parsing of params Fix phpdbg output when outputting via php with active output handlers Fixed Closure::call() NEWS/UPGRADING Set engine back to initial state after fatal-ed ev command Fix eventual stack overflow after clean cmd Fix listing of files with no absolute path updated libmagic.patch in master updated libmagic.patch in 5.6 updated libmagic.patch in 5.5 NEWS NEWS ...
Diffstat (limited to 'sapi/phpdbg/zend_mm_structs.h')
-rw-r--r--sapi/phpdbg/zend_mm_structs.h102
1 files changed, 102 insertions, 0 deletions
diff --git a/sapi/phpdbg/zend_mm_structs.h b/sapi/phpdbg/zend_mm_structs.h
new file mode 100644
index 0000000000..ca64069e0f
--- /dev/null
+++ b/sapi/phpdbg/zend_mm_structs.h
@@ -0,0 +1,102 @@
+#ifndef ZEND_MM_STRUCTS_H
+#define ZEND_MM_STRUCTS_H
+
+/* structs and macros defined in Zend/zend_alloc.c
+ Needed for realizing watchpoints and sigsafe memory */
+
+#include "zend.h"
+
+#ifndef ZEND_MM_COOKIES
+# define ZEND_MM_COOKIES ZEND_DEBUG
+#endif
+
+#define ZEND_MM_CACHE 1
+#ifndef ZEND_MM_CACHE_STAT
+# define ZEND_MM_CACHE_STAT 0
+#endif
+
+typedef struct _zend_mm_block_info {
+#if ZEND_MM_COOKIES
+ size_t _cookie;
+#endif
+ size_t _size;
+ size_t _prev;
+} zend_mm_block_info;
+
+typedef struct _zend_mm_small_free_block {
+ zend_mm_block_info info;
+#if ZEND_DEBUG
+ unsigned int magic;
+#ifdef ZTS
+ THREAD_T thread_id;
+#endif
+#endif
+ struct _zend_mm_free_block *prev_free_block;
+ struct _zend_mm_free_block *next_free_block;
+} zend_mm_small_free_block;
+
+typedef struct _zend_mm_free_block {
+ zend_mm_block_info info;
+#if ZEND_DEBUG
+ unsigned int magic;
+#ifdef ZTS
+ THREAD_T thread_id;
+#endif
+#endif
+ struct _zend_mm_free_block *prev_free_block;
+ struct _zend_mm_free_block *next_free_block;
+
+ struct _zend_mm_free_block **parent;
+ struct _zend_mm_free_block *child[2];
+} zend_mm_free_block;
+
+#define ZEND_MM_SMALL_FREE_BUCKET(heap, index) \
+ (zend_mm_free_block *) ((char *)&heap->free_buckets[index * 2] + \
+ sizeof(zend_mm_free_block *) * 2 - \
+ sizeof(zend_mm_small_free_block))
+
+#define ZEND_MM_REST_BUCKET(heap) \
+ (zend_mm_free_block *)((char *)&heap->rest_buckets[0] + \
+ sizeof(zend_mm_free_block *) * 2 - \
+ sizeof(zend_mm_small_free_block))
+
+#define ZEND_MM_NUM_BUCKETS (sizeof(size_t) << 3)
+struct _zend_mm_heap {
+ int use_zend_alloc;
+ void *(*_malloc)(size_t);
+ void (*_free)(void *);
+ void *(*_realloc)(void *, size_t);
+ size_t free_bitmap;
+ size_t large_free_bitmap;
+ size_t block_size;
+ size_t compact_size;
+ zend_mm_segment *segments_list;
+ zend_mm_storage *storage;
+ size_t real_size;
+ size_t real_peak;
+ size_t limit;
+ size_t size;
+ size_t peak;
+ size_t reserve_size;
+ void *reserve;
+ int overflow;
+ int internal;
+#if ZEND_MM_CACHE
+ unsigned int cached;
+ zend_mm_free_block *cache[ZEND_MM_NUM_BUCKETS];
+#endif
+ zend_mm_free_block *free_buckets[ZEND_MM_NUM_BUCKETS*2];
+ zend_mm_free_block *large_free_buckets[ZEND_MM_NUM_BUCKETS];
+ zend_mm_free_block *rest_buckets[2];
+ int rest_count;
+#if ZEND_MM_CACHE_STAT
+ struct {
+ int count;
+ int max_count;
+ int hit;
+ int miss;
+ } cache_stat[ZEND_MM_NUM_BUCKETS+1];
+#endif
+};
+
+#endif