Changeset 13792


Ignore:
Timestamp:
01/20/12 01:10:39 (10 years ago)
Author:
astalla
Message:

A small reorganization of compiler/jvm code. Runtime-class wasn't autoloading properly in certain situations due to a wrong dependency graph among some system files.

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

Legend:

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

    r13537 r13792  
    4343  (require "DUMP-FORM")
    4444  (require "JVM-INSTRUCTIONS")
     45  (require "JVM-CLASS-FILE")
    4546  (require "JAVA"))
    4647
  • trunk/abcl/src/org/armedbear/lisp/jvm-class-file.lisp

    r13764 r13792  
    3131
    3232(in-package "JVM")
     33(require '#:compiler-types)
    3334
    3435#|
     
    15121513|#
    15131514
     1515(provide '#:jvm-class-file)
  • trunk/abcl/src/org/armedbear/lisp/jvm-instructions.lisp

    r13710 r13792  
    3333(in-package #:jvm)
    3434
     35(declaim (inline u2 s1 s2))
     36
     37(defknown u2 (fixnum) cons)
     38(defun u2 (n)
     39  (declare (optimize speed))
     40  (declare (type (unsigned-byte 16) n))
     41  (when (not (<= 0 n 65535))
     42    (error "u2 argument ~A out of 65k range." n))
     43  (list (logand (ash n -8) #xff)
     44        (logand n #xff)))
     45
     46(defknown s1 (fixnum) fixnum)
     47(defun s1 (n)
     48  (declare (optimize speed))
     49  (declare (type (signed-byte 8) n))
     50  (when (not (<= -128 n 127))
     51    (error "s1 argument ~A out of 8-bit signed range." n))
     52  (if (< n 0)
     53      (1+ (logxor (- n) #xFF))
     54      n))
     55
     56
     57(defknown s2 (fixnum) cons)
     58(defun s2 (n)
     59  (declare (optimize speed))
     60  (declare (type (signed-byte 16) n))
     61  (when (not (<= -32768 n 32767))
     62    (error "s2 argument ~A out of 16-bit signed range." n))
     63  (u2 (if (< n 0) (1+ (logxor (- n) #xFFFF))
     64          n)))
    3565
    3666;;    OPCODES
  • trunk/abcl/src/org/armedbear/lisp/jvm.lisp

    r13514 r13792  
    7171  (declare (ignore ignored)))
    7272
    73 (declaim (inline u2 s1 s2))
    74 
    75 (defknown u2 (fixnum) cons)
    76 (defun u2 (n)
    77   (declare (optimize speed))
    78   (declare (type (unsigned-byte 16) n))
    79   (when (not (<= 0 n 65535))
    80     (error "u2 argument ~A out of 65k range." n))
    81   (list (logand (ash n -8) #xff)
    82         (logand n #xff)))
    83 
    84 (defknown s1 (fixnum) fixnum)
    85 (defun s1 (n)
    86   (declare (optimize speed))
    87   (declare (type (signed-byte 8) n))
    88   (when (not (<= -128 n 127))
    89     (error "s1 argument ~A out of 8-bit signed range." n))
    90   (if (< n 0)
    91       (1+ (logxor (- n) #xFF))
    92       n))
    93 
    94 
    95 (defknown s2 (fixnum) cons)
    96 (defun s2 (n)
    97   (declare (optimize speed))
    98   (declare (type (signed-byte 16) n))
    99   (when (not (<= -32768 n 32767))
    100     (error "s2 argument ~A out of 16-bit signed range." n))
    101   (u2 (if (< n 0) (1+ (logxor (- n) #xFFFF))
    102           n)))
    103 
    104 
    105 
    106 
    107 
    10873(defmacro with-saved-compiler-policy (&body body)
    10974  "Saves compiler policy variables, restoring them after evaluating `body'."
  • trunk/abcl/src/org/armedbear/lisp/known-symbols.lisp

    r13046 r13792  
    3232(in-package #:system)
    3333
     34(require "JVM-CLASS-FILE")
    3435(require "JAVA")
    3536
  • trunk/abcl/src/org/armedbear/lisp/runtime-class.lisp

    r13790 r13792  
    1 (require "COMPILER-PASS2")
    2 (require "JVM-CLASS-FILE")
     1(require "JVM")
    32
    43;;The package is set to :jvm for convenience, since most of the symbols used
     
    187186              (cond
    188187                ((jvm-class-name-p type) (aload 1))
    189                 ((eq type :int) (iload 1))
     188                ((eq type :int) (emit 'iload 1))
    190189                (t (error "Unsupported setter parameter type: ~A" type)))
    191190              (emit-putfield (class-file-class class-file) name type)
     
    219218
    220219;;TODO:
     220;; - Returning nil as null is broken
    221221;; - Function calls with 8+ args
    222222;; - super method invocation. Idea: generate companion methods super_... to use with plain jcall. Add a flag per method to optionally disable this when not needed.
Note: See TracChangeset for help on using the changeset viewer.