bug-mes
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Three small patches


From: Gabriel Wicki
Subject: Three small patches
Date: Thu, 12 May 2022 20:02:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hey Janneke!
Hello list!

I interpret the recent increase in messages (and their contents) on this
list as a sign that development is rather accelerating than slowing
down, which is nice!  So i shall use that opportunity to report from my
end.  Unfortunately i had to renice my MES tasks to a lower priority;
but i'm still on it.  Slowly, but steadily :)

I currently am on a medium- to large detour from my original goal
(porting MEScc to RISC-V), by diving into the internals and inner
workings of this marvelous project, but i'm still focussed on my initial
goal.  Thus my personal agenda has been altered: clean up, simplify
and comment the code-base, document the more important parts of the
internals (inspired by Guile's Internal documentation, though probably
less exhaustive), generalize the existing infrastructure (i.e.
MEScc's assembly-module) to more naturally support non i386
architectures and finally: implement the RISC-V MEScc assembly
module.

I've attached three tiny patches.  There are more to come!

I wish you all the best,
gabriel




>From fb1076a23d6ead8e778e99dbe827bef66a1c6f34 Mon Sep 17 00:00:00 2001
From: Gabriel Wicki <gabriel@erlikon.ch>
Date: Tue, 10 May 2022 22:14:31 +0200
Subject: [PATCH] gc: remove news_bytes

it is identical to cell_bytes; the only reference to it was replaced
---
 include/mes/mes.h | 1 -
 src/gc.c          | 9 +--------
 2 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/include/mes/mes.h b/include/mes/mes.h
index 9ef6491e..337f03aa 100644
--- a/include/mes/mes.h
+++ b/include/mes/mes.h
@@ -153,7 +153,6 @@ struct scm *vector_ref_ (struct scm *x, long i);
 struct scm *vector_set_x_ (struct scm *x, long i, struct scm *e);
 FUNCTION builtin_function (struct scm *builtin);
 char *cell_bytes (struct scm *x);
-char *news_bytes (struct scm *x);
 int peekchar ();
 int readchar ();
 int unreadchar ();
diff --git a/src/gc.c b/src/gc.c
index 62643bbc..4a1df7cb 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -40,13 +40,6 @@ cell_bytes (struct scm *x)
   return p + (2 * sizeof (long));
 }
 
-char *
-news_bytes (struct scm *x)
-{
-  char *p = cast_voidp_to_charp (x);
-  return p + (2 * sizeof (long));
-}
-
 #define U10 10U
 // CONSTANT U10 10
 #define U100 100U
@@ -504,7 +497,7 @@ gc_copy (struct scm *old)               /*:((internal)) */
   else if (new->type == TBYTES)
     {
       char const *src = cell_bytes (old);
-      char *dest = news_bytes (new);
+      char *dest = cell_bytes (new);
       size_t length = new->length;
       memcpy (dest, src, length);
       g_free = g_free + ((bytes_cells (length) - 1) * M2_CELL_SIZE);
-- 
2.34.0


>From 1290ff4f8d2e244afae8188bfc0fd0d94bbc259e Mon Sep 17 00:00:00 2001
From: Gabriel Wicki <gabriel@erlikon.ch>
Date: Tue, 10 May 2022 22:17:20 +0200
Subject: [PATCH] gc: remove copy_news

it is identical to copy_cell.  two references were replaced
---
 src/gc.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/gc.c b/src/gc.c
index 4a1df7cb..e0b16aa0 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -212,14 +212,6 @@ copy_cell (struct scm *to, struct scm *from)
   to->cdr = from->cdr;
 }
 
-void
-copy_news (struct scm *to, struct scm *from)
-{
-  to->type = from->type;
-  to->car = from->car;
-  to->cdr = from->cdr;
-}
-
 void
 copy_stack (long index, struct scm *from)
 {
@@ -483,14 +475,14 @@ gc_copy (struct scm *old)               /*:((internal)) */
     return old->car;
   struct scm *new = g_free;
   g_free = g_free + M2_CELL_SIZE;
-  copy_news (new, old);
+  copy_cell (new, old);
   if (new->type == TSTRUCT || new->type == TVECTOR)
     {
       new->vector = g_free;
       long i;
       for (i = 0; i < old->length; i = i + 1)
         {
-          copy_news (g_free, cell_ref (old->vector, i));
+          copy_cell (g_free, cell_ref (old->vector, i));
           g_free = g_free + M2_CELL_SIZE;
         }
     }
-- 
2.34.0


>From b2252af7781e06f7303410befed56311615ec9f5 Mon Sep 17 00:00:00 2001
From: Gabriel Wicki <gabriel@erlikon.ch>
Date: Tue, 10 May 2022 22:23:40 +0200
Subject: [PATCH] gc: simplify math expressions

---
 src/gc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gc.c b/src/gc.c
index e0b16aa0..6834d6af 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -326,11 +326,11 @@ void
 gc_up_arena ()
 {
   long old_arena_bytes = (ARENA_SIZE + JAM_SIZE) * sizeof (struct scm);
-  if (ARENA_SIZE >> 1 < MAX_ARENA_SIZE >> 2)
+  if (ARENA_SIZE / 2 < MAX_ARENA_SIZE / 4)
     {
-      ARENA_SIZE = ARENA_SIZE << 1;
-      JAM_SIZE = JAM_SIZE << 1;
-      GC_SAFETY = GC_SAFETY << 1;
+      ARENA_SIZE = ARENA_SIZE * 2;
+      JAM_SIZE = JAM_SIZE * 2;
+      GC_SAFETY = GC_SAFETY * 2;
     }
   else
     ARENA_SIZE = MAX_ARENA_SIZE - JAM_SIZE;
@@ -448,7 +448,7 @@ void
 gc_flip ()
 {
   if (g_free - g_news > JAM_SIZE)
-    JAM_SIZE = (g_free - g_news) + ((g_free - g_news) / 2);
+    JAM_SIZE = ((g_free - g_news) * 3) / 2;
 
   cell_arena = g_cells - M2_CELL_SIZE; /* For debugging. */
   gc_cellcpy (g_cells, g_news, (g_free - g_news) / M2_CELL_SIZE);
-- 
2.34.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]