disassembly.org 3.1 KB

Disassembly

You can look at the disassembled GNU Guile virtual machine instructions, which a program translates into using the following commands:

guild compile my-guile-file.scm guild compile my-compiled-guile-file.go

For example the following script:

(define (plus1 a b) (+ a b))

(define plus2 (λ (a b) (+ a b)))

Might give the following disassembly:

Disassembly of at #xe8:

0 (instrument-entry 16354) at example-program-for-disassembly.scm:4:0 2 (assert-nargs-ee/locals 1 2) ;; 3 slots (0 args) 3 (call-scm<-thread 2 62) at example-program-for-disassembly.scm:1:0 5 (static-ref 1 16329) ;; plus1 7 (call-scm<-scm-scm 1 2 1 41) 9 (make-non-immediate 0 16327) ;; # 11 (scm-set!/immediate 1 1 0) 12 (static-ref 1 16336) ;; plus2 at example-program-for-disassembly.scm:4:0 14 (call-scm<-scm-scm 2 2 1 41) 16 (make-non-immediate 1 16334) ;; # 18 (scm-set!/immediate 2 1 1) 19 (make-immediate 2 2052) ;; # 20 (reset-frame 1) ;; 1 slot 21 (handle-interrupts) 22 (return-values)

Disassembly of plus1 at #x144:

0 (instrument-entry 16337) at example-program-for-disassembly.scm:1:0 2 (assert-nargs-ee/locals 3 0) ;; 3 slots (2 args) 3 (call-scm<-scm-scm 2 1 0 0) at example-program-for-disassembly.scm:2:2 5 (reset-frame 1) ;; 1 slot 6 (handle-interrupts) 7 (return-values)

Disassembly of plus2 at #x164:

0 (instrument-entry 16335) at example-program-for-disassembly.scm:5:2 2 (assert-nargs-ee/locals 3 0) ;; 3 slots (2 args) 3 (call-scm<-scm-scm 2 1 0 0) at example-program-for-disassembly.scm:6:4 5 (reset-frame 1) ;; 1 slot 6 (handle-interrupts) 7 (return-values)

Disassembly of at #x184:

0 (instrument-entry 16333) at example-program-for-disassembly.scm:6:4 2 (assert-nargs-ee/locals 1 1) ;; 2 slots (0 args) 3 (static-patch! 16286 28) 6 (make-non-immediate 1 16281) ;; "plus1" 8 (call-scm<-scm 1 1 14) 10 (static-set! 1 16285) ;; plus1 12 (static-patch! 16287 -28) 15 (static-patch! 16288 22) 18 (make-non-immediate 1 16283) ;; "plus2" 20 (call-scm<-scm 1 1 14) 22 (static-set! 1 16287) ;; plus2 24 (static-patch! 16289 -32) 27 (reset-frame 1) ;; 1 slot 28 (make-immediate 0 2052) ;; # 29 (return-values)