Index: /trunk/admin/xcache.tpl.php
===================================================================
--- /trunk/admin/xcache.tpl.php	(revision 850)
+++ /trunk/admin/xcache.tpl.php	(revision 851)
@@ -212,5 +212,5 @@
 			$size     = size($entry['size']);
 			if ($isphp) {
-				$sourcesize  = size($entry['sourcesize']);
+				$file_size   = size($entry['file_size']);
 				$phprefcount = number_format($entry['phprefcount']);
 			}
@@ -246,11 +246,11 @@
 				echo <<<ENTRY
 				<td int="{$entry['phprefcount']}">{$phprefcount}</td>
-				<td int="{$entry['sourcesize']}">{$sourcesize}</td>
+				<td int="{$entry['file_size']}">{$file_size}</td>
 				<td int="{$entry['mtime']}">{$mtime}</td>
 ENTRY;
-				if (isset($entry['inode'])) {
+				if (isset($entry['file_inode'])) {
 					echo <<<ENTRY
-					<td int="{$entry['device']}">{$entry['device']}</td>
-					<td int="{$entry['inode']}">{$entry['inode']}</td>
+					<td int="{$entry['file_device']}">{$entry['file_device']}</td>
+					<td int="{$entry['file_inode']}">{$entry['file_inode']}</td>
 ENTRY;
 				}
Index: /trunk/processor/head.m4
===================================================================
--- /trunk/processor/head.m4	(revision 850)
+++ /trunk/processor/head.m4	(revision 851)
@@ -82,6 +82,6 @@
 	zend_bool reference; /* enable if to deal with reference */
 	zend_bool have_references;
-	const xc_entry_t *entry_src;
-	const xc_entry_t *entry_dst;
+	const xc_entry_php_t *entry_php_src;
+	const xc_entry_php_t *entry_php_dst;
 	const xc_entry_data_php_t *php_src;
 	const xc_entry_data_php_t *php_dst;
@@ -396,5 +396,5 @@
 	memset(&processor, 0, sizeof(processor));
 	processor.reference = 1;
-	processor.cache = src->cache;
+	processor.cache = src->ifelse(`$1', `xc_entry_php_t', entry.)cache;
 
 	IFASSERT(`xc_stack_init(&processor.allocsizes);')
@@ -416,10 +416,9 @@
 		zend_hash_destroy(&processor.strings);
 	}
-	src->size = processor.size;
-	ifelse(`$1', `xc_entry_t', `
-		src->data.var->have_references = processor.have_references;
-	', `
-		src->have_references = processor.have_references;
-	')
+	src->ifelse(`$1', `xc_entry_php_t', entry.)size = processor.size;
+	ifelse(
+		`$1', `xc_entry_t', `src->data.var.have_references = processor.have_references;',
+		`$1', `xc_entry_data_php_t', `src->have_references = processor.have_references;'
+	)
 
 	IFASSERT(`xc_stack_reverse(&processor.allocsizes);')
@@ -469,17 +468,18 @@
 ')
 DEFINE_STORE_API(`xc_entry_t')
+DEFINE_STORE_API(`xc_entry_php_t')
 DEFINE_STORE_API(`xc_entry_data_php_t')
-/* export: xc_entry_t *xc_processor_restore_xc_entry_t(xc_entry_t *dst, const xc_entry_t *src TSRMLS_DC); :export {{{ */
-xc_entry_t *xc_processor_restore_xc_entry_t(xc_entry_t *dst, const xc_entry_t *src TSRMLS_DC) {
+/* export: xc_entry_php_t *xc_processor_restore_xc_entry_php_t(xc_entry_php_t *dst, const xc_entry_php_t *src TSRMLS_DC); :export {{{ */
+xc_entry_php_t *xc_processor_restore_xc_entry_php_t(xc_entry_php_t *dst, const xc_entry_php_t *src TSRMLS_DC) {
 	xc_processor_t processor;
 
 	memset(&processor, 0, sizeof(processor));
-	xc_restore_xc_entry_t(&processor, dst, src TSRMLS_CC);
+	xc_restore_xc_entry_php_t(&processor, dst, src TSRMLS_CC);
 
 	return dst;
 }
 /* }}} */
-/* export: xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_t *xce, xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC); :export {{{ */
-xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_t *xce, xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC) {
+/* export: xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_php_t *xce, xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC); :export {{{ */
+xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_php_t *xce, xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC) {
 	xc_processor_t processor;
 
@@ -490,5 +490,5 @@
 		processor.reference = 1;
 	}
-	processor.entry_src = xce;
+	processor.entry_php_src = xce;
 
 	if (processor.reference) {
@@ -499,4 +499,14 @@
 		zend_hash_destroy(&processor.zvalptrs);
 	}
+	return dst;
+}
+/* }}} */
+/* export: xc_entry_t *xc_processor_restore_xc_entry_t(xc_entry_t *dst, const xc_entry_t *src TSRMLS_DC); :export {{{ */
+xc_entry_t *xc_processor_restore_xc_entry_t(xc_entry_t *dst, const xc_entry_t *src TSRMLS_DC) {
+	xc_processor_t processor;
+
+	memset(&processor, 0, sizeof(processor));
+	xc_restore_xc_entry_t(&processor, dst, src TSRMLS_CC);
+
 	return dst;
 }
@@ -522,7 +532,7 @@
 }
 /* }}} */
-/* export: void xc_dprint(xc_entry_t *src, int indent TSRMLS_DC); :export {{{ */
+/* export: void xc_dprint(xc_entry_php_t *src, int indent TSRMLS_DC); :export {{{ */
 #ifdef HAVE_XCACHE_DPRINT
-void xc_dprint(xc_entry_t *src, int indent TSRMLS_DC) {
+void xc_dprint(xc_entry_php_t *src, int indent TSRMLS_DC) {
 	IFDPRINT(`INDENT()`'fprintf(stderr, "xc_entry_t:src");')
 	xc_dprint_xc_entry_t(src, indent TSRMLS_CC);
Index: /trunk/processor/main.m4
===================================================================
--- /trunk/processor/main.m4	(revision 850)
+++ /trunk/processor/main.m4	(revision 851)
@@ -253,4 +253,5 @@
 EXPORT(`xc_funcinfo_t')
 EXPORT(`xc_entry_t')
+EXPORT(`xc_entry_php_t')
 EXPORT(`xc_entry_data_php_t')
 EXPORT(`zval')
Index: /trunk/processor/processor.m4
===================================================================
--- /trunk/processor/processor.m4	(revision 850)
+++ /trunk/processor/processor.m4	(revision 851)
@@ -431,5 +431,5 @@
 #	ifdef ZEND_ENGINE_2_4
 	DISABLECHECK(`
-	IFRESTORE(`dst->info.user.filename = processor->entry_src->filepath;', `PROC_STRING(info.user.filename)')
+	IFRESTORE(`dst->info.user.filename = processor->entry_php_src->filepath;', `PROC_STRING(info.user.filename)')
 	PROCESS(zend_uint, info.user.line_start)
 	PROCESS(zend_uint, info.user.line_end)
@@ -439,5 +439,5 @@
 	DONE(info)
 #	else
-	IFRESTORE(`dst->filename = processor->entry_src->filepath;DONE(filename)', `PROC_STRING(filename)')
+	IFRESTORE(`dst->filename = processor->entry_php_src->filepath;DONE(filename)', `PROC_STRING(filename)')
 	PROCESS(zend_uint, line_start)
 	PROCESS(zend_uint, line_end)
@@ -709,5 +709,5 @@
 		gc_arg_info = 1;
 #endif
-		dst->filename = processor->entry_src->filepath;
+		dst->filename = processor->entry_php_src->filepath;
 #ifdef ZEND_ENGINE_2_4
 		if (src->literals /* || op_array_info->literalsinfo_cnt */) {
@@ -886,5 +886,5 @@
 #endif
 
-	IFRESTORE(`dst->filename = processor->entry_src->filepath;DONE(filename)', `PROC_STRING(filename)')
+	IFRESTORE(`dst->filename = processor->entry_php_src->filepath;DONE(filename)', `PROC_STRING(filename)')
 #ifdef IS_UNICODE
 	IFRESTORE(`
@@ -914,5 +914,5 @@
 #endif
 	} while (0);
-	IFRESTORE(`xc_fix_op_array_info(processor->entry_src, processor->php_src, dst, shallow_copy, op_array_info TSRMLS_CC);')
+	IFRESTORE(`xc_fix_op_array_info(processor->entry_php_src, processor->php_src, dst, shallow_copy, op_array_info TSRMLS_CC);')
 
 #ifdef ZEND_ENGINE_2
@@ -1074,5 +1074,5 @@
 	PROCESS(zend_ulong, refcount)
 
-	PROCESS(size_t, sourcesize)
+	PROCESS(size_t, file_size)
 	PROCESS(zend_ulong, hits)
 	PROCESS(size_t, size)
@@ -1127,13 +1127,10 @@
 dnl }}}
 DEF_STRUCT_P_FUNC(`xc_entry_t', , `dnl {{{
+	PROCESS(xc_hash_value_t, hvalue)
+	/* skip */
+	DONE(next)
+	COPY(cache)
 	PROCESS(xc_entry_type_t, type)
 	PROCESS(size_t, size)
-
-	PROCESS(xc_hash_value_t, hvalue)
-	COPY(cache)
-	/* skip */
-	DONE(next)
-
-	IFSTORE(`dst->refcount = 0; DONE(refcount)', `PROCESS(long, refcount)')
 
 	PROCESS(time_t, ctime)
@@ -1176,5 +1173,5 @@
 
 		case XC_TYPE_VAR:
-			STRUCT_P(xc_entry_data_var_t, data.var)
+			STRUCT(xc_entry_data_var_t, data.var)
 			break;
 
@@ -1185,11 +1182,17 @@
 	DONE(data)
 	dnl }}}
-	PROCESS(time_t, mtime)
+')
+dnl }}}
+DEF_STRUCT_P_FUNC(`xc_entry_php_t', , `dnl {{{
+	STRUCT(xc_entry_t, entry)
+
+	IFSTORE(`dst->refcount = 0; DONE(refcount)', `PROCESS(long, refcount)')
+	PROCESS(time_t, file_mtime)
 #ifdef HAVE_INODE
-	PROCESS(int, device)
-	PROCESS(int, inode)
-#endif
-
-	if (src->type == XC_TYPE_PHP) {
+	PROCESS(int, file_device)
+	PROCESS(int, file_inode)
+#endif
+
+	if (src->entry.type == XC_TYPE_PHP) {
 		PROCESS(int, filepath_len)
 		IFRESTORE(`COPY(filepath)', `PROC_STRING_L(filepath, filepath_len)')
Index: /trunk/xcache.c
===================================================================
--- /trunk/xcache.c	(revision 850)
+++ /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) {
Index: /trunk/xcache.h
===================================================================
--- /trunk/xcache.h	(revision 850)
+++ /trunk/xcache.h	(revision 851)
@@ -262,6 +262,6 @@
 	zend_ulong errors;
 	xc_lock_t  *lck;
-	xc_shm_t   *shm; /* to which shm contains us */
-	xc_mem_t   *mem; /* to which mem contains us */
+	xc_shm_t   *shm; /* which shm contains us */
+	xc_mem_t   *mem; /* which mem contains us */
 
 	xc_entry_t **entries;
@@ -369,12 +369,12 @@
 /* {{{ xc_entry_data_php_t */
 struct _xc_entry_data_php_t {
-	xc_hash_value_t hvalue; /* hash of md5 */
+	xc_hash_value_t      hvalue;
 	xc_entry_data_php_t *next;
-	xc_cache_t *cache;      /* which cache it's on */
+	xc_cache_t          *cache;
 
 	xc_md5sum_t md5;        /* md5sum of the source */
 	zend_ulong  refcount;   /* count of entries referencing to this data */
 
-	size_t sourcesize;
+	size_t     file_size;
 	zend_ulong hits;        /* hits of this php */
 	size_t     size;
@@ -420,16 +420,16 @@
 /* {{{ xc_entry_t */
 struct _xc_entry_t {
+	xc_hash_value_t hvalue;
+	xc_entry_t     *next;
+	xc_cache_t     *cache;
+
 	xc_entry_type_t type;
-	xc_hash_value_t hvalue;
-	xc_entry_t *next;
-	xc_cache_t *cache;      /* which cache it's on */
-
-	size_t     size;
-	zend_ulong refcount;    /* count of instances holding this entry */
+	size_t          size;
+
+	time_t     ctime;           /* creation ctime of this entry */
+	time_t     atime;           /*   access atime of this entry */
+	time_t     dtime;           /*  deletion time of this entry */
 	zend_ulong hits;
-	time_t     ctime;           /* the ctime of this entry */
-	time_t     atime;           /* the atime of this entry */
-	time_t     dtime;           /* the deletion time of this entry */
-	long       ttl;             /* ttl of time entry, var only */
+	long       ttl;
 
 #ifdef IS_UNICODE
@@ -440,14 +440,18 @@
 	union {
 		xc_entry_data_php_t *php;
-		xc_entry_data_var_t *var;
+		xc_entry_data_var_t var;
 	} data;
-
-	time_t mtime;           /* the mtime of origin source file */
+};
+
+typedef struct {
+	xc_entry_t entry;
+
+	zend_ulong refcount;    /* count of php instances holding this entry */
+	time_t file_mtime;
 #ifdef HAVE_INODE
-	int device;             /* the filesystem device */
-	int inode;              /* the filesystem inode */
-#endif
-
-	/* php only */
+	int file_device;
+	int file_inode;
+#endif
+
 	int    filepath_len;
 	ZEND_24(const) char *filepath;
@@ -455,11 +459,10 @@
 	char  *dirpath;
 #ifdef IS_UNICODE
+	int    ufilepath_len;
 	UChar *ufilepath;
-	int    ufilepath_len;
+	int    udirpath_len;
 	UChar *udirpath;
-	int    udirpath_len;
-#endif
-
-};
+#endif
+} xc_entry_php_t;
 /* }}} */
 
@@ -480,5 +483,5 @@
 /* }}} */
 void xc_gc_add_op_array(xc_gc_op_array_t *gc_op_array TSRMLS_DC);
-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);
 
 #endif /* __XCACHE_H */
