mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
assembly/disassembly support for br-if-nargs-*
* module/language/assembly/compile-bytecode.scm (write-bytecode): Handle br-if-nargs compilation. * module/language/assembly/decompile-bytecode.scm (decode-load-program): And decompile them nicely as well. * module/language/assembly/disassemble.scm (code-annotation): And, present the disassembly if br-if-nargs-* nicely.
This commit is contained in:
parent
df435c8307
commit
8b65211204
3 changed files with 9 additions and 0 deletions
|
@ -137,6 +137,9 @@
|
|||
((br-if-not-eq ,l) (write-break l))
|
||||
((br-if-null ,l) (write-break l))
|
||||
((br-if-not-null ,l) (write-break l))
|
||||
((br-if-nargs-ne ,hi ,lo ,l) (write-byte hi) (write-byte lo) (write-break l))
|
||||
((br-if-nargs-lt ,hi ,lo ,l) (write-byte hi) (write-byte lo) (write-break l))
|
||||
((br-if-nargs-gt ,hi ,lo ,l) (write-byte hi) (write-byte lo) (write-break l))
|
||||
((mv-call ,n ,l) (write-byte n) (write-break l))
|
||||
(else
|
||||
(cond
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
|
||||
(define (br-instruction? x)
|
||||
(memq x '(br br-if br-if-not br-if-eq br-if-not-eq br-if-null br-if-not-null)))
|
||||
(define (br-nargs-instruction? x)
|
||||
(memq x '(br-if-nargs-ne br-if-nargs-lt br-if-nargs-gt)))
|
||||
|
||||
(define (bytes->s24 a b c)
|
||||
(let ((x (+ (ash a 16) (ash b 8) c)))
|
||||
|
@ -84,6 +86,8 @@
|
|||
(pmatch exp
|
||||
((,br ,rel1 ,rel2 ,rel3) (guard (br-instruction? br))
|
||||
(lp (cons `(,br ,(ensure-label rel1 rel2 rel3)) out)))
|
||||
((,br ,hi ,lo ,rel1 ,rel2 ,rel3) (guard (br-nargs-instruction? br))
|
||||
(lp (cons `(,br ,hi ,lo ,(ensure-label rel1 rel2 rel3)) out)))
|
||||
((mv-call ,n ,rel1 ,rel2 ,rel3)
|
||||
(lp (cons `(mv-call ,n ,(ensure-label rel1 rel2 rel3)) out)))
|
||||
(else
|
||||
|
|
|
@ -132,6 +132,8 @@
|
|||
(list "~a element~:p" (apply make-int16 args)))
|
||||
((br br-if br-if-eq br-if-not br-if-not-eq br-if-not-null br-if-null)
|
||||
(list "-> ~A" (assq-ref labels (car args))))
|
||||
((br-if-nargs-ne br-if-nargs-lt br-if-nargs-gt)
|
||||
(list "-> ~A" (assq-ref labels (caddr args))))
|
||||
((object-ref)
|
||||
(and objs (list "~s" (vector-ref objs (car args)))))
|
||||
((local-ref local-boxed-ref local-set local-boxed-set)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue