Ignore:
Timestamp:
Sep 24, 2011, 8:36:16 AM (9 years ago)
Author:
gb
Message:

Conditionally (using *x862-generate-casejump*, which defaults to false
for now) enable code to do constant-time CASE for certain types/ranges
of keys via a jump table.

Make the X86 disassembler recognize references to labels referenced from
the jump table (though it doesn't yet do anything to show the jump table
itself.)

This is about as far along as the ARM backend has been for the last few
months; the mechanics of dispatching through the jump table seem to be
correct, but the code generated at each case label is only correct in
certain circumstances.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/X86/X8632/x8632-vinsns.lisp

    r14979 r14998  
    42174217  (movl (:@ (:% x8632::ebp)) (:% x8632::ebp)))
    42184218
     4219(define-x8632-vinsn (cjmp :branch) (((reg :lisp))
     4220                                    ((reg :lisp)
     4221                                     (minval :s32const)
     4222                                     (maxval :u32const)
     4223                                     (default :label))
     4224                                    ((temp :s32)
     4225                                    (rjmp :lisp)))
     4226  (testl (:$l x8664::fixnummask) (:%l reg))
     4227  (jne default)
     4228  ((:not (:pred zerop minval))
     4229   (subl (:$l minval) (:%l reg)))
     4230  (cmpl (:$l maxval) (:%l reg))
     4231  (ja default)
     4232  (movl (:%l reg) (:%l temp))
     4233  (shrl (:%l temp))
     4234  (movl (:@ (:^ :jtab) (:%l x8632::fn) (:%l temp)) (:%l temp))
     4235  (leal (:@ (:%l x8632::fn) (:%l temp)) (:%l rjmp))
     4236  (jmp (:%l rjmp))
     4237  (:uuo-section)
     4238  (:align 2)
     4239  (:long (:apply 1+ (:apply ash maxval (- x8632::fixnumshift))))
     4240  :jtab)
     4241
     4242(define-x8632-vinsn jtabentry (()
     4243                               ((label :label)))
     4244  (:uuo-section)
     4245  (:long (:^ label)))
     4246
    42194247(queue-fixup
    42204248 (fixup-x86-vinsn-templates
Note: See TracChangeset for help on using the changeset viewer.