flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > Some cleanup sugestions on Fasm code |
Author |
|
vid 01 Aug 2005, 07:16
don't forget that this (uncommented) code shuld be as explainative as possible, and "lods" clearly means skipping character, unlike "inc".
|
|||
01 Aug 2005, 07:16 |
|
MCD 01 Aug 2005, 13:39
Well, actually I have discovered hundreds of such repeating paterns in Fasm code, but there isn't enough space to descibe them all here. But imagine what happens when you upgrade to a new version of Fasm but with all those code fixes you nade are lost? So better don't do such changes until you told Tomasz
|
|||
01 Aug 2005, 13:39 |
|
El Tangas 01 Aug 2005, 16:29
I did change my fasm copy, just for testing, but this are just sugestions, I don't really mind if they are not implemented. This is just the way I would code if I was the author of Fasm. It's just that lods takes 5 cycles in 386 and uses memory bandwidth, while inc takes 2 cycles.
|
|||
01 Aug 2005, 16:29 |
|
Tomasz Grysztar 01 Aug 2005, 16:51
Well, actually I feel ashamed I have left so many of such relicts - they are direct result of re-editing the same code pieces hundreds of times. From time to time, when I review some larger parts of code, I fix all such things - for example I have removed a lot of more or less similar ones from the X86.INC when I was upgrading it to X86_64.INC, I did review almost all the code there that time; but the PARSER.INC and EXPRESSI.INC were not generally revised for a very long time - perhaps that's why you've found such things there in the first place.
|
|||
01 Aug 2005, 16:51 |
|
El Tangas 01 Aug 2005, 19:48
Nothing to be ashamed of
Fasm is a great piece of code, but its complexity is increasing, and this kind of leftovers will tend to accumulate... Well, I do have a few more things to report (expressi.inc): Code: dec esi mov al,[esi+1] to mov al,[esi] dec esi motive: saves one byte... Code: shld edx,eax,1 shl eax,1 and shl eax,1 rcl edx,1 to add eax,eax adc edx,edx In general: shl reg,1 -> add reg,reg rcl reg,1 -> adc reg,reg motive: faster. And finally, in preproce.inc: Code: convert_line_data: cmp edi,[memory_end] jae out_of_memory lods byte [esi] cmp al,20h je convert_line_data cmp al,9 je convert_line_data -> dec esi -> lods byte [esi] mov ah,al the marked lines are not needed. |
|||
01 Aug 2005, 19:48 |
|
Tomasz Grysztar 01 Aug 2005, 19:55
Thanks!
|
|||
01 Aug 2005, 19:55 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.