Differences From Artifact [1f64e311ce]:
- File
src/runtime/tagged-pointer.m
— part of check-in
[943cf97843]
at
2020-07-04 00:24:54
on branch tagged-pointers
— Only use 4 bits to classify tagged pointers
This leaves 28/60 bits for the value. (user: js, size: 1915) [annotate] [blame] [check-ins using]
To Artifact [eeba4c306c]:
- File src/runtime/tagged-pointer.m — part of check-in [a8d453813c] at 2020-07-04 00:40:47 on branch tagged-pointers — Use a regular int for the tagged pointer class ID (user: js, size: 1893) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
19 20 21 22 23 24 25 | #import "private.h" #define TAGGED_POINTER_BITS 4 #define NUM_TAGGED_POINTER_CLASSES (1 << (TAGGED_POINTER_BITS - 1)) Class objc_tagged_pointer_classes[NUM_TAGGED_POINTER_CLASSES]; | | | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #import "private.h" #define TAGGED_POINTER_BITS 4 #define NUM_TAGGED_POINTER_CLASSES (1 << (TAGGED_POINTER_BITS - 1)) Class objc_tagged_pointer_classes[NUM_TAGGED_POINTER_CLASSES]; static int taggedPointerClassesCount; int objc_registerTaggedPointerClass(Class class) { int i; objc_global_mutex_lock(); if (taggedPointerClassesCount == NUM_TAGGED_POINTER_CLASSES) { objc_global_mutex_unlock(); return -1; } |
︙ | ︙ | |||
66 67 68 69 70 71 72 | pointer >>= TAGGED_POINTER_BITS; return pointer; } id | | | | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | pointer >>= TAGGED_POINTER_BITS; return pointer; } id objc_createTaggedPointer(int class, uintptr_t value) { uintptr_t pointer; if (class < 0 || class >= NUM_TAGGED_POINTER_CLASSES) return nil; if (value > (UINTPTR_MAX >> TAGGED_POINTER_BITS)) return nil; pointer = (class << 1) | 1; pointer |= (value << TAGGED_POINTER_BITS); return (id)pointer; } |