summaryrefslogtreecommitdiff
path: root/typd_mlc.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2011-07-26 13:16:41 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 13:16:41 +0200
commit7d3768dbd2a1cd4d5c14f773f23aec43bc0651a5 (patch)
tree1cb52688b70322e994f4c2377ad715dbe8edb7d7 /typd_mlc.c
parentf9b1aa2161e755a5f5b772b5698aab8a63d0bef4 (diff)
gc4.12 tarball importgc4_12
Diffstat (limited to 'typd_mlc.c')
-rw-r--r--typd_mlc.c53
1 files changed, 50 insertions, 3 deletions
diff --git a/typd_mlc.c b/typd_mlc.c
index 7336e33..9ddda98 100644
--- a/typd_mlc.c
+++ b/typd_mlc.c
@@ -630,10 +630,13 @@ ptr_t GC_clear_stack();
#define GENERAL_MALLOC(lb,k) \
(GC_PTR)GC_clear_stack(GC_generic_malloc((word)lb, k))
+#define GENERAL_MALLOC_IOP(lb,k) \
+ (GC_PTR)GC_clear_stack(GC_generic_malloc_ignore_off_page((word)lb, k))
+
#if defined(__STDC__) || defined(__cplusplus)
- extern void * GC_malloc_explicitly_typed(size_t lb, GC_descr d)
+ void * GC_malloc_explicitly_typed(size_t lb, GC_descr d)
#else
- extern char * GC_malloc_explicitly_typed(lb, d)
+ char * GC_malloc_explicitly_typed(lb, d)
size_t lb;
GC_descr d;
#endif
@@ -666,9 +669,53 @@ DCL_LOCK_STATE;
}
} else {
op = (ptr_t)GENERAL_MALLOC((word)lb, GC_explicit_kind);
- if (0 == op) return(0);
+ if (op != NULL)
+ lw = BYTES_TO_WORDS(GC_size(op));
+ }
+ if (op != NULL)
+ ((word *)op)[lw - 1] = d;
+ return((GC_PTR) op);
+}
+
+#if defined(__STDC__) || defined(__cplusplus)
+ void * GC_malloc_explicitly_typed_ignore_off_page(size_t lb, GC_descr d)
+#else
+ char * GC_malloc_explicitly_typed_ignore_off_page(lb, d)
+ size_t lb;
+ GC_descr d;
+#endif
+{
+register ptr_t op;
+register ptr_t * opp;
+register word lw;
+DCL_LOCK_STATE;
+
+ lb += EXTRA_BYTES;
+ if( SMALL_OBJ(lb) ) {
+# ifdef MERGE_SIZES
+ lw = GC_size_map[lb];
+# else
+ lw = ALIGNED_WORDS(lb);
+# endif
+ opp = &(GC_eobjfreelist[lw]);
+ FASTLOCK();
+ if( !FASTLOCK_SUCCEEDED() || (op = *opp) == 0 ) {
+ FASTUNLOCK();
+ op = (ptr_t)GENERAL_MALLOC_IOP((word)lb, GC_explicit_kind);
+# ifdef MERGE_SIZES
+ lw = GC_size_map[lb]; /* May have been uninitialized. */
+# endif
+ } else {
+ *opp = obj_link(op);
+ GC_words_allocd += lw;
+ FASTUNLOCK();
+ }
+ } else {
+ op = (ptr_t)GENERAL_MALLOC_IOP((word)lb, GC_explicit_kind);
+ if (op != NULL)
lw = BYTES_TO_WORDS(GC_size(op));
}
+ if (op != NULL)
((word *)op)[lw - 1] = d;
return((GC_PTR) op);
}