Changeset 11882


Ignore:
Timestamp:
05/16/09 16:44:29 (12 years ago)
Author:
ehuelsmann
Message:

Remove the last of the _execute() methods:
By loading the closure array off the 'ctx' slot
in the method, it's no longer required to do
extra function calls just to add it to the
parameter list.

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/ClosureTemplateFunction.java

    r11866 r11882  
    6363
    6464
    65 
    66     // execute methods have the semantic meaning
    67     // "evaluate this object"
    68   @Override
    69   public final LispObject execute() throws ConditionThrowable
    70   {
    71       return _execute(ctx);
    72   }
    73 
    74   @Override
    75   public final LispObject execute(LispObject arg) throws ConditionThrowable
    76   {
    77       return _execute(ctx, arg);
    78   }
    79 
    80   @Override
    81   public final LispObject execute(LispObject first, LispObject second)
    82     throws ConditionThrowable
    83   {
    84       return _execute(ctx, first, second);
    85   }
    86 
    87   @Override
    88   public final LispObject execute(LispObject first, LispObject second,
    89                                   LispObject third)
    90     throws ConditionThrowable
    91   {
    92       return _execute(ctx, first, second, third);
    93   }
    94 
    95   @Override
    96   public final LispObject execute(LispObject first, LispObject second,
    97                                   LispObject third, LispObject fourth)
    98     throws ConditionThrowable
    99   {
    100       return _execute(ctx, first, second, third, fourth);
    101   }
    102 
    103   @Override
    104   public final LispObject execute(LispObject first, LispObject second,
    105                                   LispObject third, LispObject fourth,
    106                                   LispObject fifth)
    107     throws ConditionThrowable
    108   {
    109       return _execute(ctx, first, second, third, fourth, fifth);
    110   }
    111 
    112   @Override
    113   public final LispObject execute(LispObject first, LispObject second,
    114                                   LispObject third, LispObject fourth,
    115                                   LispObject fifth, LispObject sixth)
    116     throws ConditionThrowable
    117   {
    118       return _execute(ctx, first, second, third, fourth, fifth, sixth);
    119   }
    120 
    121   @Override
    122   public final LispObject execute(LispObject first, LispObject second,
    123                                   LispObject third, LispObject fourth,
    124                                   LispObject fifth, LispObject sixth,
    125                                   LispObject seventh)
    126     throws ConditionThrowable
    127   {
    128       return _execute(ctx, first, second, third, fourth, fifth, sixth, seventh);
    129   }
    130 
    131   @Override
    132   public final LispObject execute(LispObject first, LispObject second,
    133                                   LispObject third, LispObject fourth,
    134                                   LispObject fifth, LispObject sixth,
    135                                   LispObject seventh, LispObject eighth)
    136     throws ConditionThrowable
    137   {
    138       return _execute(ctx, first, second, third, fourth, fifth,
    139               sixth, seventh, eighth);
    140   }
    141 
    142   @Override
    143   public final LispObject execute(LispObject[] args)
    144     throws ConditionThrowable
    145   {
    146     return _execute(ctx, args);
    147   }
    148 
    14965  private final LispObject notImplemented() throws ConditionThrowable
    15066  {
     
    15369
    15470
    155     // _execute methods have the semantic meaning
    156     // "evaluate this template with these values"
    157 
    15871  // Zero args.
    159   public LispObject _execute(ClosureBinding[] context) throws ConditionThrowable
     72  public LispObject execute() throws ConditionThrowable
    16073  {
    16174    LispObject[] args = new LispObject[0];
    162     return _execute(context, args);
     75    return execute(args);
    16376  }
    16477
    16578  // One arg.
    166   public LispObject _execute(ClosureBinding[] context, LispObject first)
     79  public LispObject execute( LispObject first)
    16780    throws ConditionThrowable
    16881  {
    16982    LispObject[] args = new LispObject[1];
    17083    args[0] = first;
    171     return _execute(context, args);
     84    return execute(args);
    17285  }
    17386
    17487  // Two args.
    175   public LispObject _execute(ClosureBinding[] context, LispObject first,
     88  public LispObject execute( LispObject first,
    17689                            LispObject second)
    17790    throws ConditionThrowable
     
    18093    args[0] = first;
    18194    args[1] = second;
    182     return _execute(context, args);
     95    return execute(args);
    18396  }
    18497
    18598  // Three args.
    186   public LispObject _execute(ClosureBinding[] context, LispObject first,
     99  public LispObject execute( LispObject first,
    187100                            LispObject second, LispObject third)
    188101    throws ConditionThrowable
     
    192105    args[1] = second;
    193106    args[2] = third;
    194     return _execute(context, args);
     107    return execute(args);
    195108  }
    196109
    197110  // Four args.
    198   public LispObject _execute(ClosureBinding[] context, LispObject first,
     111  public LispObject execute( LispObject first,
    199112                            LispObject second, LispObject third,
    200113                            LispObject fourth)
     
    206119    args[2] = third;
    207120    args[3] = fourth;
    208     return _execute(context, args);
     121    return execute(args);
    209122  }
    210123
    211124  // Five args.
    212   public LispObject _execute(ClosureBinding[] context, LispObject first,
     125  public LispObject execute( LispObject first,
    213126                            LispObject second, LispObject third,
    214127                            LispObject fourth, LispObject fifth)
     
    221134    args[3] = fourth;
    222135    args[4] = fifth;
    223     return _execute(context, args);
     136    return execute(args);
    224137  }
    225138
    226139  // Six args.
    227   public LispObject _execute(ClosureBinding[] context, LispObject first,
     140  public LispObject execute( LispObject first,
    228141                            LispObject second, LispObject third,
    229142                            LispObject fourth, LispObject fifth,
     
    238151    args[4] = fifth;
    239152    args[5] = sixth;
    240     return _execute(context, args);
     153    return execute(args);
    241154  }
    242155
    243156  // Seven args.
    244   public LispObject _execute(ClosureBinding[] context, LispObject first,
     157  public LispObject execute( LispObject first,
    245158                            LispObject second, LispObject third,
    246159                            LispObject fourth, LispObject fifth,
     
    256169    args[5] = sixth;
    257170    args[6] = seventh;
    258     return _execute(context, args);
     171    return execute(args);
    259172  }
    260173
    261174  // Eight args.
    262   public LispObject _execute(ClosureBinding[] context, LispObject first,
     175  public LispObject execute( LispObject first,
    263176                            LispObject second, LispObject third,
    264177                            LispObject fourth, LispObject fifth,
     
    276189    args[6] = seventh;
    277190    args[7] = eighth;
    278     return _execute(context, args);
     191    return execute(args);
    279192  }
    280193
    281194  // Arg array.
    282   public LispObject _execute(ClosureBinding[] context, LispObject[] args)
     195  public LispObject execute(LispObject[] args)
    283196    throws ConditionThrowable
    284197  {
  • trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp

    r11881 r11882  
    78597859        (setf *hairy-arglist-p* t)
    78607860        (return-from analyze-args
    7861                      (if *closure-variables*
    7862                          (get-descriptor (list +closure-binding-array+
    7863                                                +lisp-object-array+)
    7864                                          +lisp-object+)
    7865                          (get-descriptor (list +lisp-object-array+)
    7866                                          +lisp-object+))))
    7867       (cond (*closure-variables*
    7868              (return-from analyze-args
    7869                           (cond ((<= arg-count call-registers-limit)
    7870                                  (get-descriptor (list* +closure-binding-array+
    7871                                                         (lisp-object-arg-types arg-count))
    7872                                                  +lisp-object+))
    7873                                 (t (setf *using-arg-array* t)
    7874                                    (setf (compiland-arity compiland) arg-count)
    7875                                    (get-descriptor (list +closure-binding-array+ +lisp-object-array+) ;; FIXME
    7876                                                    +lisp-object+)))))
    7877             (t
    7878              (return-from analyze-args
    7879                           (cond ((<= arg-count call-registers-limit)
    7880                                  (get-descriptor (lisp-object-arg-types arg-count)
    7881                                                  +lisp-object+))
    7882                                 (t (setf *using-arg-array* t)
    7883                                    (setf (compiland-arity compiland) arg-count)
    7884                                    (get-descriptor (list +lisp-object-array+)
    7885                                                    +lisp-object+))))))) ;; FIXME
     7861          (get-descriptor (list +lisp-object-array+) +lisp-object+)))
     7862      (return-from analyze-args
     7863        (cond ((<= arg-count call-registers-limit)
     7864               (get-descriptor (lisp-object-arg-types arg-count) +lisp-object+))
     7865              (t (setf *using-arg-array* t)
     7866                 (setf (compiland-arity compiland) arg-count)
     7867                 (get-descriptor (list +lisp-object-array+) +lisp-object+)))))
    78867868    (when (or (memq '&KEY args)
    78877869              (memq '&OPTIONAL args)
     
    80177999
    80188000         (descriptor (analyze-args compiland))
    8019          (execute-method (make-method :name (if (and *child-p*
    8020                                                      *closure-variables*)
    8021                                                 "_execute" "execute")
     8001         (execute-method (make-method :name "execute"
    80228002                                      :descriptor descriptor))
    80238003         (*code* ())
     
    80418021    (setf (method-descriptor-index execute-method)
    80428022          (pool-name (method-descriptor execute-method)))
    8043 
    8044     (when (and *closure-variables* *child-p*)
    8045       (setf (compiland-closure-register compiland)
    8046             (allocate-register)) ;; register 1: the closure array
    8047       (dformat t "p2-compiland 1 closure register = ~S~%"
    8048                (compiland-closure-register compiland)))
    80498023
    80508024    (when *using-arg-array*
     
    80658039    (setf *thread* (allocate-register))
    80668040
    8067     (when (and *closure-variables* (not *child-p*))
     8041    (when *closure-variables*
    80688042      (setf (compiland-closure-register compiland) (allocate-register))
    80698043       (dformat t "p2-compiland 2 closure register = ~S~%"
     
    80718045
    80728046    (when *closure-variables*
    8073       (cond
    8074         ((not *child-p*)
    8075          ;; if we're the ultimate parent: create the closure array
    8076          (emit-push-constant-int (length *closure-variables*))
    8077          (emit 'anewarray +closure-binding-class+))
    8078         (local-closure-vars
    8079          (duplicate-closure-array compiland))))
     8047      (if (not *child-p*)
     8048          (progn
     8049            ;; if we're the ultimate parent: create the closure array
     8050            (emit-push-constant-int (length *closure-variables*))
     8051            (emit 'anewarray +closure-binding-class+))
     8052        (progn
     8053          (aload 0)
     8054          (emit 'getfield +lisp-ctf-class+ "ctx"
     8055                +closure-binding-array+)
     8056          (when local-closure-vars
     8057            ;; in all other cases, it gets stored in the register below
     8058            (emit 'astore (compiland-closure-register compiland))
     8059            (duplicate-closure-array compiland)))))
    80808060
    80818061    ;; Move args from their original registers to the closure variables array
     
    81188098            (emit 'aastore)))))
    81198099
    8120     (when (or local-closure-vars (and *closure-variables* (not *child-p*)))
     8100    (when *closure-variables*
    81218101      (aver (not (null (compiland-closure-register compiland))))
    81228102      (astore (compiland-closure-register compiland))
Note: See TracChangeset for help on using the changeset viewer.