Skip to content

Commit

Permalink
A little housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
ircmaxell committed Apr 1, 2019
1 parent b43ffb2 commit d7531ac
Show file tree
Hide file tree
Showing 20 changed files with 1,048 additions and 683 deletions.
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions examples/00-basic-usage/example.output
@@ -1,7 +1,7 @@
Compiled Timers:
libjit compiled in: 0.00068402290344238 seconds
libgccjit compiled in: 0.02912712097168 seconds
llvm compiled in: 0.00061798095703125 seconds
libjit compiled in: 0.0006108283996582 seconds
libgccjit compiled in: 0.025923013687134 seconds
llvm compiled in: 0.0005640983581543 seconds
Add Function:
long long add(long long a, long long b) {
return a + b;
Expand All @@ -24,8 +24,8 @@ Add Function:


Benchmarked as:
libjit executed in 0.13226914405823 seconds
libgccjit executed in 0.1288149356842 seconds
llvm executed in 0.12803411483765 seconds
native php executed in 0.02628493309021 seconds
libjit executed in 0.12564086914062 seconds
libgccjit executed in 0.12345600128174 seconds
llvm executed in 0.12525701522827 seconds
native php executed in 0.026178121566772 seconds

22 changes: 11 additions & 11 deletions examples/00-basic-usage/libjit.s
Expand Up @@ -5,17 +5,17 @@ function add(long, long) : long

Disassembly of section .text:

00007f91b64b1148 <.text>:
7f91b64b1148: 55 push %rbp
7f91b64b1149: 48 8b ec mov %rsp,%rbp
7f91b64b114c: 48 83 ec 10 sub $0x10,%rsp
7f91b64b1150: 48 89 7d f8 mov %rdi,-0x8(%rbp)
7f91b64b1154: 48 89 75 f0 mov %rsi,-0x10(%rbp)
7f91b64b1158: 48 8b 45 f8 mov -0x8(%rbp),%rax
7f91b64b115c: 48 03 45 f0 add -0x10(%rbp),%rax
7f91b64b1160: 48 8b e5 mov %rbp,%rsp
7f91b64b1163: 5d pop %rbp
7f91b64b1164: c3 retq
00007f2546b29148 <.text>:
7f2546b29148: 55 push %rbp
7f2546b29149: 48 8b ec mov %rsp,%rbp
7f2546b2914c: 48 83 ec 10 sub $0x10,%rsp
7f2546b29150: 48 89 7d f8 mov %rdi,-0x8(%rbp)
7f2546b29154: 48 89 75 f0 mov %rsi,-0x10(%rbp)
7f2546b29158: 48 8b 45 f8 mov -0x8(%rbp),%rax
7f2546b2915c: 48 03 45 f0 add -0x10(%rbp),%rax
7f2546b29160: 48 8b e5 mov %rbp,%rsp
7f2546b29163: 5d pop %rbp
7f2546b29164: c3 retq

end

7 changes: 4 additions & 3 deletions examples/00-basic-usage/llvm.s
@@ -1,14 +1,15 @@
.text
.file "/tmp/llvmlWThK2.bc"
.file "test_0"
.globl add
.p2align 4, 0x90
.type add,@function
add: # @add
# BB#0: # %main
add:
.cfi_startproc
leaq (%rdi,%rsi), %rax
retq
.Lfunc_end0:
.size add, .Lfunc_end0-add
.cfi_endproc


.section ".note.GNU-stack","",@progbits
14 changes: 7 additions & 7 deletions examples/01-branching/example.output
@@ -1,7 +1,7 @@
Compiled Timers:
libjit compiled in: 0.00071096420288086 seconds
libgccjit compiled in: 0.027981042861938 seconds
llvm compiled in: 0.00070595741271973 seconds
libjit compiled in: 0.0006561279296875 seconds
libgccjit compiled in: 0.026895999908447 seconds
llvm compiled in: 0.000640869140625 seconds
Add1or2 Function:
long long add1or2(long long shouldAdd1, long long a) {
if (shouldAdd > 0) {
Expand All @@ -27,8 +27,8 @@ Add1or2 Function:


Benchmarked as:
libjit executed in 0.13166809082031 seconds
libgccjit executed in 0.12690496444702 seconds
llvm executed in 0.12615704536438 seconds
native php executed in 0.028677940368652 seconds
libjit executed in 0.12417197227478 seconds
libgccjit executed in 0.12450790405273 seconds
llvm executed in 0.12170100212097 seconds
native php executed in 0.027600049972534 seconds

46 changes: 23 additions & 23 deletions examples/01-branching/libjit.s
Expand Up @@ -5,29 +5,29 @@ function add1or2(long, long) : long

Disassembly of section .text:

00007f8a68f4c13f <.text>:
7f8a68f4c13f: 55 push %rbp
7f8a68f4c140: 48 8b ec mov %rsp,%rbp
7f8a68f4c143: 48 83 ec 20 sub $0x20,%rsp
7f8a68f4c147: 4c 89 34 24 mov %r14,(%rsp)
7f8a68f4c14b: 4c 89 7c 24 08 mov %r15,0x8(%rsp)
7f8a68f4c150: 4c 8b ff mov %rdi,%r15
7f8a68f4c153: 4c 8b f6 mov %rsi,%r14
7f8a68f4c156: 49 83 ff 00 cmp $0x0,%r15
7f8a68f4c15a: 0f 8f 05 00 00 00 jg 0x7f8a68f4c165
7f8a68f4c160: e9 0f 00 00 00 jmpq 0x7f8a68f4c174
7f8a68f4c165: 49 8b c6 mov %r14,%rax
7f8a68f4c168: 48 89 45 f8 mov %rax,-0x8(%rbp)
7f8a68f4c16c: 48 ff c0 inc %rax
7f8a68f4c16f: e9 0b 00 00 00 jmpq 0x7f8a68f4c17f
7f8a68f4c174: 49 8b c6 mov %r14,%rax
7f8a68f4c177: 48 89 45 f0 mov %rax,-0x10(%rbp)
7f8a68f4c17b: 48 83 c0 02 add $0x2,%rax
7f8a68f4c17f: 4c 8b 34 24 mov (%rsp),%r14
7f8a68f4c183: 4c 8b 7c 24 08 mov 0x8(%rsp),%r15
7f8a68f4c188: 48 8b e5 mov %rbp,%rsp
7f8a68f4c18b: 5d pop %rbp
7f8a68f4c18c: c3 retq
00007f508b18a13f <.text>:
7f508b18a13f: 55 push %rbp
7f508b18a140: 48 8b ec mov %rsp,%rbp
7f508b18a143: 48 83 ec 20 sub $0x20,%rsp
7f508b18a147: 4c 89 34 24 mov %r14,(%rsp)
7f508b18a14b: 4c 89 7c 24 08 mov %r15,0x8(%rsp)
7f508b18a150: 4c 8b ff mov %rdi,%r15
7f508b18a153: 4c 8b f6 mov %rsi,%r14
7f508b18a156: 49 83 ff 00 cmp $0x0,%r15
7f508b18a15a: 0f 8f 05 00 00 00 jg 0x7f508b18a165
7f508b18a160: e9 0f 00 00 00 jmpq 0x7f508b18a174
7f508b18a165: 49 8b c6 mov %r14,%rax
7f508b18a168: 48 89 45 f8 mov %rax,-0x8(%rbp)
7f508b18a16c: 48 ff c0 inc %rax
7f508b18a16f: e9 0b 00 00 00 jmpq 0x7f508b18a17f
7f508b18a174: 49 8b c6 mov %r14,%rax
7f508b18a177: 48 89 45 f0 mov %rax,-0x10(%rbp)
7f508b18a17b: 48 83 c0 02 add $0x2,%rax
7f508b18a17f: 4c 8b 34 24 mov (%rsp),%r14
7f508b18a183: 4c 8b 7c 24 08 mov 0x8(%rsp),%r15
7f508b18a188: 48 8b e5 mov %rbp,%rsp
7f508b18a18b: 5d pop %rbp
7f508b18a18c: c3 retq

end

20 changes: 11 additions & 9 deletions examples/01-branching/llvm.s
@@ -1,22 +1,24 @@
.text
.file "/tmp/llvmzfL9TZ.bc"
.file "test_0"
.globl add1or2
.p2align 4, 0x90
.type add1or2,@function
add1or2: # @add1or2
# BB#0: # %main
add1or2:
.cfi_startproc
testq %rdi, %rdi
jle .LBB0_2
# BB#1: # %main_if
incq %rsi
movq %rsi, %rax
movq %rsi, -8(%rsp)
movq -8(%rsp), %rax
incq %rax
retq
.LBB0_2: # %main_else
addq $2, %rsi
movq %rsi, %rax
.LBB0_2:
movq %rsi, -16(%rsp)
movq -16(%rsp), %rax
addq $2, %rax
retq
.Lfunc_end0:
.size add1or2, .Lfunc_end0-add1or2
.cfi_endproc


.section ".note.GNU-stack","",@progbits
14 changes: 7 additions & 7 deletions examples/02-function_calls/example.output
@@ -1,7 +1,7 @@
Compiled Timers:
libjit compiled in: 0.00065302848815918 seconds
libgccjit compiled in: 0.035019874572754 seconds
llvm compiled in: 0.00079607963562012 seconds
libjit compiled in: 0.00070500373840332 seconds
libgccjit compiled in: 0.026451826095581 seconds
llvm compiled in: 0.00062012672424316 seconds
Add2 Function:
long long add(long long a, long long b) {
return a + b;
Expand All @@ -27,8 +27,8 @@ Add2 Function:


Benchmarked as:
libjit executed in 0.13392019271851 seconds
libgccjit executed in 0.12944078445435 seconds
llvm executed in 0.12808418273926 seconds
native php executed in 0.091994047164917 seconds
libjit executed in 0.14361906051636 seconds
libgccjit executed in 0.12762498855591 seconds
llvm executed in 0.12507009506226 seconds
native php executed in 0.087481021881104 seconds

62 changes: 31 additions & 31 deletions examples/02-function_calls/libjit.s
Expand Up @@ -5,17 +5,17 @@ function add(long, long) : long

Disassembly of section .text:

00007f71f3f7a258 <.text>:
7f71f3f7a258: 55 push %rbp
7f71f3f7a259: 48 8b ec mov %rsp,%rbp
7f71f3f7a25c: 48 83 ec 10 sub $0x10,%rsp
7f71f3f7a260: 48 89 7d f8 mov %rdi,-0x8(%rbp)
7f71f3f7a264: 48 89 75 f0 mov %rsi,-0x10(%rbp)
7f71f3f7a268: 48 8b 45 f8 mov -0x8(%rbp),%rax
7f71f3f7a26c: 48 03 45 f0 add -0x10(%rbp),%rax
7f71f3f7a270: 48 8b e5 mov %rbp,%rsp
7f71f3f7a273: 5d pop %rbp
7f71f3f7a274: c3 retq
00007fad6b23e258 <.text>:
7fad6b23e258: 55 push %rbp
7fad6b23e259: 48 8b ec mov %rsp,%rbp
7fad6b23e25c: 48 83 ec 10 sub $0x10,%rsp
7fad6b23e260: 48 89 7d f8 mov %rdi,-0x8(%rbp)
7fad6b23e264: 48 89 75 f0 mov %rsi,-0x10(%rbp)
7fad6b23e268: 48 8b 45 f8 mov -0x8(%rbp),%rax
7fad6b23e26c: 48 03 45 f0 add -0x10(%rbp),%rax
7fad6b23e270: 48 8b e5 mov %rbp,%rsp
7fad6b23e273: 5d pop %rbp
7fad6b23e274: c3 retq

end

Expand All @@ -26,26 +26,26 @@ function add2(long, long) : long

Disassembly of section .text:

00007f71f3f7a2a9 <.text>:
7f71f3f7a2a9: 55 push %rbp
7f71f3f7a2aa: 48 8b ec mov %rsp,%rbp
7f71f3f7a2ad: 48 83 ec 20 sub $0x20,%rsp
7f71f3f7a2b1: 4c 89 3c 24 mov %r15,(%rsp)
7f71f3f7a2b5: 48 89 7d f8 mov %rdi,-0x8(%rbp)
7f71f3f7a2b9: 4c 8b fe mov %rsi,%r15
7f71f3f7a2bc: 49 8b f7 mov %r15,%rsi
7f71f3f7a2bf: 48 8b 7d f8 mov -0x8(%rbp),%rdi
7f71f3f7a2c3: b8 08 00 00 00 mov $0x8,%eax
7f71f3f7a2c8: e8 8b ff ff ff callq 0x7f71f3f7a258
7f71f3f7a2cd: 49 8b f7 mov %r15,%rsi
7f71f3f7a2d0: 48 8b f8 mov %rax,%rdi
7f71f3f7a2d3: 48 89 45 f0 mov %rax,-0x10(%rbp)
7f71f3f7a2d7: b8 08 00 00 00 mov $0x8,%eax
7f71f3f7a2dc: e8 77 ff ff ff callq 0x7f71f3f7a258
7f71f3f7a2e1: 4c 8b 3c 24 mov (%rsp),%r15
7f71f3f7a2e5: 48 8b e5 mov %rbp,%rsp
7f71f3f7a2e8: 5d pop %rbp
7f71f3f7a2e9: c3 retq
00007fad6b23e2a9 <.text>:
7fad6b23e2a9: 55 push %rbp
7fad6b23e2aa: 48 8b ec mov %rsp,%rbp
7fad6b23e2ad: 48 83 ec 20 sub $0x20,%rsp
7fad6b23e2b1: 4c 89 3c 24 mov %r15,(%rsp)
7fad6b23e2b5: 48 89 7d f8 mov %rdi,-0x8(%rbp)
7fad6b23e2b9: 4c 8b fe mov %rsi,%r15
7fad6b23e2bc: 49 8b f7 mov %r15,%rsi
7fad6b23e2bf: 48 8b 7d f8 mov -0x8(%rbp),%rdi
7fad6b23e2c3: b8 08 00 00 00 mov $0x8,%eax
7fad6b23e2c8: e8 8b ff ff ff callq 0x7fad6b23e258
7fad6b23e2cd: 49 8b f7 mov %r15,%rsi
7fad6b23e2d0: 48 8b f8 mov %rax,%rdi
7fad6b23e2d3: 48 89 45 f0 mov %rax,-0x10(%rbp)
7fad6b23e2d7: b8 08 00 00 00 mov $0x8,%eax
7fad6b23e2dc: e8 77 ff ff ff callq 0x7fad6b23e258
7fad6b23e2e1: 4c 8b 3c 24 mov (%rsp),%r15
7fad6b23e2e5: 48 8b e5 mov %rbp,%rsp
7fad6b23e2e8: 5d pop %rbp
7fad6b23e2e9: c3 retq

end

35 changes: 29 additions & 6 deletions examples/02-function_calls/llvm.s
@@ -1,24 +1,47 @@
.text
.file "/tmp/llvmY7BoJS.bc"
.file "test_0"
.globl add
.p2align 4, 0x90
.type add,@function
add: # @add
# BB#0: # %main
add:
.cfi_startproc
leaq (%rdi,%rsi), %rax
retq
.Lfunc_end0:
.size add, .Lfunc_end0-add
.cfi_endproc

.globl add2
.p2align 4, 0x90
.type add2,@function
add2: # @add2
# BB#0: # %main
leaq (%rdi,%rsi,2), %rax
add2:
.cfi_startproc
pushq %r14
.Lcfi0:
.cfi_def_cfa_offset 16
pushq %rbx
.Lcfi1:
.cfi_def_cfa_offset 24
pushq %rax
.Lcfi2:
.cfi_def_cfa_offset 32
.Lcfi3:
.cfi_offset %rbx, -24
.Lcfi4:
.cfi_offset %r14, -16
movq %rsi, %rbx
movabsq $add, %r14
callq *%r14
movq %rax, %rdi
movq %rbx, %rsi
callq *%r14
addq $8, %rsp
popq %rbx
popq %r14
retq
.Lfunc_end1:
.size add2, .Lfunc_end1-add2
.cfi_endproc


.section ".note.GNU-stack","",@progbits
14 changes: 7 additions & 7 deletions examples/03-iterated-function-calls/example.output
@@ -1,7 +1,7 @@
Compiled Timers:
libjit compiled in: 0.0014710426330566 seconds
libgccjit compiled in: 0.040103912353516 seconds
llvm compiled in: 0.0010890960693359 seconds
libjit compiled in: 0.0014040470123291 seconds
libgccjit compiled in: 0.0382399559021 seconds
llvm compiled in: 0.0010750293731689 seconds
Add2 Function:
long long add(long long a, long long b) {
return a + b;
Expand Down Expand Up @@ -30,8 +30,8 @@ Add2 Function:


Benchmarked as:
libjit executed in 0.33051800727844 seconds
libgccjit executed in 0.34424805641174 seconds
llvm executed in 0.2781810760498 seconds
native php executed in 2.3212180137634 seconds
libjit executed in 0.32719302177429 seconds
libgccjit executed in 0.33348393440247 seconds
llvm executed in 0.26501703262329 seconds
native php executed in 2.8156199455261 seconds

0 comments on commit d7531ac

Please sign in to comment.