Lines Matching refs:flags

286 static void *_Block_copy_internal(const void *arg, const int flags) {
288 const bool wantsOne = (WANTS_ONE & flags) == WANTS_ONE;
290 //printf("_Block_copy_internal(%p, %x)\n", arg, flags);
296 if (aBlock->flags & BLOCK_NEEDS_FREE) {
298 latching_incr_int(&aBlock->flags);
301 else if (aBlock->flags & BLOCK_IS_GC) {
303 if (wantsOne && ((latching_incr_int(&aBlock->flags) & BLOCK_REFCOUNT_MASK) == 1)) {
309 else if (aBlock->flags & BLOCK_IS_GLOBAL) {
319 result->flags &= ~(BLOCK_REFCOUNT_MASK); // XXX not needed
320 result->flags |= BLOCK_NEEDS_FREE | 1;
322 if (result->flags & BLOCK_HAS_COPY_DISPOSE) {
331 unsigned long int flags = aBlock->flags;
332 bool hasCTOR = (flags & BLOCK_HAS_CTOR) != 0;
338 flags &= ~(BLOCK_NEEDS_FREE|BLOCK_REFCOUNT_MASK); // XXX not needed
340 flags |= BLOCK_IS_GC | 1;
342 flags |= BLOCK_IS_GC;
343 result->flags = flags;
344 if (flags & BLOCK_HAS_COPY_DISPOSE) {
369 static void _Block_byref_assign_copy(void *dest, const void *arg, const int flags) {
373 //printf("_Block_byref_assign_copy called, byref destp %p, src %p, flags %x\n", destp, src, flags);
375 if (src->forwarding->flags & BLOCK_IS_GC) {
378 else if ((src->forwarding->flags & BLOCK_REFCOUNT_MASK) == 0) {
381 bool isWeak = ((flags & (BLOCK_FIELD_IS_BYREF|BLOCK_FIELD_IS_WEAK)) == (BLOCK_FIELD_IS_BYREF|BLOCK_FIELD_IS_WEAK));
384 copy->flags = src->flags | _Byref_flag_initial_value; // non-GC one for caller, one for stack
391 if (src->flags & BLOCK_HAS_COPY_DISPOSE) {
407 else if ((src->forwarding->flags & BLOCK_NEEDS_FREE) == BLOCK_NEEDS_FREE) {
408 latching_incr_int(&src->forwarding->flags);
422 //printf("_Block_byref_release %p called, flags are %x\n", shared_struct, shared_struct->flags);
425 if ((shared_struct->flags & BLOCK_NEEDS_FREE) == 0) {
428 refcount = shared_struct->flags & BLOCK_REFCOUNT_MASK;
432 else if ((latching_decr_int(&shared_struct->flags) & BLOCK_REFCOUNT_MASK) == 0) {
434 if (shared_struct->flags & BLOCK_HAS_COPY_DISPOSE) {
464 newCount = latching_decr_int(&aBlock->flags) & BLOCK_REFCOUNT_MASK;
467 if (aBlock->flags & BLOCK_IS_GC) {
473 else if (aBlock->flags & BLOCK_NEEDS_FREE) {
474 if (aBlock->flags & BLOCK_HAS_COPY_DISPOSE)(*aBlock->descriptor->dispose)(aBlock);
477 else if (aBlock->flags & BLOCK_IS_GLOBAL) {
492 if (aBlock->flags & BLOCK_IS_GC) {
537 The flags parameter of _Block_object_assign and _Block_object_dispose is set to
561 void _Block_object_assign(void *destAddr, const void *object, const int flags) {
562 //printf("_Block_object_assign(*%p, %p, %x)\n", destAddr, object, flags);
563 if ((flags & BLOCK_BYREF_CALLER) == BLOCK_BYREF_CALLER) {
564 if ((flags & BLOCK_FIELD_IS_WEAK) == BLOCK_FIELD_IS_WEAK) {
572 else if ((flags & BLOCK_FIELD_IS_BYREF) == BLOCK_FIELD_IS_BYREF) {
574 // flags will indicate if it holds a __weak reference and needs a special isa
575 _Block_byref_assign_copy(destAddr, object, flags);
578 else if ((flags & BLOCK_FIELD_IS_BLOCK) == BLOCK_FIELD_IS_BLOCK) {
580 _Block_assign(_Block_copy_internal(object, flags), destAddr);
583 else if ((flags & BLOCK_FIELD_IS_OBJECT) == BLOCK_FIELD_IS_OBJECT) {
594 void _Block_object_dispose(const void *object, const int flags) {
595 //printf("_Block_object_dispose(%p, %x)\n", object, flags);
596 if (flags & BLOCK_FIELD_IS_BYREF) {
600 else if ((flags & (BLOCK_FIELD_IS_BLOCK|BLOCK_BYREF_CALLER)) == BLOCK_FIELD_IS_BLOCK) {
605 else if ((flags & (BLOCK_FIELD_IS_WEAK|BLOCK_FIELD_IS_BLOCK|BLOCK_BYREF_CALLER)) == BLOCK_FIELD_IS_OBJECT) {
629 if (! (closure->flags & BLOCK_HAS_DESCRIPTOR)) {
655 cp += sprintf(cp, "flags:");
656 if (closure->flags & BLOCK_HAS_DESCRIPTOR) {
659 if (closure->flags & BLOCK_NEEDS_FREE) {
662 if (closure->flags & BLOCK_IS_GC) {
665 if (closure->flags & BLOCK_HAS_COPY_DISPOSE) {
668 if (closure->flags & BLOCK_HAS_CTOR) {
671 cp += sprintf(cp, "\nrefcount: %u\n", closure->flags & BLOCK_REFCOUNT_MASK);
679 if (closure->flags & BLOCK_HAS_COPY_DISPOSE) {
693 cp += sprintf(cp, " flags: 0x%x\n", src->flags);
695 if (src->flags & BLOCK_HAS_COPY_DISPOSE) {