Changeset 15554


Ignore:
Timestamp:
02/23/22 14:37:02 (11 months ago)
Author:
Mark Evenson
Message:

Record environments in interpreted code

Provide API from ABCL-INTROSPECT.

Includes
0b061d71 | * alanr/patch-couple-more-places
<https://github.com/armedbear/abcl/pull/443#issuecomment-1046533222>
<https://github.com/armedbear/abcl/pull/443/commits/27da8d221813ffb7f0689eb48625ac44c02dfaf7>

Location:
trunk/abcl
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/contrib/abcl-introspect/abcl-introspect.lisp

    r15552 r15554  
    373373(defun environment-parts(env)
    374374  (append
    375    (loop for binding =  (jss:get-java-field env "vars" t) then (jss:get-java-field binding "next" t)
     375   (loop for binding = (jss:get-java-field env "vars" t) then (jss:get-java-field binding "next" t)
    376376         while binding
    377377         for symbol = (jss:get-java-field binding "symbol" t)
     
    381381           collect (list (if special
    382382                             :special-variable
     383                             (if (jss:jtypep value 'lisp.SymbolMacro)
     384         :symbol-macro
     385         :lexical-variable))
    383386                             :lexical-variable)
    384387                         symbol
    385                          (if special
    386                              (symbol-value symbol)
     388                         (if (jss:jtypep value 'lisp.SymbolMacro)
     389                             (#"getExpansion" value)
    387390                             value))
    388391             into them
    389392         finally (return them))
    390    (loop for binding =  (jss:get-java-field env "lastFunctionBinding" t)
     393   (loop for binding = (jss:get-java-field env "lastFunctionBinding" t)
    391394           then (jss:get-java-field binding "next" t)
    392395         while binding
     
    395398         unless (find name them :key 'second)
    396399           collect (list :lexical-function name value) into them
    397          finally (return them))))
     400         finally (return them))
     401   (loop for binding = (jss::get-java-field env "blocks" t)
     402     then (jss::get-java-field binding "next" t)
     403   while binding
     404   for name = (jss::get-java-field binding "symbol" t)
     405   for value = (jss::get-java-field  binding "value" t)
     406   unless (find name them :key 'second)
     407     collect (list :block name value) into them
     408   finally (return them))))
    398409
    399410;; Locals
  • trunk/abcl/src/org/armedbear/lisp/Primitives.java

    r15552 r15554  
    36903690        {
    36913691            Environment ext = new Environment(env);
     3692            LispThread thread = LispThread.currentThread();
    36923693            try {
     3694                thread.envStack.push(ext);
    36933695                return processTagBody(args, preprocessTagBody(args, ext), ext);
    36943696            }
    36953697            finally {
    36963698                ext.inactive = true;
     3699                while (thread.envStack.pop() != ext) {};
    36973700            }
    36983701        }
     
    37463749            final LispThread thread = LispThread.currentThread();
    37473750            try {
     3751                thread.envStack.push(ext);
    37483752                return progn(body, ext, thread);
    37493753            } catch (Return ret) {
     
    37543758            }
    37553759            finally {
     3760                while (thread.envStack.pop() != ext) {};
    37563761                ext.inactive = true;
    37573762            }
  • trunk/abcl/src/org/armedbear/lisp/SpecialOperators.java

    r15552 r15554  
    193193            Environment ext = new Environment(env);
    194194            try {
     195                thread.envStack.push(ext);
    195196                // Declare our free specials, this will correctly raise
    196197                LispObject body = ext.processDeclarations(args.cdr());
     
    217218            finally {
    218219                thread.resetSpecialBindings(mark);
     220                while (thread.envStack.pop() != ext) {};
    219221            }
    220222        }
     
    257259            final LispThread thread = LispThread.currentThread();
    258260            final Environment ext = new Environment(env);
    259             args = ext.processDeclarations(args);
    260             return progn(args, ext, thread);
     261            try {
     262          thread.envStack.push(ext);
     263    args = ext.processDeclarations(args);
     264    return progn(args, ext, thread);
     265      }
     266      finally {
     267              while (thread.envStack.pop() != ext) {};
     268            }
    261269        }
    262270    };
Note: See TracChangeset for help on using the changeset viewer.