~clint-fewbar/ubuntu/precise/erlang/merge-15b

« back to all changes in this revision

Viewing changes to erts/emulator/beam/erl_goodfit_alloc.c

  • Committer: Package Import Robot
  • Author(s): Sergei Golovan
  • Date: 2011-12-15 19:20:10 UTC
  • mfrom: (1.1.18) (3.5.15 sid)
  • mto: (3.5.16 sid)
  • mto: This revision was merged to the branch mainline in revision 33.
  • Revision ID: package-import@ubuntu.com-20111215192010-jnxcfe3tbrpp0big
Tags: 1:15.b-dfsg-1
* New upstream release.
* Upload to experimental because this release breaks external drivers
  API along with ABI, so several applications are to be fixed.
* Removed SSL patch because the old SSL implementation is removed from
  the upstream distribution.
* Removed never used patch which added native code to erlang beam files.
* Removed the erlang-docbuilder binary package because the docbuilder
  application was dropped by upstream.
* Documented dropping ${erlang-docbuilder:Depends} substvar in
  erlang-depends(1) manpage.
* Made erlang-base and erlang-base-hipe provide virtual package
  erlang-abi-15.b (the number means the first erlang version, which
  provides current ABI).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * %CopyrightBegin%
3
3
 *
4
 
 * Copyright Ericsson AB 2003-2010. All Rights Reserved.
 
4
 * Copyright Ericsson AB 2003-2011. All Rights Reserved.
5
5
 *
6
6
 * The contents of this file are subject to the Erlang Public License,
7
7
 * Version 1.1, (the "License"); you may not use this file except in
163
163
 
164
164
/* Prototypes of callback functions */
165
165
static Block_t *        get_free_block          (Allctr_t *, Uint,
166
 
                                                 Block_t *, Uint);
167
 
static void             link_free_block         (Allctr_t *, Block_t *);
168
 
static void             unlink_free_block       (Allctr_t *, Block_t *);
169
 
static void             update_last_aux_mbc     (Allctr_t *, Carrier_t *);
 
166
                                                 Block_t *, Uint, Uint32);
 
167
static void             link_free_block         (Allctr_t *, Block_t *, Uint32);
 
168
static void             unlink_free_block       (Allctr_t *, Block_t *, Uint32);
 
169
static void             update_last_aux_mbc     (Allctr_t *, Carrier_t *, Uint32);
170
170
static Eterm            info_options            (Allctr_t *, char *, int *,
171
171
                                                 void *, Uint **, Uint *);
172
172
static void             init_atoms              (void);
190
190
                 GFAllctrInit_t *gfinit,
191
191
                 AllctrInit_t *init)
192
192
{
193
 
    GFAllctr_t nulled_state = {{0}};
194
 
    /* {{0}} is used instead of {0}, in order to avoid (an incorrect) gcc
195
 
       warning. gcc warns if {0} is used as initializer of a struct when
196
 
       the first member is a struct (not if, for example, the third member
197
 
       is a struct). */
 
193
    struct {
 
194
        int dummy;
 
195
        GFAllctr_t allctr;
 
196
    } zero = {0};
 
197
    /* The struct with a dummy element first is used in order to avoid (an
 
198
       incorrect) gcc warning. gcc warns if {0} is used as initializer of
 
199
       a struct when the first member is a struct (not if, for example,
 
200
       the third member is a struct). */
 
201
 
198
202
    Allctr_t *allctr = (Allctr_t *) gfallctr;
199
203
 
200
 
    sys_memcpy((void *) gfallctr, (void *) &nulled_state, sizeof(GFAllctr_t));
 
204
    sys_memcpy((void *) gfallctr, (void *) &zero.allctr, sizeof(GFAllctr_t));
 
205
 
 
206
    init->sbmbct = 0; /* Small mbc not yet supported by goodfit */
201
207
 
202
208
    allctr->mbc_header_size             = sizeof(Carrier_t);
203
209
    allctr->min_mbc_size                = MIN_MBC_SZ;
379
385
 
380
386
static Block_t *
381
387
get_free_block(Allctr_t *allctr, Uint size,
382
 
               Block_t *cand_blk, Uint cand_size)
 
388
               Block_t *cand_blk, Uint cand_size, Uint32 flags)
383
389
{
384
390
    GFAllctr_t *gfallctr = (GFAllctr_t *) allctr;
385
391
    int unsafe_bi, min_bi;
398
404
        if (blk) {
399
405
            if (cand_blk && cand_size <= BLK_SZ(blk))
400
406
                return NULL; /* cand_blk was better */
401
 
            unlink_free_block(allctr, blk);
 
407
            unlink_free_block(allctr, blk, flags);
402
408
            return blk;
403
409
        }
404
410
        if (min_bi < NO_OF_BKTS - 1) {
418
424
    ASSERT(blk);
419
425
    if (cand_blk && cand_size <= BLK_SZ(blk))
420
426
        return NULL; /* cand_blk was better */
421
 
    unlink_free_block(allctr, blk);
 
427
    unlink_free_block(allctr, blk, flags);
422
428
    return blk;
423
429
}
424
430
 
425
431
 
426
432
 
427
433
static void
428
 
link_free_block(Allctr_t *allctr, Block_t *block)
 
434
link_free_block(Allctr_t *allctr, Block_t *block, Uint32 flags)
429
435
{
430
436
    GFAllctr_t *gfallctr = (GFAllctr_t *) allctr;
431
437
    GFFreeBlock_t *blk = (GFFreeBlock_t *) block;
446
452
}
447
453
 
448
454
static void
449
 
unlink_free_block(Allctr_t *allctr, Block_t *block)
 
455
unlink_free_block(Allctr_t *allctr, Block_t *block, Uint32 flags)
450
456
{
451
457
    GFAllctr_t *gfallctr = (GFAllctr_t *) allctr;
452
458
    GFFreeBlock_t *blk = (GFFreeBlock_t *) block;
467
473
}
468
474
 
469
475
static void
470
 
update_last_aux_mbc(Allctr_t *allctr, Carrier_t *mbc)
 
476
update_last_aux_mbc(Allctr_t *allctr, Carrier_t *mbc, Uint32 flags)
471
477
{
472
478
    GFAllctr_t *gfallctr = (GFAllctr_t *) allctr;
473
479