]> git.donarmstrong.com Git - lilypond.git/commitdiff
T1155: Remove MODULE_GC_KLUDGE blocks.
authorIan Hulin <ian@hulin.org.uk>
Thu, 8 Jul 2010 22:54:20 +0000 (15:54 -0700)
committerPatrick McCarty <pnorcks@gmail.com>
Thu, 8 Jul 2010 23:02:24 +0000 (16:02 -0700)
These conditional compilation blocks were needed to support Guile V1.6.

Also rename ly_make_anonymous_module to ly_make_module.

(Modified the original patch to remove tab->space conversions.)

Signed-off-by: Patrick McCarty <pnorcks@gmail.com>
lily/book.cc
lily/include/ly-module.hh
lily/lily-lexer.cc
lily/lily-parser.cc
lily/ly-module.cc
lily/module-scheme.cc
lily/output-def.cc
lily/score.cc
scm/lily.scm

index f4dd09362c37e7a2bcdbcce84897817d39fd926e..efd26d44ebb6fe452b3cfe8a9af3cf4360b12db6 100644 (file)
@@ -61,13 +61,13 @@ Book::Book (Book const &s)
       paper_ = s.paper_->clone ();
       paper_->unprotect ();
     }
-  
+
   input_location_ = make_input (*s.origin ());
 
-  header_ = ly_make_anonymous_module (false);
+  header_ = ly_make_module (false);
   if (ly_is_module (s.header_))
     ly_module_copy (header_, s.header_);
-  
+
   SCM *t = &scores_;
   for (SCM p = s.scores_; scm_is_pair (p); p = scm_cdr (p))
     {
@@ -112,7 +112,7 @@ Book::mark_smob (SCM s)
   scm_gc_mark (book->scores_);
   scm_gc_mark (book->bookparts_);
   scm_gc_mark (book->input_location_);
-  
+
   return book->header_;
 }
 
@@ -141,7 +141,7 @@ Book::set_parent (Book *parent)
   /* Copy the header block of the parent */
   if (ly_is_module (parent->header_))
     {
-      SCM tmp_header = ly_make_anonymous_module (false);
+      SCM tmp_header = ly_make_module (false);
       ly_module_copy (tmp_header, parent->header_);
       if (ly_is_module (header_))
         ly_module_copy (tmp_header, header_);
@@ -158,7 +158,7 @@ Book::add_scores_to_bookpart ()
 {
   if (scm_is_pair (scores_))
     {
-      /* If scores have been added to this book, add them to a child 
+      /* If scores have been added to this book, add them to a child
        * book part */
       Book *part = new Book;
       part->set_parent (this);
@@ -185,7 +185,7 @@ Book::error_found ()
     if (Score *score = unsmob_score (scm_car (s)))
       if (score->error_found_)
        return true;
-  
+
   for (SCM part = bookparts_; scm_is_pair (part); part = scm_cdr (part))
     if (Book *bookpart = unsmob_book (scm_car (part)))
       if (bookpart->error_found ())
@@ -228,11 +228,11 @@ Book::process_score (SCM s, Paper_book *output_paper_book, Output_def *layout)
     {
       SCM outputs = score
        ->book_rendering (output_paper_book->paper_, layout);
-             
+
       while (scm_is_pair (outputs))
        {
          Music_output *output = unsmob_music_output (scm_car (outputs));
-                 
+
          if (Performance *perf = dynamic_cast<Performance *> (output))
            output_paper_book->add_performance (perf->self_scm ());
          else if (Paper_score *pscore = dynamic_cast<Paper_score *> (output))
@@ -241,7 +241,7 @@ Book::process_score (SCM s, Paper_book *output_paper_book, Output_def *layout)
                output_paper_book->add_score (score->get_header ());
              output_paper_book->add_score (pscore->self_scm ());
            }
-                 
+
          outputs = scm_cdr (outputs);
        }
     }
@@ -250,7 +250,7 @@ Book::process_score (SCM s, Paper_book *output_paper_book, Output_def *layout)
     output_paper_book->add_score (scm_car (s));
   else
     assert (0);
-    
+
 }
 
 /* Concatenate all score or book part outputs into a Paper_book
index 0a7fdc8726c7a305fd099eb6a7f6af9a3b8f3a97..89fbbefa806e7f0684598b28330b83720432cfae 100644 (file)
@@ -22,7 +22,7 @@
 #include "config.hh"
 #include "lily-guile.hh"
 
-SCM ly_make_anonymous_module (bool safe);
+SCM ly_make_module (bool safe);
 SCM ly_module_copy (SCM dest, SCM src);
 SCM ly_module_2_alist (SCM mod);
 SCM ly_module_lookup (SCM module, SCM sym);
@@ -30,8 +30,7 @@ SCM ly_modules_lookup (SCM modules, SCM sym, SCM);
 SCM ly_module_symbols (SCM mod);
 void ly_reexport_module (SCM mod);
 inline bool ly_is_module (SCM x) { return SCM_MODULEP (x); }
-SCM ly_clear_anonymous_modules ();
-void clear_anonymous_modules ();
+
 SCM ly_use_module (SCM mod, SCM used);
 
 /* For backward compatability with Guile 1.8 */
@@ -40,7 +39,6 @@ typedef SCM (*scm_t_hash_fold_fn) (GUILE_ELLIPSIS);
 typedef SCM (*scm_t_hash_handle_fn) (GUILE_ELLIPSIS);
 #endif
 
-#define MODULE_GC_KLUDGE
 
 #endif /* LY_MODULE_HH */
 
index d3673f2cdfbbea141d3edf80b56727be4285953f..5a34d60bbe5146bcd6a14c4d4b32057bbda2c7af 100644 (file)
@@ -109,7 +109,7 @@ Lily_lexer::Lily_lexer (Sources *sources, Lily_parser *parser)
   chord_repetition_ = Chord_repetition ();
   smobify_self ();
 
-  add_scope (ly_make_anonymous_module (false));
+  add_scope (ly_make_module (false));
   push_note_state (scm_c_make_hash_table (0));
   chordmodifier_tab_ = scm_make_vector (scm_from_int (1), SCM_EOL);
 }
@@ -136,7 +136,7 @@ Lily_lexer::Lily_lexer (Lily_lexer const &src, Lily_parser *parser)
   SCM *tail = &scopes;
   for (SCM s = src.scopes_; scm_is_pair (s); s = scm_cdr (s))
     {
-      SCM newmod = ly_make_anonymous_module (false);
+      SCM newmod = ly_make_module (false);
       ly_module_copy (newmod, scm_car (s));
       *tail = scm_cons (newmod, SCM_EOL);
       tail = SCM_CDRLOC (*tail);
index 6d3e13072ad0c48bb753fd7f49ecf454b4250dff..4d4b3ac33e609d8375c17b51bad8a4a86a49a14e 100644 (file)
@@ -64,7 +64,7 @@ Lily_parser::Lily_parser (Lily_parser const &src)
     {
       lexer_ = new Lily_lexer (*src.lexer_, this);
     }
-  
+
   lexer_->unprotect ();
 }
 
@@ -97,7 +97,7 @@ Lily_parser::print_smob (SCM s, SCM port, scm_print_state*)
 void
 Lily_parser::parse_file (string init, string name, string out_name)
 {
-  // TODO: use $parser 
+  // TODO: use $parser
   lexer_->set_identifier (ly_symbol2scm ("parser"), self_scm ());
   output_basename_ = out_name;
 
@@ -142,12 +142,12 @@ Lily_parser::parse_file (string init, string name, string out_name)
 void
 Lily_parser::parse_string (string ly_code)
 {
-  // TODO: use $parser 
+  // TODO: use $parser
   lexer_->set_identifier (ly_symbol2scm ("parser"),
                          self_scm ());
 
   lexer_->main_input_name_ = "<string>";
-  lexer_->is_main_input_ = true; 
+  lexer_->is_main_input_ = true;
   lexer_->new_input (lexer_->main_input_name_, ly_code, sources_);
 
   SCM mod = lexer_->set_current_scope ();
@@ -173,7 +173,7 @@ Lily_parser::clear ()
        lexer_->remove_scope ();
     }
 
-  lexer_ = 0;  
+  lexer_ = 0;
 }
 
 char const *
@@ -204,7 +204,7 @@ IMPLEMENT_DEFAULT_EQUAL_P (Lily_parser);
 
 
 /****************************************************************
-  OUTPUT-DEF 
+  OUTPUT-DEF
  ****************************************************************/
 
 Output_def *
@@ -214,7 +214,7 @@ get_layout (Lily_parser *parser)
   Output_def *layout = unsmob_output_def (id);
   layout = layout ? layout->clone () : new Output_def;
   layout->set_variable (ly_symbol2scm ("is-layout"), SCM_BOOL_T);
-    
+
   return layout;
 }
 
@@ -288,13 +288,13 @@ get_header (Lily_parser *parser)
       ly_module_copy (nid, id);
       id = nid;
     }
-  
+
   return id;
 }
 
-SCM 
+SCM
 Lily_parser::make_scope () const
 {
-  SCM module = ly_make_anonymous_module (be_safe_global);
-  return module;    
+  SCM module = ly_make_module (be_safe_global);
+  return module;
 }
index 7a6441036410d02f7b3dfe93951486b6236438cf..42ff2f8b063c85d514f2c27d5dc8e97135aa4f23 100644 (file)
 #include "std-string.hh"
 #include "protected-scm.hh"
 
-#ifdef MODULE_GC_KLUDGE
-Protected_scm anonymous_modules = SCM_EOL;
-bool perform_gc_kludge;
-#endif
-
-void
-clear_anonymous_modules ()
-{
-#ifdef MODULE_GC_KLUDGE
-  for (SCM s = anonymous_modules;
-       scm_is_pair (s);
-       s = scm_cdr (s))
-    {
-      SCM module = scm_car (s);
-      SCM closure = SCM_MODULE_EVAL_CLOSURE (module);
-      SCM prop = scm_procedure_property (closure, ly_symbol2scm ("module"));
-
-      if (ly_is_module (prop))
-       {
-         scm_set_procedure_property_x (closure, ly_symbol2scm ("module"),
-                                       SCM_BOOL_F);
-       }
-    }
-
-  anonymous_modules = SCM_EOL;
-#endif
-}
 
 SCM
-ly_make_anonymous_module (bool safe)
+ly_make_module (bool safe)
 {
   SCM mod = SCM_EOL;
   if (!safe)
@@ -74,10 +47,6 @@ ly_make_anonymous_module (bool safe)
       mod = scm_call_0 (proc);
     }
 
-#ifdef MODULE_GC_KLUDGE
-  if (perform_gc_kludge)
-    anonymous_modules = scm_cons (mod, anonymous_modules);
-#endif
 
   return mod;
 }
index b58bf15ffb60981cf584639f0fbe32bb07b0f9fc..72a32e480190e05664687f8553e83c6d03bfee8d 100644 (file)
@@ -53,17 +53,6 @@ LY_DEFINE (ly_module_copy, "ly:module-copy",
   return SCM_UNSPECIFIED;
 }
 
-LY_DEFINE (ly_clear_anonymous_modules, "ly:clear-anonymous-modules",
-          0, 0, 0, (),
-          "Plug a GUILE 1.6 and 1.7 memory leak by breaking a weak"
-          " reference pointer cycle explicitly.")
-{
-#ifdef MODULE_GC_KLUDGE
-  clear_anonymous_modules ();
-#endif
-
-  return SCM_UNSPECIFIED;
-}
 
 /* Lookup SYM, but don't give error when it is not defined.  */
 SCM
index 252bcd2f199dd3f1e09f91e147486e48d74bf112..1d94cba652706ccbff3c741687459895c6b46230 100644 (file)
@@ -42,7 +42,7 @@ Output_def::Output_def ()
 
   smobify_self ();
 
-  scope_ = ly_make_anonymous_module (false);
+  scope_ = ly_make_module (false);
 }
 
 Output_def::Output_def (Output_def const &s)
@@ -52,7 +52,7 @@ Output_def::Output_def (Output_def const &s)
   smobify_self ();
 
   input_origin_ = s.input_origin_;
-  scope_ = ly_make_anonymous_module (false);
+  scope_ = ly_make_module (false);
   if (ly_is_module (s.scope_))
     ly_module_copy (scope_, s.scope_);
 }
index fb537a3db299c83d0860b7f85991d7a006662555..31550fbbe7c9cac93c55e6ed8c355b96de0d7219 100644 (file)
@@ -94,7 +94,7 @@ Score::Score (Score const &s)
   error_found_ = s.error_found_;
 
   smobify_self ();
-  input_location_ = make_input (*s.origin ()); 
+  input_location_ = make_input (*s.origin ());
 
   Music *m = unsmob_music (s.music_);
   if (m)
@@ -111,7 +111,7 @@ Score::Score (Score const &s)
       defs_.push_back (copy);
       copy->unprotect ();
     }
-  header_ = ly_make_anonymous_module (false);
+  header_ = ly_make_module (false);
   if (ly_is_module (s.header_))
     ly_module_copy (header_, s.header_);
 }
index 67958290d837f8bc76f5d328f4d60992bd1c5151..c0c1f442562065df228a602b0d1e42b608a83b34 100644 (file)
@@ -682,7 +682,7 @@ PIDs or the number of the process."
   (eval-string (ly:command-line-code))
   (if (ly:get-option 'help)
       (begin (ly:option-usage)
-            (ly:exit 0 #t )))
+            (ly:exit 0 #t)))
   (if (ly:get-option 'show-available-fonts)
       (begin (ly:font-config-display-fonts)
             (ly:exit 0 #t)))
@@ -798,7 +798,6 @@ PIDs or the number of the process."
         (for-each (lambda (s)
                     (ly:set-option (car s) (cdr s)))
                   all-settings)
-        (ly:clear-anonymous-modules)
         (ly:set-option 'debug-gc-assert-parsed-dead #t)
         (gc)
         (ly:set-option 'debug-gc-assert-parsed-dead #f)