Skip to content

Instantly share code, notes, and snippets.

@ircmaxell
Last active August 29, 2015 14:04
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 ircmaxell/02dffcf6f49dcbc23103 to your computer and use it in GitHub Desktop.
Save ircmaxell/02dffcf6f49dcbc23103 to your computer and use it in GitHub Desktop.
<?php
/**
* @param int
* @param int
* @return int
*/
function foo($a, $b) {
$c = 0;
if ($a) {
$c = $a;
} else {
$c = $b;
}
return $c + 1;
}
function foo(l1 : long, l2 : long) : long
incoming_reg(l1, rdi)
incoming_reg(l2, rsi)
.L:
l5 = 0
if lfalse(l1) then goto .L0
.L:
l5 = l1
.L1:
l9 = l5 + 1
l7 = l9
return_long(l7)
ends_in_dead
.L0:
l5 = l2
goto .L1
ends_in_dead
.L:
.L:
end
function foo(long, long) : long
/tmp/libjit-dump.o: file format elf64-x86-64
Disassembly of section .text:
00007fb8e37bb13f <.text>:
7fb8e37bb13f: 55 push %rbp
7fb8e37bb140: 48 8b ec mov %rsp,%rbp
7fb8e37bb143: 48 83 ec 20 sub $0x20,%rsp
7fb8e37bb147: 4c 89 34 24 mov %r14,(%rsp)
7fb8e37bb14b: 4c 89 7c 24 08 mov %r15,0x8(%rsp)
7fb8e37bb150: 4c 8b f7 mov %rdi,%r14
7fb8e37bb153: 48 89 75 f8 mov %rsi,-0x8(%rbp)
7fb8e37bb157: 45 33 ff xor %r15d,%r15d
7fb8e37bb15a: 4d 85 f6 test %r14,%r14
7fb8e37bb15d: 0f 84 13 00 00 00 je 0x7fb8e37bb176
7fb8e37bb163: 4d 8b fe mov %r14,%r15
7fb8e37bb166: 49 8b c7 mov %r15,%rax
7fb8e37bb169: b9 01 00 00 00 mov $0x1,%ecx
7fb8e37bb16e: 48 03 c1 add %rcx,%rax
7fb8e37bb171: e9 06 00 00 00 jmpq 0x7fb8e37bb17c
7fb8e37bb176: 4c 8b 7d f8 mov -0x8(%rbp),%r15
7fb8e37bb17a: eb ea jmp 0x7fb8e37bb166
7fb8e37bb17c: 4c 8b 34 24 mov (%rsp),%r14
7fb8e37bb180: 4c 8b 7c 24 08 mov 0x8(%rsp),%r15
7fb8e37bb185: 48 8b e5 mov %rbp,%rsp
7fb8e37bb188: 5d pop %rbp
7fb8e37bb189: c3 retq
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment