Changeset 15093 for trunk/source/level-1

Nov 28, 2011, 6:32:59 PM (8 years ago)

New Linux ARM binaries.

The image and FASL versions changed on the ARM, but (if I did it right)
not on other platforms.

(The image and FASL versions are now architecture-specific. This may
make it somewhat easier and less disruptive to change them, since the
motivation for such a change is often also architecture-specific.)
The FASL and current image version are defined (in the "TARGET" package)
in the architecture-specific *-arch.lisp files; the min, max, and current
image versions are defined in the *constants*.h file for the architecture.

Most of the changes are ARM-specific.

Each TCR now contains a 256-word table at byte offset 256. (We've
been using about 168 bytes in the TCR, so there are still 88 bytes/22
words left for expansion.) The table is initialized at TCR-creation
time to contain the absolute addresses of the subprims (there are
currently around 130 defined); we try otherwise not to reference
subprims by absolute address. Jumping to a subprim is:

(ldr pc (:@ rcontext (:$ offset-of-subprim-in-tcr-table)))

and calling one involves loading its address from that table into a
register and doing (blx reg). We canonically use LR as the register,
since it's going to be clobbered by the blx anyway and there doesn't
seem to be a performance hazard there. The old scheme (which involved
using BA and BLA pseudoinstructions to jump to/call a hidden jump table
at the end of the function) is no longer supported.

ARM Subprims no longer need to be aligned (on anything more than an
instruction boundary.) Some remnants of the consequences of an old
scheme (where subprims had to "fit" in small regions and sometimes
had to jump out of line if they would overflow that region's bounds)
still remain, but we can repair that (and it'll be a bit more straightforward
to add new ARM subprims.) We no longer care (much) about where subprims
are mapped in memory, and don't have to bias suprimitive addresses by
a platform-specific constant (and have to figure out whether or not we've
already done so) on (e.g.) Android.

Rather than setting the first element (fn.entrypoint) of a
newly-created function to the (absolute) address of a subprim that updates
that entrypoint on the first call, we use a little LAP function to correct
the address before the function can be called.

Non-function objects that can be stored in symbols' function cells
(the UNDEFINED-FUNCTION object, the things that encapsulate
special-operator names and global macro-functions) need to be
structured like FUNCTIONS: the need to have a word-aligned entrypoint
in element 0 that tracks the CODE-VECTOR object in element 1. We
don't want these things to be of type FUNCTION, but do want the GC to
adjust the entrypoint if the codevector moves. We've been essentially
out of GVECTOR subtags on 32-bit platforms, largely because of the
constraints that vector/array subtags must be greater than other
subtags and numeric types be less. The first constraint is probably
reasonable, but the second isn't: other typecodes (tag-list, etc) may
be less than the maximum numeric typecode, so tests like NUMBERP can't
reliably involve a simple comparison. (As long as a mask of all
numeric typecodes will fit in a machine word/FIXNUM, a simple LOGBITP
test can be used instead.) Removed all portable and ARM-specific code
that made assumptions about numeric typecode ordering, made a few more
gvector typecodes available, and used one of them to define a new
"pseudofunction" type. Made the GC update the entrypoints of
pseudofunctions and used them for the undefined-function object and
for the function cells of macros/special-operators.

Since we don't need the subprim jump table at the end of each function
anymore, we can more easily revive the idea of embedded pc-relative
constant data ("constant pools") and initialize FPRs from constant
data, avoiding most remaining traffic between FPRs and GPRs.

I've had a fairly-reproducible cache-coherency problem: on the first
GC in the cold load, the thread misbehaves mysteriously when it
resumes. The GC tries to synchronize the I and D caches on the entire
range of addresses that may contain newly-moved code-vectors. I'm not
at all sure why, but walking that range and flushing the cache for
each code-vector individually seems to avoid the problem (and may actually
be faster.)

Fix ticket:894

Fixed a few typos in error messages/comments/etc.

I -think- that the non-ARM-specific changes (how FASL/image versions are
defined) should bootstrap cleanly, but won't know for sure until this is
committed. (I imagine that the buildbot will complain if not.)

6 edited


  • trunk/source/level-1/arm-callback-support.lisp

    r14119 r15093  
    3131            (arm-lap-word (ldr pc (:@ pc (:$ -4))))
    3232            (%get-unsigned-long p 8)
    33              #.(subprim-name->offset '.SPeabi-callback))
     33            (%lookup-subprim-address #.(subprim-name->offset '.SPeabi-callback)))
    3434      (ff-call (%kernel-import #.arm::kernel-import-makedataexecutable)
    3535               :address p
  • trunk/source/level-1/l1-clos-boot.lisp

    r14626 r15093  
    16831683(defstatic *function-class* (make-built-in-class 'function))
     1686(make-built-in-class 'pseudofunction)
    16851688(defun alias-class (name class)
    16861689  (setf (find-class name) class
    23522355          (map-subtag target::subtag-xcode-vector xcode-vector)
    23532356          (map-subtag target::subtag-xfunction xfunction)
     2357          #+arm-target
     2358          (map-subtag arm::subtag-pseudofunction pseudofunction)
    23542359          (map-subtag target::subtag-single-float-vector simple-short-float-vector)
    23552360          #+64-bit-target
    26162621   (dpb 1 $lfbits-numreq (ash 1 $lfbits-method-bit)))
    26172622  #+arm-target
    2618   (gvector :function
    2619            #.(ash (arm::arm-subprimitive-address '.SPfix-nfn-entrypoint) (- arm::fixnumshift))
     2623  (%fix-fn-entrypoint
     2624   (gvector :function
     2625           0
    26202626           (uvref *reader-method-function-proto* 1)
    26212627           (ensure-slot-id (%slot-definition-name dslotd))
    26232629           nil                          ;method-function name
    26242630           (dpb 1 $lfbits-numreq (ash 1 $lfbits-method-bit))))
     2631  )
    26262633(defmethod create-writer-method-function ((class slots-class)
    26422649     (dpb 2 $lfbits-numreq (ash 1 $lfbits-method-bit)))
    26432650    #+arm-target
    2644     (gvector :function
    2645              #.(ash (arm::arm-subprimitive-address '.SPfix-nfn-entrypoint) (- arm::fixnumshift))
     2651    (%fix-fn-entrypoint
     2652     (gvector :function
     2653             0
    26462654             (uvref *writer-method-function-proto* 1)
    26472655             (ensure-slot-id (%slot-definition-name dslotd))
    26482656             'set-slot-id-value
    26492657             nil
    2650              (dpb 2 $lfbits-numreq (ash 1 $lfbits-method-bit)))
     2658             (dpb 2 $lfbits-numreq (ash 1 $lfbits-method-bit))))
    26512659  )
  • trunk/source/level-1/l1-clos.lisp

    r15001 r15093  
    381381                                     (ash -1 $lfbits-noname-bit)))
    382382              #+arm-target
    383               (gvector :function
    384                        #.(ash (arm::arm-subprimitive-address '.SPfix-nfn-entrypoint) (- arm::fixnumshift))
     383              (%fix-fn-entrypoint
     384               (gvector :function
     385                       0
    385386                       (%svref (if small
    386387                                 #'%small-map-slot-id-lookup
    389390                       table
    390391                       (dpb 1 $lfbits-numreq
    391                             (ash -1 $lfbits-noname-bit)))
     392                            (ash -1 $lfbits-noname-bit))))
    392393              #+x86-target
    393394              (%clone-x86-function (if small
    413414                            (ash -1 $lfbits-noname-bit)))
    414415              #+arm-target
    415               (gvector :function
    416                        #.(ash (arm::arm-subprimitive-address '.SPfix-nfn-entrypoint) (- arm::fixnumshift))
     416              (%fix-fn-entrypoint
     417               (gvector :function
     418                        0
    417419                       (%svref (if small
    418420                                 #'%small-slot-id-value
    424426                       #'%slot-id-ref-missing
    425427                       (dpb 2 $lfbits-numreq
    426                             (ash -1 $lfbits-noname-bit)))
     428                            (ash -1 $lfbits-noname-bit))))
    427429              #+x86-target
    428430              (%clone-x86-function (if small
    450452                            (ash -1 $lfbits-noname-bit)))
    451453              #+arm-target
    452               (gvector :function
    453                        #.(ash (arm::arm-subprimitive-address '.SPfix-nfn-entrypoint) (- arm::fixnumshift))
     454              (%fix-fn-entrypoint
     455               (gvector :function
     456                        0
    454457                       (%svref (if small
    455458                                 #'%small-set-slot-id-value
    461464                       #'%slot-id-set-missing
    462465                       (dpb 3 $lfbits-numreq
    463                             (ash -1 $lfbits-noname-bit)))
     466                            (ash -1 $lfbits-noname-bit))))
    464467              #+x86-target
    465468              (%clone-x86-function
    17061709                                        (ash 1 $lfbits-aok-bit)))
    17071710           #+arm-target
    1708            (gvector :function
    1709                     #.(ash (arm::arm-subprimitive-address '.SPfix-nfn-entrypoint) (- arm::fixnumshift))
     1711           (%fix-fn-entrypoint
     1712            (gvector :function
     1713                     0
    17101714                    *unset-fin-code*
    17111715                    wrapper
    17151719                    0
    17161720                    (logior (ash 1 $lfbits-gfn-bit)
    1717                             (ash 1 $lfbits-aok-bit)))))
     1721                            (ash 1 $lfbits-aok-bit))))))
    17181722    (setf (slot-vector.instance slots) fn)
    17191723    (when dt
  • trunk/source/level-1/l1-dcode.lisp

    r14860 r15093  
    428428                 (slots (allocate-typed-vector :slot-vector (1+ len) (%slot-unbound-marker)))
    429429                 (fn #+(or ppc-target arm-target)
    430                    (gvector :function
    431                             #+arm-target #.(ash (arm::arm-subprimitive-address '.SPfix-nfn-entrypoint) (- arm::fixnumshift))
     430                     (#+arm-target
     431                      %fix-fn-entrypoint
     432                      #-arm-target
     433                      progn
     434                      (gvector :function
     435                            #+arm-target 0
    432436                              *gf-proto-code*
    433437                              wrapper
    437441                              0
    438442                              (%ilogior (%ilsl $lfbits-gfn-bit 1)
    439                                         (%ilogand $lfbits-args-mask 0)))
     443                                        (%ilogand $lfbits-args-mask 0))))
    440444                   #+x86-target
    441445                   (%clone-x86-function *gf-proto*
    476480  ;; set bits and name = gf
    477481  #+(or ppc-target arm-target)
    478   (gvector :function
    479            #+arm-target #.(ash (arm::arm-subprimitive-address '.SPfix-nfn-entrypoint) (- arm::fixnumshift))
     482  (#+arm-target
     483   %fix-fn-entrypoint
     484   #-arm-target
     485   progn
     486   (gvector :function         
     487           #+arm-target 0
    480488           *cm-proto-code*
    481489           thing
    483491           gf
    484492           (%ilogior (%ilsl $lfbits-cm-bit 1)
    485                             (%ilogand $lfbits-args-mask (lfun-bits gf))))
     493                            (%ilogand $lfbits-args-mask (lfun-bits gf)))))
    486494  #+x86-target
    487495  (%clone-x86-function *cm-proto*
  • trunk/source/level-1/l1-sockets.lisp

    r14803 r15093  
    1269 ;;; If attempts to connnect are interrupted, we basically have to
     1269;;; If attempts to connect are interrupted, we basically have to
    12701270;;; wait in #_select (or the equivalent).  There's a good rant
    12711271;;; about these issues in:
  • trunk/source/level-1/l1-typesys.lisp

    r14558 r15093  
    43164316           (dpb 1 $lfbits-numreq 0))
    43174317  #+arm-target
    4318   (gvector :function
    4319            #.(ash (arm::arm-subprimitive-address '.SPfix-nfn-entrypoint) (- arm::fixnumshift))
     4318  (%fix-fn-entrypoint
     4319   (gvector :function
     4320           0
    43204321           (uvref *simple-predicate-function-prototype* 1)
    43214322           datum
    43224323           function
    43234324           nil
    4324            (dpb 1 $lfbits-numreq 0))
     4325           (dpb 1 $lfbits-numreq 0)))
    43254326  #+x86-target
    43264327  (%clone-x86-function
Note: See TracChangeset for help on using the changeset viewer.