gcl-devel
[Top][All Lists]
Advanced

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

[Gcl-devel] Re: proclaiming gensyms special


From: Camm Maguire
Subject: [Gcl-devel] Re: proclaiming gensyms special
Date: 05 Mar 2007 15:52:45 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!  [ BTW back from 1 month out of office ]

This has been fixed in cvs head, but this has a few other issues I'd
like to remedy before recommending it.  I can backport the fix into
2.6.8pre I think if it is important to you.

GCL has never been able to read gensyms in via compile-file called
from compile.  In cvs head we now intern these in a temporary package
held in compiler::*tmp-pack* and delete the package after compile.
There is some gc support to reset the home package to nil for retained
symbols, but this might be done in a better way.

>(defparameter my-def '(defun foo () (+ 1 xxx)))

MY-DEF

>(defparameter my-sym (gensym))

MY-SYM

>my-sym

#:G1680

>(defparameter my-def2 (subst my-sym 'xxx my-def))

MY-DEF2

>(proclaim (list 'special my-sym))

NIL

>(set my-sym 3)

3

>(eval my-def2)

FOO

>(symbol-function 'foo)

#<interpreted-function (LAMBDA-BLOCK FOO () (+ 1 #:G1680))>

>(trace compiler::wrap-literals)

(COMPILER::WRAP-LITERALS)

>(compile 'foo)

  1> (COMPILER::WRAP-LITERALS (LAMBDA () (BLOCK FOO (+ 1 #:G1680))))
    2> (COMPILER::WRAP-LITERALS LAMBDA)
    <2 (COMPILER::WRAP-LITERALS LAMBDA)
    2> (COMPILER::WRAP-LITERALS (NIL (BLOCK FOO (+ 1 #:G1680))))
      3> (COMPILER::WRAP-LITERALS NIL)
      <3 (COMPILER::WRAP-LITERALS NIL)
      3> (COMPILER::WRAP-LITERALS ((BLOCK FOO (+ 1 #:G1680))))
        4> (COMPILER::WRAP-LITERALS (BLOCK FOO (+ 1 #:G1680)))
          5> (COMPILER::WRAP-LITERALS BLOCK)
          <5 (COMPILER::WRAP-LITERALS BLOCK)
          5> (COMPILER::WRAP-LITERALS (FOO (+ 1 #:G1680)))
            6> (COMPILER::WRAP-LITERALS FOO)
            <6 (COMPILER::WRAP-LITERALS FOO)
            6> (COMPILER::WRAP-LITERALS ((+ 1 #:G1680)))
              7> (COMPILER::WRAP-LITERALS (+ 1 #:G1680))
                8> (COMPILER::WRAP-LITERALS +)
                <8 (COMPILER::WRAP-LITERALS +)
                8> (COMPILER::WRAP-LITERALS (1 #:G1680))
                  9> (COMPILER::WRAP-LITERALS 1)
                  <9 (COMPILER::WRAP-LITERALS 1)
                  9> (COMPILER::WRAP-LITERALS (#:G1680))
                    10> (COMPILER::WRAP-LITERALS #:G1680)
                    <10 (COMPILER::WRAP-LITERALS G1682::G1680)
                    10> (COMPILER::WRAP-LITERALS NIL)
                    <10 (COMPILER::WRAP-LITERALS NIL)
                  <9 (COMPILER::WRAP-LITERALS (G1682::G1680))
                <8 (COMPILER::WRAP-LITERALS (1 G1682::G1680))
              <7 (COMPILER::WRAP-LITERALS (+ 1 G1682::G1680))
              7> (COMPILER::WRAP-LITERALS NIL)
              <7 (COMPILER::WRAP-LITERALS NIL)
            <6 (COMPILER::WRAP-LITERALS ((+ 1 G1682::G1680)))
          <5 (COMPILER::WRAP-LITERALS (FOO (+ 1 G1682::G1680)))
        <4 (COMPILER::WRAP-LITERALS (BLOCK FOO (+ 1 G1682::G1680)))
        4> (COMPILER::WRAP-LITERALS NIL)
        <4 (COMPILER::WRAP-LITERALS NIL)
      <3 (COMPILER::WRAP-LITERALS ((BLOCK FOO (+ 1 G1682::G1680))))
    <2 (COMPILER::WRAP-LITERALS (NIL (BLOCK FOO (+ 1 G1682::G1680))))
  <1 (COMPILER::WRAP-LITERALS
         (LAMBDA () (BLOCK FOO (+ 1 G1682::G1680))))
;; Compiling /tmp/gazonk_31440_0.lsp.
;; End of Pass 1.  
;; End of Pass 2.  
;; OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3, 
(Debug quality ignored)
;; Finished compiling /tmp/gazonk_31440_0.o.
;; Loading /tmp/gazonk_31440_0.o
 ;; start address -T 0xed3350 ;; Finished loading /tmp/gazonk_31440_0.o
#<compiled-function FOO>
NIL
NIL

>(foo)

4


Take care,



Matt Kaufmann <address@hidden> writes:

> Hi, Camm --
> 
> The following sequence causes a warning and error, as shown below, in
> GCL versions 2.6.6 CLtL1, 2.6.7 CLtL1, and (a rather old) 2.7.0 ANSI.
> The problems go away in all of these if we replace gensym by gentemp.
> 
> (defparameter my-def '(defun foo () (+ 1 xxx)))
> (defparameter my-sym (gensym))
> (defparameter my-def2 (subst my-sym 'xxx my-def))
> (proclaim (list 'special my-sym))
> (set my-sym 3)
> (eval my-def2)
> (compile 'foo)
> (foo)
> 
> Here are the warning and error mentioned above.
> 
> [After the compile:]
> 
> ;; Warning: ;; The variable #:G2047 is undefined.
> ;; The compiler will assume this variable is a global.
> 
> [After the call of foo, 2.6.6 and 2.6.7:]
> 
> Error: Caught fatal error [memory may be damaged]
> Fast links are on: do (si::use-fast-links nil) for debugging
> Error signalled by EVAL.
> Broken at FOO.  Type :H for Help.
> >>
> 
> [After the call of foo, 2.7.0:]
> 
> Error in EVAL [or a callee]: Control stack overflow.
> 
> -- Matt
> 
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

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