flat assembler
Message board for the users of flat assembler.

flat assembler > Compiler Internals > fasm core additive suggestions

Author
Thread Post new topic Reply to topic
ProMiNick



Joined: 24 Mar 2012
Posts: 354
Location: Russian Federation, Sochi
patch places:
1) tables.inc:
Code:
instructions:
 dw instructions_1-instructions,(instructions_2-instructions_1)/(1+3) ;+
 dw instructions_2-instructions,(instructions_3-instructions_2)/(2+3)
 dw instructions_3-instructions,(instructions_4-instructions_3)/(3+3)
 dw instructions_4-instructions,(instructions_5-instructions_4)/(4+3)
 dw instructions_5-instructions,(instructions_6-instructions_5)/(5+3)
 dw instructions_6-instructions,(instructions_7-instructions_6)/(6+3)
 dw instructions_7-instructions,(instructions_8-instructions_7)/(7+3)
 dw instructions_8-instructions,(instructions_9-instructions_8)/(8+3)
 dw instructions_9-instructions,(instructions_10-instructions_9)/(9+3)
 dw instructions_10-instructions,(instructions_11-instructions_10)/(10+3)
 dw instructions_11-instructions,(instructions_12-instructions_11)/(11+3)
 dw instructions_12-instructions,(instructions_13-instructions_12)/(12+3)
 dw instructions_13-instructions,(instructions_14-instructions_13)/(13+3)
 dw instructions_14-instructions,(instructions_15-instructions_14)/(14+3)
 dw instructions_15-instructions,(instructions_16-instructions_15)/(15+3)
 dw instructions_16-instructions,(instructions_end-instructions_16)/(16+3)
 .end_header: ;+

instructions_1: ;+
instructions_2:    

2) parser.inc:
Code:
get_instruction:
        push    esi
        mov     ebp,ecx
        call    lower_case
        mov     ecx,ebp
        cmp     cl,(instructions.end_header-instructions)/4 ; that is more flexible than direct integer value
        ja      no_instruction
        ; comparison with substruction 2 from cl is removed at all
        movzx   ebx,word [instructions+ecx*4-4] ; corrected to new ecx
        add     ebx,instructions
        movzx   edx,word [instructions+ecx*4-2] ; corrected to new ecx
      scan_instructions:
        or      edx,edx
        jz      no_instruction    

Effect:
negative: instructions table grows up for 1 element = 4 bytes
for rare errorneus case of 1 symbol instruction processing will be 3 instruction longer

positive: parser code will be more flexible and more adaptive (one less patch will be required for fasmarm addon)
for all normal instruction length cases processing will be 2 instruction faster.

In fasmarm:
Code:
ARM_find_instruction:
        push    esi
        mov     ebp,ecx
        mov     byte[characters+CONDITION_SEARCH_CHARACTER],CONDITION_SEARCH_CHARACTER
        call    lower_case
        mov     byte[characters+CONDITION_SEARCH_CHARACTER],0
        mov     ecx,ebp
        cmp     cl,(instructions.end_header-instructions)/4
        ja      .no_instruction
        sub     cl,1
        jc      .no_instruction ; this never happen cl is always nonzero - sholud be removed from code
; because get_instruction call (ARM_get_instruction & ARM_find_instruction calls as its patch respectively) gets cl value from [esp] - size of token and there is no way to create nullsize token    


by analogy change symbols data_directives etc. - it takes 2 instruction faster per almost each token operated in parser state (fasm too fast, I even couldn`t test speed effect)


To be continued...

_________________
I don`t like to refer by "you" to one person.
My soul requires acronim "thou" instead.
Post 19 Dec 2018, 09:15
View user's profile Send private message Send e-mail Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 354
Location: Russian Federation, Sochi
little offtopic:
add this https://board.flatassembler.net/topic.php?p=50067 from far 2007 to modern fasm & fasmarm
https://yadi.sk/d/ZctCe5onzFz6mQ - if you not interested in launchig fasmg from them - you could unarchive only exe you needed.
sorry, as prey used not original fasm IDEs (but ones I adapted for launch fasmg from them)
sources are dosn`t matter. You could reproduce them

use if you like it

strong side of such solutions is dramaticaly weak side too:
highlighting uses fasm internal parser tables

but in case fasmg - we have flexible syntaxies. And logicaly wished that highlighting will be more customizable. Highlighting syntax of both flagman atchiyectures - nice but absolutely not enought.


Description: fasmwarm screenshot
Filesize: 233.16 KB
Viewed: 783 Time(s)

FASMARMADD.jpg


Description: fasmw screenshot
Filesize: 237.61 KB
Viewed: 783 Time(s)

FASMADD.jpg



_________________
I don`t like to refer by "you" to one person.
My soul requires acronim "thou" instead.
Post 20 Dec 2018, 12:36
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-2019, Tomasz Grysztar.

Powered by rwasa.