Changeset 12638


Ignore:
Timestamp:
04/28/10 21:04:28 (13 years ago)
Author:
astalla
Message:

Experimental: special operator to insert inline bytecode in compiled Lisp functions.

Location:
branches/less-reflection/abcl/src/org/armedbear/lisp
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/less-reflection/abcl/src/org/armedbear/lisp/Lisp.java

    r12630 r12638  
    27402740  }
    27412741
     2742  private static final SpecialOperator WITH_INLINE_CODE = new with_inline_code();
     2743  private static class with_inline_code extends SpecialOperator {
     2744    with_inline_code() {
     2745      super("with-inline-code", PACKAGE_JVM, true, "(&optional target repr) &body body");
     2746    }
     2747    @Override
     2748    public LispObject execute(LispObject args, Environment env)
     2749    {
     2750  return error(new SimpleError("This is a placeholder. It should only be called in compiled code, and tranformed by the compiler using special form handlers."));
     2751    }
     2752  }
     2753
    27422754}
  • branches/less-reflection/abcl/src/org/armedbear/lisp/compiler-pass1.lisp

    r12630 r12638  
    14331433                  (UNWIND-PROTECT       p1-unwind-protect)
    14341434                  (THREADS:SYNCHRONIZED-ON
    1435                                         p1-threads-synchronized-on)))
     1435                                        p1-threads-synchronized-on)
     1436      (JVM::WITH-INLINE-CODE identity)))
    14361437    (install-p1-handler (%car pair) (%cadr pair))))
    14371438
  • branches/less-reflection/abcl/src/org/armedbear/lisp/compiler-pass2.lisp

    r12630 r12638  
    21802180    (*code* *static-code*))
    21812181     ;; fixme *declare-inline*
    2182      (declare-field g +lisp-object+ +field-access-default+)
     2182     (declare-field g +lisp-object+ +field-access-private+)
    21832183     (emit 'new class-name)
    21842184     (emit 'dup)
     
    86098609  t)
    86108610
     8611(defun p2-with-inline-code (form target representation)
     8612  ;;form = (with-inline-code (&optional target-var repr-var) ...body...)
     8613  (destructuring-bind (&optional target-var repr-var) (cadr form)
     8614    (eval `(let (,@(when target-var `((,target-var ,target)))
     8615     ,@(when repr-var `((,repr-var ,representation))))
     8616       ,@(cddr form)))))
     8617
    86118618(defun compile-1 (compiland stream)
    86128619  (let ((*all-variables* nil)
     
    89878994  (install-p2-handler 'write-8-bits        'p2-write-8-bits)
    89888995  (install-p2-handler 'zerop               'p2-zerop)
     8996  (install-p2-handler 'with-inline-code    'p2-with-inline-code)
    89898997  t)
    89908998
  • branches/less-reflection/abcl/src/org/armedbear/lisp/precompiler.lisp

    r12630 r12638  
    10221022
    10231023                  (THREADS:SYNCHRONIZED-ON
    1024                                         precompile-threads-synchronized-on)))
     1024                                        precompile-threads-synchronized-on)
     1025     
     1026      (JVM::WITH-INLINE-CODE precompile-identity)))
    10251027    (install-handler (first pair) (second pair))))
    10261028
Note: See TracChangeset for help on using the changeset viewer.