summaryrefslogtreecommitdiff
path: root/src/lib/eo/eo_ptr_indirection.x
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2015-11-09 11:45:04 +0000
committerTom Hacohen <tom@stosb.com>2016-03-03 09:53:23 +0000
commitfc88037977dcc39dfd6d817c522cce01f5bfa024 (patch)
treec5ed3292e2d137c63e37adbd47af8289d0a67980 /src/lib/eo/eo_ptr_indirection.x
parenta6347f88fd60550c871b1505dbff63c3509f651c (diff)
downloadefl-fc88037977dcc39dfd6d817c522cce01f5bfa024.tar.gz
Eo: Migrate to the new syntax (Eo 4).
The syntax is described in: https://phab.enlightenment.org/w/eo/ Summary: eo_do(obj, a_set(1)) -> a_set(obj, 1) eo_do_super(obj, CLASS, a_set(1)) -> a_set(eo_super(obj, CLASS), 1) eo_do_*_ret() set of functions are no longer needed. This is the first step, the next step would be to also fix up eo_add() which currently still uses the old syntax and is not 100% portable. @feature
Diffstat (limited to 'src/lib/eo/eo_ptr_indirection.x')
-rw-r--r--src/lib/eo/eo_ptr_indirection.x21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/lib/eo/eo_ptr_indirection.x b/src/lib/eo/eo_ptr_indirection.x
index 2faae7529e..0e6ef34571 100644
--- a/src/lib/eo/eo_ptr_indirection.x
+++ b/src/lib/eo/eo_ptr_indirection.x
@@ -57,14 +57,14 @@
* it to the fifo.
*/
-/* most significant bit is kept to tag Eo_Id with 1 */
#if SIZEOF_UINTPTR_T == 4
/* 32 bits */
# define BITS_MID_TABLE_ID 5
# define BITS_TABLE_ID 5
# define BITS_ENTRY_ID 12
-# define BITS_GENERATION_COUNTER 9
-# define REF_TAG_SHIFT 31
+# define BITS_GENERATION_COUNTER 8
+# define REF_TAG_SHIFT 30
+# define SUPER_TAG_SHIF 31
# define DROPPED_TABLES 0
# define DROPPED_ENTRIES 4
typedef int16_t Table_Index;
@@ -74,8 +74,9 @@ typedef uint16_t Generation_Counter;
# define BITS_MID_TABLE_ID 11
# define BITS_TABLE_ID 11
# define BITS_ENTRY_ID 12
-# define BITS_GENERATION_COUNTER 29
-# define REF_TAG_SHIFT 63
+# define BITS_GENERATION_COUNTER 28
+# define REF_TAG_SHIFT 62
+# define SUPER_TAG_SHIFT 63
# define DROPPED_TABLES 2
# define DROPPED_ENTRIES 3
typedef int16_t Table_Index;
@@ -101,6 +102,15 @@ typedef uint32_t Generation_Counter;
#define MASK_ENTRY_ID ((1 << BITS_ENTRY_ID) - 1)
#define MASK_GENERATIONS (MAX_GENERATIONS - 1)
#define MASK_OBJ_TAG (((Eo_Id) 1) << (REF_TAG_SHIFT))
+/* When we have EO_ID use the highest bit.
+ When we don't have EO_ID, we can repurpose the lowest bit, because allocation
+ is at least 8 byte aligned.
+ XXX: If this is ever not the case, we need to allocate from a mempool and ensure it, or find another trick. */
+#ifdef HAVE_EO_ID
+# define MASK_SUPER_TAG (((Eo_Id) 1) << (SUPER_TAG_SHIFT))
+#else
+# define MASK_SUPER_TAG ((Eo_Id) 1)
+#endif
/* This only applies to classes. Used to artificially enlarge the class ids
* to reduce the likelihood of a clash with normal integers. */
@@ -417,7 +427,6 @@ _eo_id_allocate(const _Eo_Object *obj)
(entry - _current_table->entries),
entry->generation);
#else
- Eo_Id ret = 0x1;
(void) obj;
return MASK_OBJ_TAG;
#endif