poke-devel
[Top][All Lists]
Advanced

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

Re: grrr, GC disabled


From: Jose E. Marchesi
Subject: Re: grrr, GC disabled
Date: Thu, 17 Oct 2019 22:57:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

FYI.

Found the cause, and installed a fix.  Things seem to work properly
again.

GC is re-enabled :)


commit 71632e07ef097cac53e8326cd5cb4052f583a1d6
Author: Jose E. Marchesi <address@hidden>
Date:   Thu Oct 17 22:50:31 2019 +0200

    pkl: allocate pkl-asm data structures using the GC
    
    The macro-assembler structures contain PVM programs, which are
    allocated with malloc (inside Jitter) and in turn contain PVM values
    which are allocated with the GC malloc.  This easily leads to
    situations where there are no roots routing to to these PVM values and
    they get collected.
    
    This patch makes the asm data structures to be allocated with
    GC_malloc.  This fixes the current problems that led to the
    deactivation of the GC.
    
    GC is also activated again :)
    
    2019-10-17  Jose E. Marchesi  <address@hidden>
    
            * src/pkl-asm.c (pkl_asm_pushlevel): Use pvm_alloc instead of
            malloc.
            (pkl_asm_new): Likewise.
            (pkl_asm_poplevel): Do not free memory.
            (pkl_asm_finish): Likewise.
            * src/pvm-alloc.c (pvm_alloc_initialize): Enable garbage
            collection.

diff --git a/ChangeLog b/ChangeLog
index 8b0215c..74fdbbc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2019-10-17  Jose E. Marchesi  <address@hidden>
 
+       * src/pkl-asm.c (pkl_asm_pushlevel): Use pvm_alloc instead of
+       malloc.
+       (pkl_asm_new): Likewise.
+       (pkl_asm_poplevel): Do not free memory.
+       (pkl_asm_finish): Likewise.
+       * src/pvm-alloc.c (pvm_alloc_initialize): Enable garbage
+       collection.
+
+2019-10-17  Jose E. Marchesi  <address@hidden>
+
        * src/pkl.h: Add an additional POINTERS to pkl_compile_expression.
        * src/pkl.c (pkl_compile_expression): Likewise.
        * src/pk-cmd.c (pk_cmd_exec_1): Keep a `pointers' variable in the
diff --git a/src/pkl-asm.c b/src/pkl-asm.c
index 61f777d..2f3cd8c 100644
--- a/src/pkl-asm.c
+++ b/src/pkl-asm.c
@@ -130,7 +130,7 @@ static void
 pkl_asm_pushlevel (pkl_asm pasm, int env)
 {
   struct pkl_asm_level *level
-    = xmalloc (sizeof (struct pkl_asm_level));
+    = pvm_alloc (sizeof (struct pkl_asm_level));
 
   memset (level, 0, sizeof (struct pkl_asm_level));
   level->parent = pasm->level;
@@ -146,7 +146,6 @@ pkl_asm_poplevel (pkl_asm pasm)
   struct pkl_asm_level *level = pasm->level;
 
   pasm->level = level->parent;
-  free (level);
 }
 
 /* Append instructions to PROGRAM to push VAL into the stack.  */
@@ -916,7 +915,7 @@ pkl_asm
 pkl_asm_new (pkl_ast ast, pkl_compiler compiler,
              int prologue)
 {
-  pkl_asm pasm = xmalloc (sizeof (struct pkl_asm));
+  pkl_asm pasm = pvm_alloc (sizeof (struct pkl_asm));
   pvm_program program;
 
   memset (pasm, 0, sizeof (struct pkl_asm));
@@ -1006,7 +1005,6 @@ pkl_asm_finish (pkl_asm pasm, int epilogue, void 
**pointers)
 
   /* Free the assembler instance and return the assembled program to
      the user.  */
-  free (pasm);
   return program;
 }
 
diff --git a/src/pvm-alloc.c b/src/pvm-alloc.c
index 3430f75..b3c00a0 100644
--- a/src/pvm-alloc.c
+++ b/src/pvm-alloc.c
@@ -54,8 +54,6 @@ pvm_alloc_initialize ()
 {
   /* Initialize the Boehm Garbage Collector.  */
   GC_INIT ();
-  /* XXX */
-  GC_disable ();
 }
 
 void



reply via email to

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