Skip to content

Instantly share code, notes, and snippets.

@vibhavp
Last active October 7, 2018 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vibhavp/f35e8db0a91bb7638cf48197e64ece84 to your computer and use it in GitHub Desktop.
Save vibhavp/f35e8db0a91bb7638cf48197e64ece84 to your computer and use it in GitHub Desktop.
Emacs Lisp JIT. CFG - https://i.imgur.com/5ngWLUx.png
(defun factorial (n)
(let ((i 1)
(fac 1))
(while (/= i (1+ n))
(setq fac (* fac i)
i (+ i 1)))
fac))
(gcc-jit-compile 'factorial nil "factorial1.dot" "factorial.s" 3)
.file "fake.c"
.text
.p2align 4,,15
.globl __gcc_jit_compiled
.type __gcc_jit_compiled, @function
__gcc_jit_compiled:
.LFB9:
.cfi_startproc
.L156:
.L157:
pushq %r13
.cfi_def_cfa_offset 16
.cfi_offset 13, -16
movl $5673013, %eax
pushq %r12
.cfi_def_cfa_offset 24
.cfi_offset 12, -24
pushq %rbp
.cfi_def_cfa_offset 32
.cfi_offset 6, -32
pushq %rbx
.cfi_def_cfa_offset 40
.cfi_offset 3, -40
movl $6420311, %ebx
subq $72, %rsp
.cfi_def_cfa_offset 112
call *%rax
movl $6, %esi
movl $59682608, %edi
movq %rax, %r13
call *%rbx
movl $6, %esi
movl $1018368, %edi
call *%rbx
movl $6753336, %ebx
movl $1018368, %edi
call *%rbx
movl $4509856, %edi
movq %rax, %rbp
call *%rbx
movq %rax, %rdi
movl $6292244, %eax
call *%rax
xorl %edx, %edx
movq %rbp, %rdi
movq %rax, %rsi
movl $6283397, %eax
call *%rax
testq %rax, %rax
je .L159
.L158:
.L161:
.L162:
.L163:
.L164:
.L165:
.L166:
.L167:
.L168:
movl $59682608, %edi
movl $6753336, %eax
movl $5673013, %ebx
call *%rax
movq %rax, %rbp
call *%rbx
xorl %esi, %esi
leaq -2(%rax), %rdi
movl $6422433, %eax
call *%rax
call *%rbx
movq %r13, %rdi
movq %rax, %rsi
movl $6754300, %eax
call *%rax
addq $72, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 40
movq %rbp, %rax
popq %rbx
.cfi_def_cfa_offset 32
popq %rbp
.cfi_def_cfa_offset 24
popq %r12
.cfi_def_cfa_offset 16
popq %r13
.cfi_def_cfa_offset 8
ret
.p2align 4,,10
.p2align 3
.L159:
.cfi_restore_state
movl $59682608, %edi
movl $6414405, %r12d
call *%rbx
movl $1018368, %edi
movq %rax, %rbp
call *%rbx
movq %rbp, 8(%rsp)
subq $8, %rsp
.cfi_def_cfa_offset 120
movl $3, %edi
movq %rax, 24(%rsp)
movl $6753447, %ebp
pushq 24(%rsp)
.cfi_def_cfa_offset 128
pushq 24(%rsp)
.cfi_def_cfa_offset 136
pushq $839888
.cfi_def_cfa_offset 144
call *%r12
movl $59682608, %edi
movq %rax, %rsi
addq $32, %rsp
.cfi_def_cfa_offset 112
call *%rbp
movl $1018368, %edi
call *%rbx
movl $3, %edi
movq $6, 48(%rsp)
movq %rax, 40(%rsp)
subq $8, %rsp
.cfi_def_cfa_offset 120
pushq 56(%rsp)
.cfi_def_cfa_offset 128
pushq 56(%rsp)
.cfi_def_cfa_offset 136
pushq $42576
.cfi_def_cfa_offset 144
call *%r12
movl $1018368, %edi
movq %rax, %rsi
addq $32, %rsp
.cfi_def_cfa_offset 112
call *%rbp
movl $1018368, %edi
call *%rbx
movl $4509856, %edi
movq %rax, %rbp
call *%rbx
movq %rax, %rdi
movl $6292244, %eax
call *%rax
xorl %edx, %edx
movq %rbp, %rdi
movq %rax, %rsi
movl $6283397, %eax
call *%rax
testq %rax, %rax
je .L159
.L160:
movl $5675140, %eax
call *%rax
movl $6401576, %eax
call *%rax
jmp .L168
.cfi_endproc
.LFE9:
.size __gcc_jit_compiled, .-__gcc_jit_compiled
.ident "GCC: (GNU) 8.2.1 20180831"
.section .note.GNU-stack,"",@progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment