Changeset 8567


Ignore:
Timestamp:
02/14/05 04:06:11 (16 years ago)
Author:
piso
Message:

P2-TIMES

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/jvm.lisp

    r8521 r8567  
    22;;;
    33;;; Copyright (C) 2003-2005 Peter Graves
    4 ;;; $Id: jvm.lisp,v 1.396 2005-02-10 12:53:22 piso Exp $
     4;;; $Id: jvm.lisp,v 1.397 2005-02-14 04:06:11 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    43294329    (emit-move-from-stack target representation)))
    43304330
     4331(defun p2-times (form &key (target :stack) representation)
     4332  (case (length form)
     4333    (3
     4334     (let* ((args (cdr form))
     4335            (arg1 (first args))
     4336            (arg2 (second args)))
     4337       (dformat t "p2-times form = ~S~%" form)
     4338       (when (fixnump arg1)
     4339         (dformat t "p2-times arg1 is a fixnum, swapping...~%")
     4340         (rotatef arg1 arg2)
     4341         (dformat t "arg1 => ~S~%" arg1)
     4342         (dformat t "arg2 => ~S~%" arg2))
     4343       (cond ((fixnump arg2)
     4344              (dformat t "p2-times case 1~%")
     4345              (compile-form arg1 :target :stack)
     4346              (maybe-emit-clear-values arg1)
     4347              (emit-push-int arg2)
     4348              (emit-invokevirtual +lisp-object-class+ "multiplyBy" '("I") +lisp-object+)
     4349              (when (eq representation :unboxed-fixnum)
     4350                (emit-unbox-fixnum))
     4351              (emit-move-from-stack target representation))
     4352             (t
     4353              (dformat t "p2-times default case~%")
     4354              (compile-binary-operation "multiplyBy" args target representation)))))
     4355    (t
     4356     (compile-function-call form target representation))))
     4357
    43314358(defun p2-plus (form &key (target :stack) representation)
    43324359  (case (length form)
     
    43374364            (var1 (unboxed-fixnum-variable arg1))
    43384365            (var2 (unboxed-fixnum-variable arg2)))
     4366       (dformat t "p2-plus form = ~S~%" form)
     4367       (when (fixnump arg1)
     4368         (dformat t "p2-plus arg1 is a fixnum, swapping...~%")
     4369         (rotatef arg1 arg2)
     4370         (rotatef var1 var2)
     4371         (dformat t "arg1 => ~S~%" arg1)
     4372         (dformat t "arg2 => ~S~%" arg2))
    43394373       (cond ((and (numberp arg1) (numberp arg2))
    43404374              (compile-constant (+ arg1 arg2)
     
    58055839                             values))
    58065840
     5841(install-p2-handler '*              'p2-times)
     5842(install-p2-handler '+              'p2-plus)
     5843(install-p2-handler '-              'p2-minus)
     5844(install-p2-handler '/=             'p2-numeric-comparison)
    58075845(install-p2-handler '<              'p2-numeric-comparison)
    58085846(install-p2-handler '<=             'p2-numeric-comparison)
     5847(install-p2-handler '=              'p2-numeric-comparison)
    58095848(install-p2-handler '>              'p2-numeric-comparison)
    58105849(install-p2-handler '>=             'p2-numeric-comparison)
    5811 (install-p2-handler '=              'p2-numeric-comparison)
    5812 (install-p2-handler '/=             'p2-numeric-comparison)
    5813 (install-p2-handler '+              'p2-plus)
    5814 (install-p2-handler '-              'p2-minus)
    58155850(install-p2-handler 'aref           'p2-aref)
    58165851(install-p2-handler 'ash            'p2-ash)
Note: See TracChangeset for help on using the changeset viewer.