Lines Matching refs:copy

5  * to any person obtaining a copy of this software and associated documentation
7 * including without limitation the rights to use, copy, modify, merge, publish,
285 /* Copy, or bump refcount, of a block. If really copying, call the copy helper if present. */
313 // Its a stack block. Make a copy.
323 //printf("calling block copy helper %p(%p, %p)...\n", aBlock->descriptor->copy, result, aBlock);
324 (*aBlock->descriptor->copy)(result, aBlock); // do fixup
330 // This allows the copy helper routines to make non-refcounted block copies under GC
337 // if we copy a malloc block to a GC block then we need to clear NEEDS_FREE.
345 //printf("calling block copy helper...\n");
346 (*aBlock->descriptor->copy)(result, aBlock); // do fixup
365 * Otherwise we need to copy it and update the stack forwarding pointer
379 //printf("making copy\n");
383 struct Block_byref *copy = (struct Block_byref *)_Block_allocator(src->size, false, isWeak);
384 copy->flags = src->flags | _Byref_flag_initial_value; // non-GC one for caller, one for stack
385 copy->forwarding = copy; // patch heap copy to point to itself (skip write-barrier)
386 src->forwarding = copy; // patch stack to point to heap copy
387 copy->size = src->size;
389 copy->isa = &_NSConcreteWeakBlockVariable; // mark isa field so it gets weak scanning
392 // Trust copy helper to copy everything of interest
394 copy->byref_keep = src->byref_keep;
395 copy->byref_destroy = src->byref_destroy;
396 (*src->byref_keep)(copy, src);
401 (void *)&copy->byref_keep,
535 In these cases helper functions are synthesized by the compiler for use in Block_copy and Block_release, called the copy and dispose helpers. The copy helper emits a call to the C++ const copy constructor for C++ stack based objects and for the rest calls into the runtime support function _Block_object_assign. The dispose helper has a call to the C++ destructor for case 1 and a call into _Block_object_dispose for the rest.
543 So the Block copy/dispose helpers should only ever generate the four flag values of 3, 7, 8, and 24.
545 When a __block variable is either a C++ object, an Objective-C object, or another Block then the compiler also generates copy/dispose helper functions. Similarly to the Block copy helper, the "__block" copy helper (formerly and still a.k.a. "byref" copy helper) will do a C++ copy constructor (not a const one though!) and the dispose helper will do the destructor. And similarly the helpers will call into the same two support functions with the same values for objects and Blocks with the additional BLOCK_BYREF_CALLER (128) bit of information supplied.
547 So the __block copy/dispose helpers will generate flag values of 3 or 7 for objects and Blocks respectively, with BLOCK_FIELD_IS_WEAK (16) or'ed as appropriate and always 128 or'd in, for the following set of possibilities:
558 * When Blocks or Block_byrefs hold objects then their copy routine helpers use this entry point
568 // do *not* retain or *copy* __block variables whatever they are
680 cp += sprintf(cp, "descriptor->copy helper: %p\n", (void *)(uintptr_t)dp->copy);
696 cp += sprintf(cp, " copy helper: %p\n", (void *)(uintptr_t)src->byref_keep);