summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2014-02-14 01:45:20 +0100
committerOlivier Gayot <duskcoder@gmail.com>2014-02-14 01:47:26 +0100
commit7ce8ef940c69188e09e75c317270733611e51eaa (patch)
tree05c7cae72ef0f755a8afe8ffe8507cb918292e63
parentf891716549d3ba7985f8afb424efab4eee234130 (diff)
use local labels wherever possible
this avoids the need of prefixing the redundant label names (e.g. end, loop) by the name of the function. The latter version is shorter to type and hides local labels when the object file is desassembled. Thus, instead of having function_name: jmp function_name_end function_name_end: we have this function_name: jmp .end .end:
-rw-r--r--list.asm28
1 files changed, 14 insertions, 14 deletions
diff --git a/list.asm b/list.asm
index 4ed81e4..ae3951c 100644
--- a/list.asm
+++ b/list.asm
@@ -60,12 +60,12 @@ list_new: ;; {{{
call list_new_raw
test rax, rax
- je list_new_end
+ je .end
mov rdi, rax
call list_init
- list_new_end:
+ .end:
ret
;; }}}
@@ -91,11 +91,11 @@ list_append: ;; {{{
call malloc
test rax, rax
- jne list_append_malloc_succeed
+ jne .malloc_succeed
mov rax, -1
- jmp list_append_end
+ jmp .end
- list_append_malloc_succeed:
+ .malloc_succeed:
; set the new element
mov rsi, QWORD [rsp + 8]
mov QWORD [rax], 0
@@ -104,14 +104,14 @@ list_append: ;; {{{
mov rdi, [rsp]
mov ecx, [rdi + 8]
- list_append_loop:
+ .loop:
test ecx, ecx
- je list_append_set_elem
+ je .set_elem
dec ecx
mov rdi, QWORD [rdi]
- jmp list_append_loop
+ jmp .loop
- list_append_set_elem:
+ .set_elem:
; set the next element
mov [rdi], rax
@@ -121,7 +121,7 @@ list_append: ;; {{{
xor rax, rax
- list_append_end:
+ .end:
leave
ret
@@ -134,9 +134,9 @@ list_apply: ;; {{{
mov ecx, DWORD [rdi + 8]
- list_apply_loop:
+ .loop:
test ecx, ecx
- je list_apply_end
+ je .end
dec ecx
; elem = list->first or elem = elem->next
mov rdi, QWORD [rdi]
@@ -152,9 +152,9 @@ list_apply: ;; {{{
mov ecx, DWORD [rsp + 8]
mov rdi, QWORD [rsp + 0xc]
- jmp list_apply_loop
+ jmp .loop
- list_apply_end:
+ .end:
leave
ret