Import boehm-gc snapshot, taken from
[official-gcc.git] / boehm-gc / stubborn.c
blob82f113896f985f6576c76afe129a4faaee12c369
1 /*
2 * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
3 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
5 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
6 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
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.
15 #include "private/gc_priv.h"
17 #if defined(MANUAL_VDB)
19 /* Stubborn object (hard to change, nearly immutable) allocation. */
20 /* This interface is deprecated. We mostly emulate it using */
21 /* MANUAL_VDB. But that imposes the additional constraint that */
22 /* written, but not yet GC_dirty()ed objects must be referenced */
23 /* by a stack. */
25 void GC_dirty(ptr_t p);
27 GC_API void * GC_CALL GC_malloc_stubborn(size_t lb)
29 return(GC_malloc(lb));
32 GC_API void GC_CALL GC_end_stubborn_change(const void *p)
34 GC_dirty((ptr_t)p);
37 GC_API void GC_CALL GC_change_stubborn(const void *p GC_ATTR_UNUSED)
41 #else /* !MANUAL_VDB */
43 GC_API void * GC_CALL GC_malloc_stubborn(size_t lb)
45 return(GC_malloc(lb));
48 GC_API void GC_CALL GC_end_stubborn_change(const void *p GC_ATTR_UNUSED)
52 GC_API void GC_CALL GC_change_stubborn(const void *p GC_ATTR_UNUSED)
56 #endif /* !MANUAL_VDB */