Loading ...
Sorry, an error occurred while loading the content.

Re: Embedding racket in vim

Expand Messages
  • Sergey Khorev
    ... Are you talking about official Vim source? For http://code.google.com/r/sergeykhorev-vim-mzscheme/source I reworked some memory allocation stuff so
    Message 1 of 8 , Dec 14, 2012
    • 0 Attachment
      On Fri, Dec 14, 2012 at 9:20 AM, Eric Dobson <eric.n.dobson@...> wrote:
      I figured this out. It was that vim was not being compiled with the precise garbage collection when racket was, and a couple of bugs on the vim allocation of racket objects. I'll hopefully have a patch soon.
       

      Are you talking about official Vim source? For http://code.google.com/r/sergeykhorev-vim-mzscheme/source I reworked some memory allocation stuff so something must have changed in this regard :) 

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Eric Dobson
      Yes I was using the official source. Here is the patch of my changes, some of which you may already have. diff -r 52bfa939fc07 src/auto/configure ... +++
      Message 2 of 8 , Dec 16, 2012
      • 0 Attachment
        Yes I was using the official source. 

        Here is the patch of my changes, some of which you may already have.

        diff -r 52bfa939fc07 src/auto/configure
        --- a/src/auto/configure Thu Dec 06 21:30:29 2012 +0100
        +++ b/src/auto/configure Sun Dec 16 14:37:19 2012 -0800
        @@ -4927,7 +4927,8 @@
         
           if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
             if test "x$MACOSX" = "xyes"; then
        -      MZSCHEME_LIBS="-framework PLT_MzScheme"
        +      MZSCHEME_LIBS="-framework Racket"
        +      MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
             elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
               MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
               MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
        @@ -4968,6 +4969,10 @@
               else
          if test -d $vi_cv_path_mzscheme_pfx/share/racket/collects; then
           SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/share/racket/
        +        else
        +  if test -d $vi_cv_path_mzscheme_pfx/collects; then
        +    SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/
        +  fi
          fi
               fi
             fi
        diff -r 52bfa939fc07 src/if_mzsch.c
        --- a/src/if_mzsch.c Thu Dec 06 21:30:29 2012 +0100
        +++ b/src/if_mzsch.c Sun Dec 16 14:37:19 2012 -0800
        @@ -183,6 +183,8 @@
         }
         static int buffer_fixup_proc(void *obj)
         {
        +    vim_mz_buffer* buf = (vim_mz_buffer*) obj;
        +    buf->buf->b_mzscheme_ref = GC_fixup_self(obj);
             return buffer_size_proc(obj);
         }
         static int window_size_proc(void *obj UNUSED)
        @@ -195,6 +197,8 @@
         }
         static int window_fixup_proc(void *obj)
         {
        +    vim_mz_window* win = (vim_mz_window*) obj;
        +    win->win->w_mzscheme_ref = GC_fixup_self(obj);
             return window_size_proc(obj);
         }
         #endif
        @@ -861,6 +865,12 @@
             scheme_set_stack_base(stack_base, 1);
         #endif
         
        +#ifndef TRAMPOLINED_MZVIM_STARTUP
        +    /* in newer versions of precise GC the initial env has been created */
        +    environment = scheme_basic_env();
        +#endif
        +    MZ_GC_CHECK();
        +
             MZ_REGISTER_STATIC(environment);
             MZ_REGISTER_STATIC(curout);
             MZ_REGISTER_STATIC(curerr);
        @@ -869,10 +879,6 @@
             MZ_REGISTER_STATIC(exn_message);
             MZ_REGISTER_STATIC(vim_exn);
         
        -#ifndef TRAMPOLINED_MZVIM_STARTUP
        -    /* in newer versions of precise GC the initial env has been created */
        -    environment = scheme_basic_env();
        -#endif
             MZ_GC_CHECK();
         
         #ifdef INCLUDE_MZSCHEME_BASE
        @@ -925,11 +931,7 @@
          MZ_GC_CHECK();
          coll_path = scheme_char_string_to_path(coll_char_string);
          MZ_GC_CHECK();
        - coll_pair = scheme_make_pair(coll_path, scheme_null);
        - MZ_GC_CHECK();
        - config = scheme_config;
        - MZ_GC_CHECK();
        - scheme_set_param(config, MZCONFIG_COLLECTION_PATHS, coll_pair);
        +        scheme_set_collects_path(coll_path);
          MZ_GC_CHECK();
          MZ_GC_UNREG();
             }
        @@ -1016,10 +1018,10 @@
         #ifdef MZ_PRECISE_GC
             GC_register_traversers(mz_buffer_type,
             buffer_size_proc, buffer_mark_proc, buffer_fixup_proc,
        -    TRUE, TRUE);
        +    TRUE, FALSE);
             GC_register_traversers(mz_window_type,
             window_size_proc, window_mark_proc, window_fixup_proc,
        -    TRUE, TRUE);
        +    TRUE, FALSE);
         #endif
         
             make_modules();
        @@ -1652,7 +1654,7 @@
             if (win->w_mzscheme_ref != NULL)
          return win->w_mzscheme_ref;
         
        -    self = scheme_malloc_fail_ok(scheme_malloc, sizeof(vim_mz_window));
        +    self = scheme_malloc_fail_ok(scheme_malloc_tagged, sizeof(vim_mz_window));
             vim_memset(self, 0, sizeof(vim_mz_window));
             scheme_dont_gc_ptr(self); /* because win isn't visible to GC */
             MZ_GC_CHECK();
        @@ -1977,7 +1979,7 @@
             if (buf->b_mzscheme_ref)
          return buf->b_mzscheme_ref;
         
        -    self = scheme_malloc_fail_ok(scheme_malloc, sizeof(vim_mz_buffer));
        +    self = scheme_malloc_fail_ok(scheme_malloc_tagged, sizeof(vim_mz_buffer));
             vim_memset(self, 0, sizeof(vim_mz_buffer));
             scheme_dont_gc_ptr(self); /* because buf isn't visible to GC */
             MZ_GC_CHECK();
        @@ -2298,8 +2300,8 @@
             MZ_GC_VAR_IN_REG(1, rest);
             MZ_GC_REG();
         
        -    array = (char **)alloc(new_len * sizeof(char *));
        -    vim_memset(array, 0, new_len * sizeof(char *));
        +    array = (char **)alloc((new_len + 1) * sizeof(char *));
        +    vim_memset(array, 0, (new_len + 1) * sizeof(char *));
         
             rest = line_list;
             for (i = 0; i < new_len; ++i)
        @@ -2481,8 +2483,8 @@
          MZ_GC_VAR_IN_REG(1, rest);
          MZ_GC_REG();
         
        - array = (char **)alloc(size * sizeof(char *));
        - vim_memset(array, 0, size * sizeof(char *));
        + array = (char **)alloc((size + 1) * sizeof(char *));
        + vim_memset(array, 0, (size + 1) * sizeof(char *));
         
          rest = list;
          for (i = 0; i < size; ++i)



        On Fri, Dec 14, 2012 at 9:05 AM, Sergey Khorev <sergey.khorev@...> wrote:

        On Fri, Dec 14, 2012 at 9:20 AM, Eric Dobson <eric.n.dobson@...> wrote:
        I figured this out. It was that vim was not being compiled with the precise garbage collection when racket was, and a couple of bugs on the vim allocation of racket objects. I'll hopefully have a patch soon.
         

        Are you talking about official Vim source? For http://code.google.com/r/sergeykhorev-vim-mzscheme/source I reworked some memory allocation stuff so something must have changed in this regard :) 

        _________________________
          Racket Developers list:
          http://lists.racket-lang.org/dev


        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Sergey Khorev
        Looks good except one thing: you really wouldn t want to gc environment (see MZ_GC_CHECK) before registering it with MZ_REGISTER_STATIC. BTW are there any
        Message 3 of 8 , Dec 16, 2012
        • 0 Attachment
          Looks good except one thing: you really wouldn't want to gc environment (see MZ_GC_CHECK) before registering  it with MZ_REGISTER_STATIC.

          BTW are there any guarantees that MZ_REGISTER_STATIC doesn't trigger garbage collection?

          @@ -861,6 +865,12 @@
               scheme_set_stack_base(stack_base, 1);
           #endif
           
          +#ifndef TRAMPOLINED_MZVIM_STARTUP
          +    /* in newer versions of precise GC the initial env has been created */
          +    environment = scheme_basic_env();
          +#endif
          +    MZ_GC_CHECK();
          +
               MZ_REGISTER_STATIC(environment);
               MZ_REGISTER_STATIC(curout);
               MZ_REGISTER_STATIC(curerr);
          @@ -869,10 +879,6 @@
               MZ_REGISTER_STATIC(exn_message);
               MZ_REGISTER_STATIC(vim_exn);
           
          -#ifndef TRAMPOLINED_MZVIM_STARTUP
          -    /* in newer versions of precise GC the initial env has been created */
          -    environment = scheme_basic_env();
          -#endif
               MZ_GC_CHECK();
           

          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • Bram Moolenaar
          ... Please let me know what I should include in the distribution. The patch was missing changes to configure.in. -- Very funny, Scotty. Now beam down my
          Message 4 of 8 , Dec 17, 2012
          • 0 Attachment
            Sergey Khorev wrote:

            > Looks good except one thing: you really wouldn't want to gc environment
            > (see MZ_GC_CHECK) before registering it with MZ_REGISTER_STATIC.
            >
            > BTW are there any guarantees that MZ_REGISTER_STATIC doesn't trigger
            > garbage collection?

            Please let me know what I should include in the distribution. The patch
            was missing changes to configure.in.


            --
            Very funny, Scotty. Now beam down my clothes.

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
            \\\ an exciting new programming language -- http://www.Zimbu.org ///
            \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

            --
            You received this message from the "vim_dev" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • Sergey Khorev
            Eric, I incorporated you changes into http://code.google.com/r/sergeykhorev-vim-mzscheme/source. Can you try it on Mac? Bram, ... I will send you a cumulative
            Message 5 of 8 , Dec 17, 2012
            • 0 Attachment
              Eric,

              I incorporated you changes into http://code.google.com/r/sergeykhorev-vim-mzscheme/source. Can you try it on Mac?

              Bram,

              Please let me know what I should include in the distribution.  The patch
              was missing changes to configure.in.

               I will send you a cumulative patch once it is tested.

              --
              You received this message from the "vim_dev" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            Your message has been successfully submitted and would be delivered to recipients shortly.