From 2ff11b1ace0cba8a4bc610fb578a491dbe822375 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Fri, 9 Nov 2018 10:57:11 -0500 Subject: [PATCH] Experimental: remove unnecessary bignum code --- gc.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gc.c b/gc.c index f1c55afc..b935c124 100644 --- a/gc.c +++ b/gc.c @@ -864,10 +864,11 @@ char *gc_copy_obj(object dest, char *obj, gc_thread_data * thd) bignum_type *hp = dest; mark(hp) = thd->gc_alloc_color; type_of(hp) = bignum_tag; - ((bignum_type *)hp)->bn.used = ((bignum_type *)obj)->bn.used; - ((bignum_type *)hp)->bn.alloc = ((bignum_type *)obj)->bn.alloc; - ((bignum_type *)hp)->bn.sign = ((bignum_type *)obj)->bn.sign; - ((bignum_type *)hp)->bn.dp = ((bignum_type *)obj)->bn.dp; + // Bignums are always heap-allocated so there is nothing to copy + //((bignum_type *)hp)->bn.used = ((bignum_type *)obj)->bn.used; + //((bignum_type *)hp)->bn.alloc = ((bignum_type *)obj)->bn.alloc; + //((bignum_type *)hp)->bn.sign = ((bignum_type *)obj)->bn.sign; + //((bignum_type *)hp)->bn.dp = ((bignum_type *)obj)->bn.dp; return (char *)hp; } case cvar_tag:{ @@ -1282,8 +1283,9 @@ void *gc_alloc_bignum(gc_thread_data *data) int heap_grown, result; bignum_type *bn; bignum_type tmp; - tmp.hdr.mark = gc_color_red; - tmp.hdr.grayed = 0; + // No need to do this since tmp is always local + //tmp.hdr.mark = gc_color_red; + //tmp.hdr.grayed = 0; tmp.tag = bignum_tag; bn = gc_alloc(((gc_thread_data *)data)->heap, sizeof(bignum_type), (char *)(&tmp), (gc_thread_data *)data, &heap_grown);