Index: trunk/xcache.c
===================================================================
--- trunk/xcache.c	(revision 848)
+++ trunk/xcache.c	(revision 851)
@@ -145,5 +145,5 @@
 {
 	xc_entry_data_php_t *p;
-	for (p = php->cache->phps[php->hvalue]; p; p = p->next) {
+	for (p = php->cache->phps[php->hvalue]; p; p = (xc_entry_data_php_t *) p->next) {
 		if (memcmp(&php->md5.digest, &p->md5.digest, sizeof(php->md5.digest)) == 0) {
 			p->hits ++;
@@ -182,20 +182,22 @@
 /* }}} */
 
-static inline int xc_entry_equal_dmz(xc_entry_t *a, xc_entry_t *b) /* {{{ */
+static inline int xc_entry_equal_dmz(const xc_entry_t *entry1, const xc_entry_t *entry2) /* {{{ */
 {
 	/* this function isn't required but can be in dmz */
 
-	if (a->type != b->type) {
+	if (entry1->type != entry2->type) {
 		return 0;
 	}
-	switch (a->type) {
+	switch (entry1->type) {
 		case XC_TYPE_PHP:
 #ifdef HAVE_INODE
-			do {
-				if (a->inode) {
-					return a->inode == b->inode
-						&& a->device == b->device;
+			{
+				const xc_entry_php_t *php_entry1 = (const xc_entry_php_t *) entry1;
+				const xc_entry_php_t *php_entry2 = (const xc_entry_php_t *) entry2;
+				if (php_entry1->file_inode) {
+					return php_entry1->file_inode == php_entry2->file_inode
+						&& php_entry1->file_device == php_entry2->file_device;
 				}
-			} while(0);
+			}
 #endif
 			/* fall */
@@ -204,15 +206,15 @@
 			do {
 #ifdef IS_UNICODE
-				if (a->name_type == IS_UNICODE) {
-					if (a->name.ustr.len != b->name.ustr.len) {
+				if (entry1->name_type == IS_UNICODE) {
+					if (entry1->name.ustr.len != entry2->name.ustr.len) {
 						return 0;
 					}
-					return memcmp(a->name.ustr.val, b->name.ustr.val, (a->name.ustr.len + 1) * sizeof(UChar)) == 0;
+					return memcmp(entry1->name.ustr.val, entry2->name.ustr.val, (entry1->name.ustr.len + 1) * sizeof(UChar)) == 0;
 				}
 #endif
-				if (a->name.str.len != b->name.str.len) {
+				if (entry1->name.str.len != entry2->name.str.len) {
 					return 0;
 				}
-				return memcmp(a->name.str.val, b->name.str.val, a->name.str.len + 1) == 0;
+				return memcmp(entry1->name.str.val, entry2->name.str.val, entry1->name.str.len + 1) == 0;
 
 			} while(0);
@@ -275,5 +277,7 @@
 	xce->ctime = XG(request_time);
 	xce->atime = XG(request_time);
-	stored_xce = xc_processor_store_xc_entry_t(xce TSRMLS_CC);
+	stored_xce = xce->type == XC_TYPE_PHP
+		? (xc_entry_t *) xc_processor_store_xc_entry_php_t((xc_entry_php_t *) xce TSRMLS_CC)
+		: xc_processor_store_xc_entry_t(xce TSRMLS_CC);
 	if (stored_xce) {
 		xc_entry_add_dmz(stored_xce);
@@ -286,4 +290,9 @@
 }
 /* }}} */
+static xc_entry_php_t *xc_entry_php_store_dmz(xc_entry_php_t *xce TSRMLS_DC) /* {{{ */
+{
+	return (xc_entry_php_t *) xc_entry_store_dmz((xc_entry_t *) xce TSRMLS_CC);
+}
+/* }}} */
 static void xc_entry_free_real_dmz(volatile xc_entry_t *xce) /* {{{ */
 {
@@ -297,5 +306,5 @@
 {
 	xce->cache->entries_count --;
-	if (xce->refcount == 0) {
+	if ((xce->type == XC_TYPE_PHP ? ((xc_entry_php_t *) xce)->refcount : 0) == 0) {
 		xc_entry_free_real_dmz(xce);
 	}
@@ -329,13 +338,30 @@
 	for (p = xce->cache->entries[xce->hvalue]; p; p = p->next) {
 		if (xc_entry_equal_dmz(xce, p)) {
-			if (p->type == XC_TYPE_VAR || /* PHP */ (p->mtime == xce->mtime && p->data.php->sourcesize == xce->data.php->sourcesize)) {
+			zend_bool fresh;
+			switch (p->type) {
+			case XC_TYPE_PHP:
+				{
+					xc_entry_php_t *p_php = (xc_entry_php_t *) p;
+					xc_entry_php_t *xce_php = (xc_entry_php_t *) xce;
+					fresh = p_php->file_mtime == xce_php->file_mtime && p->data.php->file_size == xce->data.php->file_size;
+					break;
+				}
+
+			case XC_TYPE_VAR:
+				fresh = 1;
+				break;
+
+			default:
+				assert(0);
+			}
+
+			if (fresh) {
 				p->hits ++;
 				p->atime = XG(request_time);
 				return p;
 			}
-			else {
-				xc_entry_remove_dmz(p TSRMLS_CC);
-				return NULL;
-			}
+
+			xc_entry_remove_dmz(p TSRMLS_CC);
+			return NULL;
 		}
 	}
@@ -343,9 +369,9 @@
 }
 /* }}} */
-static void xc_entry_hold_php_dmz(xc_entry_t *xce TSRMLS_DC) /* {{{ */
-{
-	TRACE("hold %s", xce->name.str.val);
+static void xc_entry_hold_php_dmz(xc_entry_php_t *xce TSRMLS_DC) /* {{{ */
+{
+	TRACE("hold %s", xce->entry.name.str.val);
 	xce->refcount ++;
-	xc_stack_push(&XG(php_holds)[xce->cache->cacheid], (void *)xce);
+	xc_stack_push(&XG(php_holds)[xce->entry.cache->cacheid], (void *)xce);
 }
 /* }}} */
@@ -500,9 +526,10 @@
 	pp = &cache->deletes;
 	for (p = *pp; p; p = *pp) {
+		xc_entry_php_t *entry = (xc_entry_php_t *) p;
 		if (XG(request_time) - p->dtime > 3600) {
-			p->refcount = 0;
+			entry->refcount = 0;
 			/* issue warning here */
 		}
-		if (p->refcount == 0) {
+		if (entry->refcount == 0) {
 			/* unlink */
 			*pp = p->next;
@@ -622,14 +649,15 @@
 }
 /* }}} */
-static void xc_fillentry_dmz(xc_entry_t *entry, int del, zval *list TSRMLS_DC) /* {{{ */
+static void xc_fillentry_dmz(const xc_entry_t *entry, int del, zval *list TSRMLS_DC) /* {{{ */
 {
 	zval* ei;
-	xc_entry_data_php_t *php;
-	xc_entry_data_var_t *var;
+	const xc_entry_data_php_t *php;
+	const xc_entry_data_var_t *var;
+	xc_entry_php_t *entry_php = (xc_entry_php_t *) entry;
 
 	ALLOC_INIT_ZVAL(ei);
 	array_init(ei);
 
-	add_assoc_long_ex(ei, ZEND_STRS("refcount"), entry->refcount);
+	add_assoc_long_ex(ei, ZEND_STRS("refcount"), entry_php->refcount);
 	add_assoc_long_ex(ei, ZEND_STRS("hits"),     entry->hits);
 	add_assoc_long_ex(ei, ZEND_STRS("ctime"),    entry->ctime);
@@ -664,10 +692,10 @@
 			add_assoc_long_ex(ei, ZEND_STRS("size"),          entry->size + php->size);
 			add_assoc_long_ex(ei, ZEND_STRS("phprefcount"),   php->refcount);
-			add_assoc_long_ex(ei, ZEND_STRS("sourcesize"),    php->sourcesize);
+			add_assoc_long_ex(ei, ZEND_STRS("file_size"),     php->file_size);
 #ifdef HAVE_INODE
-			add_assoc_long_ex(ei, ZEND_STRS("device"),        entry->device);
-			add_assoc_long_ex(ei, ZEND_STRS("inode"),         entry->inode);
-#endif
-			add_assoc_long_ex(ei, ZEND_STRS("mtime"),         entry->mtime);
+			add_assoc_long_ex(ei, ZEND_STRS("file_device"),   entry_php->file_device);
+			add_assoc_long_ex(ei, ZEND_STRS("file_inode"),    entry_php->file_inode);
+#endif
+			add_assoc_long_ex(ei, ZEND_STRS("file_mtime"),    entry_php->file_mtime);
 
 #ifdef HAVE_XCACHE_CONSTANT
@@ -682,5 +710,5 @@
 
 		case XC_TYPE_VAR:
-			var = entry->data.var;
+			var = &entry->data.var;
 			add_assoc_long_ex(ei, ZEND_STRS("size"),          entry->size);
 			break;
@@ -718,8 +746,8 @@
 /* }}} */
 
-static zend_op_array *xc_entry_install(xc_entry_t *xce, zend_file_handle *h TSRMLS_DC) /* {{{ */
+static zend_op_array *xc_entry_install(xc_entry_php_t *xce, zend_file_handle *h TSRMLS_DC) /* {{{ */
 {
 	zend_uint i;
-	xc_entry_data_php_t *p = xce->data.php;
+	xc_entry_data_php_t *p = xce->entry.data.php;
 	zend_op_array *old_active_op_array = CG(active_op_array);
 #ifndef ZEND_ENGINE_2
@@ -735,5 +763,5 @@
 	for (i = 0; i < p->constinfo_cnt; i ++) {
 		xc_constinfo_t *ci = &p->constinfos[i];
-		xc_install_constant(xce->name.str.val, &ci->constant,
+		xc_install_constant(xce->entry.name.str.val, &ci->constant,
 				UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC);
 	}
@@ -743,5 +771,5 @@
 	for (i = 0; i < p->funcinfo_cnt; i ++) {
 		xc_funcinfo_t  *fi = &p->funcinfos[i];
-		xc_install_function(xce->name.str.val, &fi->func,
+		xc_install_function(xce->entry.name.str.val, &fi->func,
 				UNISW(0, fi->type), fi->key, fi->key_size, fi->h TSRMLS_CC);
 	}
@@ -761,8 +789,8 @@
 #endif
 #ifdef ZEND_COMPILE_DELAYED_BINDING
-		xc_install_class(xce->name.str.val, &ci->cest, -1,
+		xc_install_class(xce->entry.name.str.val, &ci->cest, -1,
 				UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC);
 #else
-		xc_install_class(xce->name.str.val, &ci->cest, ci->oplineno,
+		xc_install_class(xce->entry.name.str.val, &ci->cest, ci->oplineno,
 				UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC);
 #endif
@@ -787,5 +815,5 @@
 
 	i = 1;
-	zend_hash_add(&EG(included_files), xce->name.str.val, xce->name.str.len+1, (void *)&i, sizeof(int), NULL);
+	zend_hash_add(&EG(included_files), xce->entry.name.str.val, xce->entry.name.str.len+1, (void *)&i, sizeof(int), NULL);
 	if (h) {
 		zend_llist_add_element(&CG(open_files), h);
@@ -816,6 +844,6 @@
 					xce = (xc_entry_t*) xc_stack_pop(s);
 					TRACE("unhold %s", xce->name.str.val);
-					xce->refcount --;
-					assert(xce->refcount >= 0);
+					((xc_entry_php_t *) xce)->refcount ++;
+					assert(((xc_entry_php_t *) xce)->refcount >= 0);
 				}
 			} LEAVE_LOCK(cache);
@@ -885,4 +913,22 @@
 /* }}} */
 
+#if 0 /* {{{ note about php hashing */
+the folling note is written in the form of "got = from"
+
+TODO: open_basedir
+
+opened_path = stat || zend_compile_file
+
+phphashid = inode ? inode : hash(basename)
+md5key = md5(relativepath)
+md5hashid = hash(md5key)
+cachehashid = multislot ? hash(basename) : hash(phphashid)
+
+cached = phphashid -> md5key -> cachedmd5info -> cachedphp
+cachedphp = [phphashid, fullpath]
+restoredphp = [fullpath, phphashid]
+
+#endif /* }}} */
+
 #define HASH(i) (i)
 #define HASH_ZSTR_L(t, s, l) HASH(zend_u_inline_hash_func((t), (s), ((l) + 1) * sizeof(UChar)))
@@ -907,22 +953,11 @@
 }
 /* }}} */
-#define xc_entry_hash_var xc_entry_hash_name
-static inline xc_hash_value_t xc_entry_hash_php(xc_entry_t *xce TSRMLS_DC) /* {{{ */
-{
-#ifdef HAVE_INODE
-	if (xce->inode) {
-		return HASH(xce->device + xce->inode);
-	}
-#endif
-	return xc_entry_hash_name(xce TSRMLS_CC);
-}
-/* }}} */
-static inline xc_hash_value_t xc_entry_hash_php_basename(xc_entry_t *xce TSRMLS_DC) /* {{{ */
+static inline xc_hash_value_t xc_entry_hash_php_basename(xc_entry_php_t *xce TSRMLS_DC) /* {{{ */
 {
 #ifdef IS_UNICODE
-	if (UG(unicode) && xce->name_type == IS_UNICODE) {
+	if (UG(unicode) && xce->entry.name_type == IS_UNICODE) {
 		zstr basename;
 		size_t basename_len;
-		php_u_basename(xce->name.ustr.val, xce->name.ustr.len, NULL, 0, &basename.u, &basename_len TSRMLS_CC);
+		php_u_basename(xce->entry.name.ustr.val, xce->entry.name.ustr.len, NULL, 0, &basename.u, &basename_len TSRMLS_CC);
 		return HASH_ZSTR_L(IS_UNICODE, basename, basename_len);
 	}
@@ -934,7 +969,7 @@
 		size_t basename_len;
 #ifdef ZEND_ENGINE_2
-		php_basename(xce->name.str.val, xce->name.str.len, "", 0, &basename, &basename_len TSRMLS_CC);
+		php_basename(xce->entry.name.str.val, xce->entry.name.str.len, "", 0, &basename, &basename_len TSRMLS_CC);
 #else
-		basename = php_basename(xce->name.str.val, xce->name.str.len, "", 0);
+		basename = php_basename(xce->entry.name.str.val, xce->entry.name.str.len, "", 0);
 		basename_len = strlen(basename);
 #endif
@@ -945,5 +980,15 @@
 }
 /* }}} */
-static void xc_entry_free_key_php(xc_entry_t *xce TSRMLS_DC) /* {{{ */
+#define xc_entry_hash_var xc_entry_hash_name
+static inline xc_hash_value_t xc_entry_hash_php(xc_entry_php_t *xce TSRMLS_DC) /* {{{ */
+{
+	return
+#ifdef HAVE_INODE
+		xce->file_inode ? HASH(xce->file_device + xce->file_inode) :
+#endif
+		xc_entry_hash_php_basename(xce TSRMLS_CC);
+}
+/* }}} */
+static void xc_entry_free_key_php(xc_entry_php_t *xce TSRMLS_DC) /* {{{ */
 {
 #define X_FREE(var) do {\
@@ -962,5 +1007,5 @@
 /* }}} */
 
-static int xc_entry_init_key_php(xc_entry_t *xce, const char *filename TSRMLS_DC) /* {{{ */
+static int xc_entry_init_key_php(xc_entry_php_t *xce, const char *filename TSRMLS_DC) /* {{{ */
 {
 	char opened_path_buffer[MAXPATHLEN];
@@ -1027,22 +1072,22 @@
 		}
 
-		xce->mtime        = pbuf->st_mtime;
+		xce->file_mtime   = pbuf->st_mtime;
 #ifdef HAVE_INODE
-		xce->device       = pbuf->st_dev;
-		xce->inode        = pbuf->st_ino;
-#endif
-		xce->data.php->sourcesize = pbuf->st_size;
+		xce->file_device  = pbuf->st_dev;
+		xce->file_inode   = pbuf->st_ino;
+#endif
+		xce->entry.data.php->file_size = pbuf->st_size;
 	}
 	else { /* XG(inode) */
-		xce->mtime        = 0;
+		xce->file_mtime   = 0;
 #ifdef HAVE_INODE
-		xce->device       = 0;
-		xce->inode        = 0;
-#endif
-		xce->data.php->sourcesize = 0;
+		xce->file_device  = 0;
+		xce->file_inode   = 0;
+#endif
+		xce->entry.data.php->file_size = 0;
 	}
 
 #ifdef HAVE_INODE
-	if (!xce->inode)
+	if (!xce->file_inode)
 #endif
 	{
@@ -1055,12 +1100,12 @@
 	}
 
-	UNISW(NOTHING, xce->name_type = IS_STRING;)
-	xce->name.str.val = (char *) filename;
-	xce->name.str.len = strlen(filename);
+	UNISW(NOTHING, xce->entry.name_type = IS_STRING;)
+	xce->entry.name.str.val = (char *) filename;
+	xce->entry.name.str.len = strlen(filename);
 
 	cacheid = xc_php_hcache.size > 1 ? xc_hash_fold(xc_entry_hash_php_basename(xce TSRMLS_CC), &xc_php_hcache) : 0;
-	xce->cache = xc_php_caches[cacheid];
-	xce->hvalue = xc_hash_fold(xc_entry_hash_php(xce TSRMLS_CC), &xc_php_hentry);
-	xce->type = XC_TYPE_PHP;
+	xce->entry.cache = xc_php_caches[cacheid];
+	xce->entry.hvalue = xc_hash_fold(xc_entry_hash_php(xce TSRMLS_CC), &xc_php_hentry);
+	xce->entry.type = XC_TYPE_PHP;
 	xce->filepath  = NULL;
 	xce->dirpath   = NULL;
@@ -1078,5 +1123,5 @@
 }
 /* }}} */
-static int xc_entry_init_key_php_md5(xc_entry_data_php_t *php, xc_entry_t *xce TSRMLS_DC) /* {{{ */
+static int xc_entry_init_key_php_md5(xc_entry_data_php_t *php, xc_entry_php_t *xce TSRMLS_DC) /* {{{ */
 {
 	unsigned char   buf[1024];
@@ -1086,5 +1131,5 @@
 	ulong           old_rsid = EG(regular_list).nNextFreeElement;
 
-	stream = php_stream_open_wrapper(xce->name.str.val, "rb", USE_PATH | REPORT_ERRORS | ENFORCE_SAFE_MODE | STREAM_DISABLE_OPEN_BASEDIR, NULL);
+	stream = php_stream_open_wrapper(xce->entry.name.str.val, "rb", USE_PATH | REPORT_ERRORS | ENFORCE_SAFE_MODE | STREAM_DISABLE_OPEN_BASEDIR, NULL);
 	if (!stream) {
 		return FAILURE;
@@ -1106,5 +1151,5 @@
 	}
 
-	php->cache  = xce->cache;
+	php->cache  = xce->entry.cache;
 	php->hvalue = (xc_php_hash_md5(php TSRMLS_CC) & php->cache->hphp->mask);
 #ifdef XCACHE_DEBUG
@@ -1119,5 +1164,5 @@
 }
 /* }}} */
-static void xc_entry_init_key_php_entry(xc_entry_t *xce, ZEND_24(const) char *filepath TSRMLS_DC) /* {{{*/
+static void xc_entry_init_key_php_entry(xc_entry_php_t *xce, ZEND_24(const) char *filepath TSRMLS_DC) /* {{{*/
 {
 	xce->filepath     = filepath;
@@ -1178,5 +1223,5 @@
 } xc_const_usage_t;
 /* }}} */
-static void xc_collect_op_array_info(xc_entry_t *xce, xc_entry_data_php_t *php, xc_const_usage_t *usage, xc_op_array_info_t *op_array_info, zend_op_array *op_array TSRMLS_DC) /* {{{ */
+static void xc_collect_op_array_info(xc_entry_php_t *xce, xc_entry_data_php_t *php, xc_const_usage_t *usage, xc_op_array_info_t *op_array_info, zend_op_array *op_array TSRMLS_DC) /* {{{ */
 {
 	int i;
@@ -1277,5 +1322,5 @@
 }
 /* }}} */
-void xc_fix_op_array_info(const xc_entry_t *xce, const xc_entry_data_php_t *php, zend_op_array *op_array, int shallow_copy, const xc_op_array_info_t *op_array_info TSRMLS_DC) /* {{{ */
+void xc_fix_op_array_info(const xc_entry_php_t *xce, const xc_entry_data_php_t *php, zend_op_array *op_array, int shallow_copy, const xc_op_array_info_t *op_array_info TSRMLS_DC) /* {{{ */
 {
 	int i;
@@ -1468,5 +1513,5 @@
 }
 /* }}} */
-static zend_op_array *xc_compile_php(xc_entry_t *xce, xc_entry_data_php_t *php, zend_file_handle *h, int type TSRMLS_DC) /* {{{ */
+static zend_op_array *xc_compile_php(xc_entry_php_t *xce, xc_entry_data_php_t *php, zend_file_handle *h, int type TSRMLS_DC) /* {{{ */
 {
 	zend_op_array *op_array;
@@ -1701,18 +1746,18 @@
 }
 /* }}} */
-static zend_op_array *xc_compile_restore(xc_entry_t *stored_xce, zend_file_handle *h TSRMLS_DC) /* {{{ */
+static zend_op_array *xc_compile_restore(xc_entry_php_t *stored_xce, zend_file_handle *h TSRMLS_DC) /* {{{ */
 {
 	zend_op_array *op_array;
-	xc_entry_t xce;
+	xc_entry_php_t xce;
 	xc_entry_data_php_t php;
 	zend_bool catched;
 
 	CG(in_compilation)    = 1;
-	CG(compiled_filename) = stored_xce->name.str.val;
+	CG(compiled_filename) = stored_xce->entry.name.str.val;
 	CG(zend_lineno)       = 0;
-	TRACE("restoring %s", stored_xce->name.str.val);
-	xc_processor_restore_xc_entry_t(&xce, stored_xce TSRMLS_CC);
-	xc_processor_restore_xc_entry_data_php_t(stored_xce, &php, xce.data.php, xc_readonly_protection TSRMLS_CC);
-	xce.data.php = &php;
+	TRACE("restoring %s", stored_xce->entry.name.str.val);
+	xc_processor_restore_xc_entry_php_t(&xce, stored_xce TSRMLS_CC);
+	xc_processor_restore_xc_entry_data_php_t(stored_xce, &php, xce.entry.data.php, xc_readonly_protection TSRMLS_CC);
+	xce.entry.data.php = &php;
 #ifdef SHOW_DPRINT
 	xc_dprint(&xce, 0 TSRMLS_CC);
@@ -1753,10 +1798,10 @@
 }
 /* }}} */
-static zend_op_array *xc_compile_file_ex(xc_entry_t *xce, zend_file_handle *h, int type TSRMLS_DC) /* {{{ */
+static zend_op_array *xc_compile_file_ex(xc_entry_php_t *xce, zend_file_handle *h, int type TSRMLS_DC) /* {{{ */
 {
 	zend_op_array *op_array;
-	xc_entry_t *stored_xce;
+	xc_entry_php_t *stored_xce;
 	xc_entry_data_php_t *stored_php;
-	xc_cache_t *cache = xce->cache;
+	xc_cache_t *cache = xce->entry.cache;
 	zend_bool gaveup = 0;
 	zend_bool catched = 0;
@@ -1773,5 +1818,5 @@
 	stored_php = NULL;
 	ENTER_LOCK_EX(cache) {
-		stored_xce = xc_entry_find_dmz(xce TSRMLS_CC);
+		stored_xce = (xc_entry_php_t *) xc_entry_find_dmz((xc_entry_t *) xce TSRMLS_CC);
 		if (stored_xce) {
 			xc_cache_hit_dmz(cache TSRMLS_CC);
@@ -1784,10 +1829,10 @@
 			TRACE("miss %s", xce->name.str.val);
 
-			if (xc_entry_init_key_php_md5(xce->data.php, xce TSRMLS_CC) != SUCCESS) {
+			if (xc_entry_init_key_php_md5(xce->entry.data.php, xce TSRMLS_CC) != SUCCESS) {
 				gaveup = 1;
 				break;
 			}
 
-			stored_php = xc_php_find_dmz(xce->data.php TSRMLS_CC);
+			stored_php = xc_php_find_dmz(xce->entry.data.php TSRMLS_CC);
 
 			/* miss but compiling */
@@ -1829,5 +1874,5 @@
 		newlycompiled = 0;
 		xc_entry_init_key_php_entry(xce, h->opened_path ? h->opened_path : h->filename TSRMLS_CC);
-		xce->data.php = stored_php;
+		xce->entry.data.php = stored_php;
 	}
 	else {
@@ -1838,16 +1883,16 @@
 
 #ifdef HAVE_XCACHE_CONSTANT
-		xce->data.php->constinfos  = NULL;
-#endif
-		xce->data.php->funcinfos   = NULL;
-		xce->data.php->classinfos  = NULL;
+		xce->entry.data.php->constinfos  = NULL;
+#endif
+		xce->entry.data.php->funcinfos   = NULL;
+		xce->entry.data.php->classinfos  = NULL;
 #ifdef ZEND_ENGINE_2_1
-		xce->data.php->autoglobals = NULL;
-#endif
-
-		memset(&xce->data.php->op_array_info, 0, sizeof(xce->data.php->op_array_info));
+		xce->entry.data.php->autoglobals = NULL;
+#endif
+
+		memset(&xce->entry.data.php->op_array_info, 0, sizeof(xce->entry.data.php->op_array_info));
 
 		zend_try {
-			op_array = xc_compile_php(xce, xce->data.php, h, type TSRMLS_CC);
+			op_array = xc_compile_php(xce, xce->entry.data.php, h, type TSRMLS_CC);
 		} zend_catch {
 			catched = 1;
@@ -1859,5 +1904,5 @@
 
 		/* not cachable */
-		if (!xce->data.php->op_array) {
+		if (!xce->entry.data.php->op_array) {
 			cache->compiling = 0;
 			/* it's not cachable, but don't scare the users with high misses */
@@ -1874,9 +1919,9 @@
 	 * WARNING: this code is required to be after compile
 	 */
-	if (xce->inode) {
+	if (xce->file_inode) {
 		const char *filename = h->opened_path ? h->opened_path : h->filename;
-		if (xce->name.str.val != filename) {
-			xce->name.str.val = (char *) filename;
-			xce->name.str.len = strlen(filename);
+		if (xce->entry.name.str.val != filename) {
+			xce->entry.name.str.val = (char *) filename;
+			xce->entry.name.str.len = strlen(filename);
 		}
 	}
@@ -1890,5 +1935,5 @@
 		/* php_store */
 		if (newlycompiled) {
-			stored_php = xc_php_store_dmz(xce->data.php TSRMLS_CC);
+			stored_php = xc_php_store_dmz(xce->entry.data.php TSRMLS_CC);
 			if (!stored_php) {
 				/* error */
@@ -1898,7 +1943,7 @@
 		/* entry_store */
 		xc_php_addref_dmz(stored_php);
-		stored_xce = xc_entry_store_dmz(xce TSRMLS_CC);
+		stored_xce = xc_entry_php_store_dmz(xce TSRMLS_CC);
 		if (stored_xce) {
-			stored_xce->data.php = stored_php;
+			stored_xce->entry.data.php = stored_php;
 		}
 		else {
@@ -1916,5 +1961,5 @@
 
 	if (newlycompiled) {
-		xc_free_php(xce->data.php TSRMLS_CC);
+		xc_free_php(xce->entry.data.php TSRMLS_CC);
 	}
 
@@ -1947,5 +1992,5 @@
 err_aftersandbox:
 	if (newlycompiled) {
-		xc_free_php(xce->data.php TSRMLS_CC);
+		xc_free_php(xce->entry.data.php TSRMLS_CC);
 		xc_sandbox_free(&sandbox, XC_NoInstall TSRMLS_CC);
 	}
@@ -1962,5 +2007,5 @@
 {
 	zend_op_array *op_array;
-	xc_entry_t xce;
+	xc_entry_php_t xce;
 	xc_entry_data_php_t php;
 	const char *filename;
@@ -1976,5 +2021,5 @@
 	/* {{{ entry_init_key */
 	filename = h->opened_path ? h->opened_path : h->filename;
-	xce.data.php = &php;
+	xce.entry.data.php = &php;
 	if (xc_entry_init_key_php(&xce, filename TSRMLS_CC) != SUCCESS) {
 		TRACE("failed to init key for %s", filename);
@@ -2656,5 +2701,4 @@
 {
 	xc_entry_t xce, *stored_xce;
-	xc_entry_data_var_t var;
 	zval *name;
 	int found = 0;
@@ -2668,5 +2712,4 @@
 		return;
 	}
-	xce.data.var = &var;
 	xc_entry_init_key_var(&xce, name TSRMLS_CC);
 
@@ -2676,5 +2719,5 @@
 			if (!VAR_ENTRY_EXPIRED(stored_xce)) {
 				found = 1;
-				xc_processor_restore_zval(return_value, stored_xce->data.var->value, stored_xce->data.var->have_references TSRMLS_CC);
+				xc_processor_restore_zval(return_value, stored_xce->data.var.value, stored_xce->data.var.have_references TSRMLS_CC);
 				/* return */
 				break;
@@ -2700,5 +2743,4 @@
 {
 	xc_entry_t xce, *stored_xce;
-	xc_entry_data_var_t var;
 	zval *name;
 	zval *value;
@@ -2719,5 +2761,4 @@
 	}
 
-	xce.data.var = &var;
 	xc_entry_init_key_var(&xce, name TSRMLS_CC);
 
@@ -2727,5 +2768,5 @@
 			xc_entry_remove_dmz(stored_xce TSRMLS_CC);
 		}
-		var.value = value;
+		xce.data.var.value = value;
 		RETVAL_BOOL(xc_entry_store_dmz(&xce TSRMLS_CC) != NULL ? 1 : 0);
 	} LEAVE_LOCK(xce.cache);
@@ -2737,5 +2778,4 @@
 {
 	xc_entry_t xce, *stored_xce;
-	xc_entry_data_var_t var;
 	zval *name;
 	int found = 0;
@@ -2749,5 +2789,4 @@
 		return;
 	}
-	xce.data.var = &var;
 	xc_entry_init_key_var(&xce, name TSRMLS_CC);
 
@@ -2781,5 +2820,4 @@
 {
 	xc_entry_t xce, *stored_xce;
-	xc_entry_data_var_t var;
 	zval *name;
 
@@ -2792,5 +2830,4 @@
 		return;
 	}
-	xce.data.var = &var;
 	xc_entry_init_key_var(&xce, name TSRMLS_CC);
 
@@ -2843,5 +2880,4 @@
 {
 	xc_entry_t xce, *stored_xce;
-	xc_entry_data_var_t var, *stored_var;
 	zval *name;
 	long count = 1;
@@ -2864,5 +2900,4 @@
 	}
 
-	xce.data.var = &var;
 	xc_entry_init_key_var(&xce, name TSRMLS_CC);
 
@@ -2879,5 +2914,5 @@
 			else {
 				/* do it in place */
-				stored_var = stored_xce->data.var;
+				xc_entry_data_var_t *stored_var = &stored_xce->data.var;
 				if (Z_TYPE_P(stored_var->value) == IS_LONG) {
 					zval *zv;
@@ -2895,5 +2930,5 @@
 				else {
 					TRACE("%s", "incdec: notlong");
-					xc_processor_restore_zval(&oldzval, stored_xce->data.var->value, stored_xce->data.var->have_references TSRMLS_CC);
+					xc_processor_restore_zval(&oldzval, stored_xce->data.var.value, stored_xce->data.var.have_references TSRMLS_CC);
 					convert_to_long(&oldzval);
 					value = Z_LVAL(oldzval);
@@ -2908,5 +2943,5 @@
 		value += (inc == 1 ? count : - count);
 		RETVAL_LONG(value);
-		var.value = return_value;
+		stored_xce->data.var.value = return_value;
 
 		if (stored_xce) {
