OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [boehm-gc/] [include/] [gc_inl.h] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 721 jeremybenn
/*
2
 * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
3
 * Copyright (c) 1991-1995 by Xerox Corporation.  All rights reserved.
4
 *
5
 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
6
 * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
7
 *
8
 * Permission is hereby granted to use or copy this program
9
 * for any purpose,  provided the above notices are retained on all copies.
10
 * Permission to modify the code and to distribute modified code is granted,
11
 * provided the above notices are retained, and a notice that the code was
12
 * modified is included with the above copyright notice.
13
 */
14
/* Boehm, October 3, 1995 2:07 pm PDT */
15
 
16
# ifndef GC_PRIVATE_H
17
#   include "private/gc_priv.h"
18
# endif
19
 
20
/* USE OF THIS FILE IS NOT RECOMMENDED unless GC_all_interior_pointers  */
21
/* is always set, or the collector has been built with                  */
22
/* -DDONT_ADD_BYTE_AT_END, or the specified size includes a pointerfree */
23
/* word at the end.  In the standard collector configuration,           */
24
/* the final word of each object may not be scanned.                    */
25
/* This iinterface is most useful for compilers that generate C.        */
26
/* Manual use is hereby discouraged.                                    */
27
 
28
/* Allocate n words (NOT BYTES).  X is made to point to the result.     */
29
/* It is assumed that n < MAXOBJSZ, and                                 */
30
/* that n > 0.  On machines requiring double word alignment of some     */
31
/* data, we also assume that n is 1 or even.                            */
32
/* If the collector is built with -DUSE_MARK_BYTES or -DPARALLEL_MARK,  */
33
/* the n = 1 case is also disallowed.                                   */
34
/* Effectively this means that portable code should make sure n is even.*/
35
/* This bypasses the                                                    */
36
/* MERGE_SIZES mechanism.  In order to minimize the number of distinct  */
37
/* free lists that are maintained, the caller should ensure that a      */
38
/* small number of distinct values of n are used.  (The MERGE_SIZES     */
39
/* mechanism normally does this by ensuring that only the leading three */
40
/* bits of n may be nonzero.  See misc.c for details.)  We really       */
41
/* recommend this only in cases in which n is a constant, and no        */
42
/* locking is required.                                                 */
43
/* In that case it may allow the compiler to perform substantial        */
44
/* additional optimizations.                                            */
45
# define GC_MALLOC_WORDS(result,n) \
46
{       \
47
    register ptr_t op;  \
48
    register ptr_t *opp;        \
49
    DCL_LOCK_STATE;     \
50
        \
51
    opp = &(GC_objfreelist[n]); \
52
    FASTLOCK(); \
53
    if( !FASTLOCK_SUCCEEDED() || (op = *opp) == 0 ) {    \
54
        FASTUNLOCK();   \
55
        (result) = GC_generic_malloc_words_small((n), NORMAL);  \
56
    } else {    \
57
        *opp = obj_link(op);    \
58
        obj_link(op) = 0;        \
59
        GC_words_allocd += (n); \
60
        FASTUNLOCK();   \
61
        (result) = (GC_PTR) op; \
62
    }   \
63
}
64
 
65
 
66
/* The same for atomic objects: */
67
# define GC_MALLOC_ATOMIC_WORDS(result,n) \
68
{       \
69
    register ptr_t op;  \
70
    register ptr_t *opp;        \
71
    DCL_LOCK_STATE;     \
72
        \
73
    opp = &(GC_aobjfreelist[n]);        \
74
    FASTLOCK(); \
75
    if( !FASTLOCK_SUCCEEDED() || (op = *opp) == 0 ) {    \
76
        FASTUNLOCK();   \
77
        (result) = GC_generic_malloc_words_small((n), PTRFREE); \
78
    } else {    \
79
        *opp = obj_link(op);    \
80
        obj_link(op) = 0;        \
81
        GC_words_allocd += (n); \
82
        FASTUNLOCK();   \
83
        (result) = (GC_PTR) op; \
84
    }   \
85
}
86
 
87
/* And once more for two word initialized objects: */
88
# define GC_CONS(result, first, second) \
89
{       \
90
    register ptr_t op;  \
91
    register ptr_t *opp;        \
92
    DCL_LOCK_STATE;     \
93
        \
94
    opp = &(GC_objfreelist[2]); \
95
    FASTLOCK(); \
96
    if( !FASTLOCK_SUCCEEDED() || (op = *opp) == 0 ) {    \
97
        FASTUNLOCK();   \
98
        op = GC_generic_malloc_words_small(2, NORMAL);  \
99
    } else {    \
100
        *opp = obj_link(op);    \
101
        GC_words_allocd += 2;   \
102
        FASTUNLOCK();   \
103
    } \
104
    ((word *)op)[0] = (word)(first);     \
105
    ((word *)op)[1] = (word)(second);   \
106
    (result) = (GC_PTR) op;     \
107
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.