~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to erts/emulator/hipe/hipe_native_bif.c

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-06-11 12:18:07 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090611121807-ks7eb4xrt7dsysgx
Tags: 1:13.b.1-dfsg-1
* New upstream release.
* Removed unnecessary dependency of erlang-os-mon on erlang-observer and
  erlang-tools and added missing dependency of erlang-nox on erlang-os-mon
  (closes: #529512).
* Removed a patch to eunit application because the bug was fixed upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
505
505
    return 1;
506
506
}
507
507
 
508
 
/*
509
 
 * Shallow copy to heap if possible; otherwise,
510
 
 * move to heap via garbage collection.
511
 
 */
512
 
 
513
 
#define MV_MSG_MBUF_INTO_PROC(M)                                        \
514
 
do {                                                                    \
515
 
    if ((M)->bp) {                                                      \
516
 
        Uint need = (M)->bp->size;                                      \
517
 
        Uint *htop = HEAP_TOP(c_p);                                     \
518
 
        if (c_p->stop - htop >= need) {                                 \
519
 
            erts_move_msg_mbuf_to_heap(&htop, &MSO(c_p), (M));          \
520
 
            ASSERT(htop - HEAP_TOP(c_p) == need);                       \
521
 
            HEAP_TOP(c_p) = htop;                                       \
522
 
        }                                                               \
523
 
        else {                                                          \
524
 
            /* SWAPOUT; */                                              \
525
 
            /* reg[0] = r(0); */                                        \
526
 
            /* PROCESS_MAIN_CHK_LOCKS(c_p); */                          \
527
 
            c_p->fcalls -= erts_garbage_collect(c_p, 0, NULL, 0);       \
528
 
            /* PROCESS_MAIN_CHK_LOCKS(c_p); */                          \
529
 
            /* r(0) = reg[0]; */                                        \
530
 
            /* SWAPIN; */                                               \
531
 
            ASSERT(!(M)->bp);                                           \
532
 
        }                                                               \
533
 
    }                                                                   \
534
 
    ASSERT(!(M)->bp);                                                   \
535
 
} while (0)
536
 
 
537
508
/* This is like the loop_rec_fr BEAM instruction
538
509
 */
539
510
Eterm hipe_check_get_msg(Process *c_p)
541
512
    Eterm ret;
542
513
    ErlMessage *msgp;
543
514
 
 
515
 next_message:
 
516
 
544
517
    msgp = PEEK_MESSAGE(c_p);
545
518
 
546
519
    if (!msgp) {
564
537
        }
565
538
#endif
566
539
    }
567
 
    MV_MSG_MBUF_INTO_PROC(msgp);
 
540
    ErtsMoveMsgAttachmentIntoProc(msgp, c_p, c_p->stop, HEAP_TOP(c_p),
 
541
                                  c_p->fcalls, (void) 0, (void) 0);
568
542
    ret = ERL_MESSAGE_TERM(msgp);
 
543
    if (is_non_value(ret)) {
 
544
        /*
 
545
         * A corrupt distribution message that we weren't able to decode;
 
546
         * remove it...
 
547
         */
 
548
        ASSERT(!msgp->data.attached);
 
549
        UNLINK_MESSAGE(c_p, msgp);
 
550
        free_message(msgp);
 
551
        goto next_message;
 
552
    }
569
553
    return ret;
570
554
}
571
555