poke-devel
[Top][All Lists]
Advanced

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

grrr, GC disabled


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

FYI.

I promise I will hunt the bug and reactivate the GC soon.  In the
meanwhile, the PVM will be leaking memory like if there is no
tomorrow...

commit 6ff9d5cebe0b7e889a2a2739a37b8848230e7346
Author: Jose E. Marchesi <address@hidden>
Date:   Thu Oct 17 14:08:39 2019 +0200

    alloc: temporarily disable garbage collection
    
    This patch temporarily disables the boehm GC.  There is a bug
    somewhere causing closures being finalized incorrectly.
    
    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
            stack and pass it to pkl_compile_expression.
            * src/pvm-alloc.c (pvm_alloc_initialize): Disable garbage
            collection.

diff --git a/ChangeLog b/ChangeLog
index 2e71a09..8b0215c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+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
+       stack and pass it to pkl_compile_expression.
+       * src/pvm-alloc.c (pvm_alloc_initialize): Disable garbage
+       collection.
+
+2019-10-16  Jose E. Marchesi  <address@hidden>
+
+       * src/pkl-asm.c (pkl_asm_new): fix pasm->pointers initialization.
+
 2019-10-16  Jose E. Marchesi  <address@hidden>
 
        * src/pkl-anal.c (pkl_anal2_ps_type_struct): adjust conditions for
diff --git a/src/pk-cmd.c b/src/pk-cmd.c
index d2db4cc..f572dc1 100644
--- a/src/pk-cmd.c
+++ b/src/pk-cmd.c
@@ -258,6 +258,13 @@ pk_cmd_exec_1 (char *str, struct pk_trie *cmds_trie, char 
*prefix)
   const char *a;
   int besilent = 0;
 
+  /* Note that the sole purpose of `pointers' is to serve as a root
+     (in the stack) for the GC, to prevent the boxed values in the
+     program returned by pkl_compile_expression below to be collected.
+     XXX this should be hidden by a pkl_prog abstraction most
+     probably.  */
+  void *pointers;
+
   /* Skip blanks, and return if the command is composed by only blank
      characters.  */
   p = skip_blanks (str);
@@ -352,7 +359,8 @@ pk_cmd_exec_1 (char *str, struct pk_trie *cmds_trie, char 
*prefix)
 
                     program_string = p;
                     prog = pkl_compile_expression (poke_compiler,
-                                                   program_string, &end);
+                                                   program_string, &end,
+                                                   &pointers);
                     if (prog != NULL)
                       {
                         argv[argc].val.prog = prog;
diff --git a/src/pkl-asm.c b/src/pkl-asm.c
index 8fb2332..61f777d 100644
--- a/src/pkl-asm.c
+++ b/src/pkl-asm.c
@@ -108,7 +108,7 @@ struct pkl_asm_level
    prologue.  */
 
 #define PKL_ASM_LEVEL(PASM) ((PASM)->level)
-#define PKL_AST_MAX_POINTERS 128
+#define PKL_AST_MAX_POINTERS 1024
 
 struct pkl_asm
 {
@@ -929,7 +929,7 @@ pkl_asm_new (pkl_ast ast, pkl_compiler compiler,
   pasm->program = program;
 
   pasm->pointers = pvm_alloc (sizeof (void*) * PKL_AST_MAX_POINTERS);
-  memset (pasm->pointers, 0, PKL_AST_MAX_POINTERS);
+  memset (pasm->pointers, 0, sizeof (void*) * PKL_AST_MAX_POINTERS);
   pasm->next_pointer = 0;
 
   if (prologue)
diff --git a/src/pkl.c b/src/pkl.c
index 0f81d4b..b1bd6ef 100644
--- a/src/pkl.c
+++ b/src/pkl.c
@@ -350,19 +350,13 @@ pkl_compile_statement (pkl_compiler compiler,
 
 pvm_program
 pkl_compile_expression (pkl_compiler compiler,
-                        char *buffer, char **end)
+                        char *buffer, char **end, void **pointers)
 {
   pkl_ast ast = NULL;
   pvm_program program;
   int ret;
   pkl_env env = NULL;
 
-  /* Note that the sole purpose of `pointers' is to serve as a root
-     (in the stack) for the GC, to prevent the boxed values in PROGRAM
-     to be collected.  Ugly as shit, but conservative garbage
-     collection doesn't really work.  */
-  void *pointers;
-
   compiler->compiling = PKL_COMPILING_EXPRESSION;
   env = pkl_env_dup_toplevel (compiler->env);
 
diff --git a/src/pkl.h b/src/pkl.h
index 8261788..b0a1ef3 100644
--- a/src/pkl.h
+++ b/src/pkl.h
@@ -92,7 +92,8 @@ int pkl_compile_statement (pkl_compiler compiler, char 
*buffer, char **end,
    return NULL.  */
 
 pvm_program pkl_compile_expression (pkl_compiler compiler,
-                                    char *buffer, char **end);
+                                    char *buffer, char **end,
+                                    void **pointers);
 
 /* Return the current compile-time environment in COMPILER.  */
 
diff --git a/src/pvm-alloc.c b/src/pvm-alloc.c
index b3c00a0..3430f75 100644
--- a/src/pvm-alloc.c
+++ b/src/pvm-alloc.c
@@ -54,6 +54,8 @@ 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]