flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > EXPRPARS.INC/optimization

Author
Thread Post new topic Reply to topic
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 01 Nov 2011, 09:49

I don't change anything to the behavior of Fasm,
I just removed unnecessary code.
Results in memory are exactly the same as the original code (syser debugger)
Fasm works perfectly with this change.
Code:
fp_get:             lods    byte[esi]
           .....
;              call    fp_optimize             ;[-] useless (only to do "mov "dword[edi+8],8000h)
                mov     dword[edi+8],8000h      ;[+]
                mov     [fp_format],0
fp_before_dot:     lods    byte[esi]
           .....
;              mov     [edi+7],al              ;[-]
;               mov     dl,7                    ;[-]
;               mov     dword [edi+8],edx       ;[-]
                call    fp_optimize
         .....

;-----------------------------------------------------

;fp_optimize:    mov     eax,[edi]               ;[-] "OLD" fp_optimize
;           mov     ebp,[edi+4]
;                or      ebp,[edi]
;          or      ebp,[edi+12]
;               jz      fp_zero
;.loop:          test    byte [edi+7],80h
;           jnz     .done
;              shld    [edi+4],eax,1
;              mov     ebp,[edi+12]
;               shld    eax,ebp,1
;          mov     [edi],eax
;          shl     dword [edi+12],1
;           dec     dword [edi+8]
;              jmp     .loop
;.done:            ret
;fp_zero:    mov     dword [edi+8],8000h
;                ret

fp_optimize:     or      al,al                   ;[+] "NEW" fp_optimize
            jz      fp_zero
             mov     [edi+7],al
          mov     dword[edi+8],7
.loop:            dec     dword[edi+8]
                shl     dword[edi+4],1
              jns     .loop
               ret
fp_zero:     mov     dword[edi+8],8000h
          ret
    


_________________
I am not young enough to know everything (Oscar Wilde)- Image


Last edited by ouadji on 02 Nov 2011, 01:46; edited 2 times in total
Post 01 Nov 2011, 09:49
View user's profile Send private message Send e-mail Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 02 Nov 2011, 01:40

Make fasm more compact, faster, optimize the code,
remove unnecessary instructions ...
all this does not interest you Tomasz ?
Don't you want any more to evolve/change the code of your compiler ?
or maybe do you prefer to have no changes from "outside" ?
What is the reason for your silence when someone suggests a code change?

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 02 Nov 2011, 01:40
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20430
Location: In your JS exploiting you and your system
revolution 02 Nov 2011, 01:45
Have patience young padawan. It hasn't even been one day yet.
Post 02 Nov 2011, 01:45
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 02 Nov 2011, 01:55

"padawan", yes Very Happy

but "jong" ... Crying or Very sad

(ok, sorry, you are right)

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 02 Nov 2011, 01:55
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.