Overview
| Comment: | Only use 4 bits to classify tagged pointers
This leaves 28/60 bits for the value. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | tagged-pointers |
| Files: | files | file ages | folders |
| SHA3-256: |
943cf978435fc8205f6a6c609138d2ac |
| User & Date: | js on 2020-07-04 00:24:54 |
| Other Links: | branch diff | manifest | tags |
Context
|
2020-07-04
| ||
| 00:40 | Use a regular int for the tagged pointer class ID (check-in: a8d453813c user: js tags: tagged-pointers) | |
| 00:24 | Only use 4 bits to classify tagged pointers (check-in: 943cf97843 user: js tags: tagged-pointers) | |
|
2020-07-01
| ||
| 21:32 | Merge trunk into branch "tagged-pointers" (check-in: 6d5cc25f0c user: js tags: tagged-pointers) | |
Changes
Modified src/runtime/lookup-asm/lookup-asm-x86-elf.S from [c25a1420f7] to [6468f2e74c].
| ︙ | ︙ | |||
59 60 61 62 63 64 65 66 | 0: call get_eip add eax, offset _GLOBAL_OFFSET_TABLE_ lea eax, [eax+\not_found@GOTOFF] jmp eax .Ltagged_pointer_\name: movzx edx, dl | > > < | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | 0: call get_eip add eax, offset _GLOBAL_OFFSET_TABLE_ lea eax, [eax+\not_found@GOTOFF] jmp eax .Ltagged_pointer_\name: and dl, 0xF shr dl, 1 movzx edx, dl call get_eip add eax, offset _GLOBAL_OFFSET_TABLE_ lea eax, [eax+objc_tagged_pointer_classes@GOTOFF] mov edx, [eax+edx*4] mov edx, [edx+32] |
| ︙ | ︙ |
Modified src/runtime/lookup-asm/lookup-asm-x86-win32.S from [db823a1fe8] to [6bf3eb314e].
| ︙ | ︙ | |||
51 52 53 54 55 56 57 58 | test eax, eax jz \not_found ret .Ltagged_pointer_\name: movzx edx, dl | > > < | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | test eax, eax jz \not_found ret .Ltagged_pointer_\name: and dl, 0xF shr dl, 1 movzx edx, dl mov eax, offset _objc_tagged_pointer_classes mov edx, [eax+edx*4] mov edx, [edx+32] jmp short .Lmain_\name .endm |
| ︙ | ︙ |
Modified src/runtime/lookup-asm/lookup-asm-x86_64-elf.S from [14d6290458] to [00fefd9a7f].
| ︙ | ︙ | |||
52 53 54 55 56 57 58 59 | test rax, rax jz short \not_found@PLT ret .Ltagged_pointer_\name: movzx r8, dil | > > < | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | test rax, rax jz short \not_found@PLT ret .Ltagged_pointer_\name: and dil, 0xF shr dil, 1 movzx r8, dil mov rax, [rip+objc_tagged_pointer_classes@GOTPCREL] mov r8, [rax+r8*8] mov r8, [r8+64] jmp short .Lmain_\name .type \name, %function |
| ︙ | ︙ |
Modified src/runtime/lookup-asm/lookup-asm-x86_64-win64.S from [c889c864a2] to [069968302a].
| ︙ | ︙ | |||
58 59 60 61 62 63 64 65 | 0: mov rcx, r10 mov rdx, r11 jmp \not_found .Ltagged_pointer_\name: movzx r8, cl | > > < | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | 0: mov rcx, r10 mov rdx, r11 jmp \not_found .Ltagged_pointer_\name: and cl, 0xF shr cl, 1 movzx r8, cl mov rax, offset objc_tagged_pointer_classes mov r8, [rax+r8*8] mov r8, [r8+56] jmp short .Lmain_\name .endm |
| ︙ | ︙ |
Modified src/runtime/tagged-pointer.m from [3ba8d16fba] to [1f64e311ce].
| ︙ | ︙ | |||
15 16 17 18 19 20 21 | * file. */ #import "ObjFWRT.h" #import "private.h" | > | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
* file.
*/
#import "ObjFWRT.h"
#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 uint_fast8_t taggedPointerClassesCount;
int_fast8_t
objc_registerTaggedPointerClass(Class class)
{
|
| ︙ | ︙ | |||
45 46 47 48 49 50 51 |
}
Class
object_getTaggedPointerClass(id object)
{
uintptr_t pointer = (uintptr_t)object;
| | < | | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
}
Class
object_getTaggedPointerClass(id object)
{
uintptr_t pointer = (uintptr_t)object;
pointer &= (1 << TAGGED_POINTER_BITS) - 1;
pointer >>= 1;
if (pointer >= NUM_TAGGED_POINTER_CLASSES)
return Nil;
return objc_tagged_pointer_classes[pointer];
}
uintptr_t
object_getTaggedPointerValue(id object)
{
uintptr_t pointer = (uintptr_t)object;
pointer >>= TAGGED_POINTER_BITS;
return pointer;
}
id
objc_createTaggedPointer(uint_fast8_t class, uintptr_t value)
{
uintptr_t pointer;
if (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;
}
|