Changeset 11582


Ignore:
Timestamp:
01/24/09 14:02:18 (12 years ago)
Author:
ehuelsmann
Message:

Use additional opcodes: don't store the "obvious" constants in the constant pool.

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

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp

    r11580 r11582  
    390390(defknown emit-push-constant-long (integer) t)
    391391(defun emit-push-constant-long (n)
    392   (emit 'ldc2_w (pool-long n)))
     392  (case n
     393    (0 (emit 'lconst_0))
     394    (1 (emit 'lconst_1))
     395    (t
     396     (emit 'ldc2_w (pool-long n)))))
     397
     398(defknown emit-push-constant-float (single-float) t)
     399(defun emit-push-constant-float (n)
     400  (case n
     401    (0.0s0 (emit 'fconst_0))
     402    (1.0s0 (emit 'fconst_1))
     403    (2.0s0 (emit 'fconst_2))
     404    (t (emit 'ldc (pool-float n)))))
     405
     406(defknown emit-push-constant-double (double-float) t)
     407(defun emit-push-constant-double (n)
     408  (case n
     409    (0.0d0 (emit 'dconst_0))
     410    (1.0d0 (emit 'dconst_1))
     411    (t (emit 'ldc2_w (pool-double n)))))
    393412
    394413(declaim (ftype (function (t t) cons) make-descriptor-info))
     
    9881007                 9 ; lconst_0
    9891008                 10 ; lconst_1
     1009                 11 ; fconst_0
     1010                 12 ; fconst_1
     1011                 13 ; fconst_2
     1012                 14 ; dconst_0
     1013                 15 ; dconst_1
    9901014                 42 ; aload_0
    9911015                 43 ; aload_1
     
    23272351            (emit-invokevirtual +lisp-bignum-class+ "floatValue" nil "F"))
    23282352           ((typep form 'single-float)
    2329             (emit 'ldc (pool-float form)))
     2353            (emit-push-constant-float form))
    23302354           ((typep form 'double-float)
    2331             (emit 'ldc2_w (pool-double form))
     2355            (emit-push-constant-double form)
    23322356            (emit 'd2f))
    23332357           (t
     
    23492373            (emit-invokevirtual +lisp-bignum-class+ "doubleValue" nil "D"))
    23502374           ((typep form 'single-float)
    2351             (emit 'ldc (pool-float form))
     2375            (emit-push-constant-float form)
    23522376            (emit 'f2d))
    23532377           ((typep form 'double-float)
    2354             (emit 'ldc2_w (pool-double form)))
     2378            (emit-push-constant-double form))
    23552379           (t
    23562380            (sys::%format t "compile-constant :double representation~%")
  • trunk/abcl/src/org/armedbear/lisp/opcodes.lisp

    r11518 r11582  
    6464(define-opcode lconst_0 9 1 2)
    6565(define-opcode lconst_1 10 1 2)
    66 (define-opcode fconst_0 11 1 nil)
    67 (define-opcode fconst_1 12 1 nil)
    68 (define-opcode fconst_2 13 1 nil)
    69 (define-opcode dconst_0 14 1 nil)
    70 (define-opcode dconst_1 15 1 nil)
     66(define-opcode fconst_0 11 1 1)
     67(define-opcode fconst_1 12 1 1)
     68(define-opcode fconst_2 13 1 1)
     69(define-opcode dconst_0 14 1 2)
     70(define-opcode dconst_1 15 1 2)
    7171(define-opcode bipush 16 2 1)
    7272(define-opcode sipush 17 3 1)
Note: See TracChangeset for help on using the changeset viewer.