facebook / FBRetainCycleDetector

iOS library to help detecting retain cycles in runtime.
Other
4.22k stars 592 forks source link

Use a simpler way to get strong references of block. #101

Open LucasXu0 opened 4 years ago

LucasXu0 commented 4 years ago

Inspired by libclosure.

// Extended layout encoding.

// Values for Block_descriptor_3->layout with BLOCK_HAS_EXTENDED_LAYOUT
// and for Block_byref_3->layout with BLOCK_BYREF_LAYOUT_EXTENDED

// If the layout field is less than 0x1000, then it is a compact encoding 
// of the form 0xXYZ: X strong pointers, then Y byref pointers, 
// then Z weak pointers.

// If the layout field is 0x1000 or greater, it points to a 
// string of layout bytes. Each byte is of the form 0xPN.
// Operator P is from the list below. Value N is a parameter for the operator.
// Byte 0x00 terminates the layout; remaining block data is non-pointer bytes.
LucasXu0 commented 4 years ago

@aditya7fb Hi, Would you mind reviewing this PR? 😁

aditya7fb commented 4 years ago

LGTM