flat assembler
Message board for the users of flat assembler.

Index > Programming Language Design > On my new assembler

Goto page Previous  1, 2, 3 ... 9, 10, 11
Author
Thread Post new topic Reply to topic
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7932
Location: Kraków, Poland
Tomasz Grysztar
Turns out that Linux version was missing alignment for the data segment and the addresses of all the variables were moving in and out of alignment depending on the exact size of the preceding code/text segments. MATCH is probably vulnerable because it uses many variables that should be aligned.

Please try it out with the alignment added in i0jhl.
Post 10 Dec 2017, 14:52
View user's profile Send private message Visit poster's website Reply with quote
jacobly



Joined: 04 Feb 2016
Posts: 42
jacobly
I'm now seeing the same 0.1 second speedups in i0jhl that I saw in i0j8x.
Edit: Also all the tests are the same speed or faster than hykpg.
Post 10 Dec 2017, 20:08
View user's profile Send private message Reply with quote
jacobly



Joined: 04 Feb 2016
Posts: 42
jacobly
In commit 24c8171d7f the variable clearing at the top of assembly_init was optimized, but unfortunately, it now also clears the trace_mode variable that is stored to immediately before. Additionally, at least on linux and libc, the variables in fasmg.asm are out of alignment again.
Post 02 Sep 2020, 04:59
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7932
Location: Kraków, Poland
Tomasz Grysztar
jacobly wrote:
Additionally, at least on linux and libc, the variables in fasmg.asm are out of alignment again.
The libc version has always been missing alignment (I added it now), however the final result might have been dependent on linker's choices.
Post 02 Sep 2020, 08:10
View user's profile Send private message Visit poster's website Reply with quote
jacobly



Joined: 04 Feb 2016
Posts: 42
jacobly
If I have code like this:
Code:
path = '/does/not/exist'
include path    

Which outputs an error like this:
Code:
flat assembler  version g.j1gh
source_file_not_found.asm [2]:
        include path
Processed: include path
Error: source file not found.    

It would be helpful if the error message contained the non-existing path, which would normally be a literal in the processed line, but if a variable is used it is hard to tell what file wasn't found.
Post 21 Sep 2020, 13:13
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7932
Location: Kraków, Poland
Tomasz Grysztar
jacobly wrote:
It would be helpful if the error message contained the non-existing path, which would normally be a literal in the processed line, but if a variable is used it is hard to tell what file wasn't found.
I tried adding this in the latest release. It is not perfect, it actually shows just the last of the paths that were tried. It should still be helpful, though.
Post 22 Sep 2020, 17:13
View user's profile Send private message Visit poster's website Reply with quote
jacobly



Joined: 04 Feb 2016
Posts: 42
jacobly
Tomasz Grysztar wrote:
I tried adding this in the latest release. It is not perfect, it actually shows just the last of the paths that were tried. It should still be helpful, though.
Yep that was plenty, the important part is the part of the path passed to include.

This creates a file with a funny name:
Code:
virtual as ''
end virtual    
I don't actually need to do this, but I happened to notice it in the middle of trying to use '' as a sentinel to mean don't output a separate file.

Is there a way to parse a conditional expression stored in a variable from calm since check only supports normal expressions inside variables? I can't just assemble an if since I'm trying to jump based on the result.
Post 02 May 2021, 09:08
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7932
Location: Kraków, Poland
Tomasz Grysztar
jacobly wrote:
This creates a file with a funny name: (...)
Thanks for the report, the fix is up.

jacobly wrote:
Is there a way to parse a conditional expression stored in a variable from calm since check only supports normal expressions inside variables? I can't just assemble an if since I'm trying to jump based on the result.
I'm afraid not, there is no code path that could allow this, CHECK expects all condition logic to be pre-parsed.

However, as long as your CALM code executes during an active assembly (that is: not unconditionally inside a definition of a macro, or a skipped block) you can execute several lines to process a complete IF block and then CHECK the value set up by that block to jump accordingly.

It is also possible to add a specialized CALM instruction that could do that for you - but I'm not sure if it would be worth to have in general.
Nonetheless, the implementation could be quite simple, something like:
Code:
calm_determine:
        lodsd
        mov     ebx,eax
        call    get_available_value
        jc      calm_undefined_symbol
        mov     al,[edx+ValueDefinition.type]
        cmp     al,VALTYPE_SYMBOLIC
        jne     calm_invalid_value
        push    esi
        call    clear_line_embeddings
        mov     esi,[edx+ValueDefinition.value]
        mov     [line_start],esi
        mov     ecx,[edx+ValueDefinition.value_length]
        add     ecx,esi
        mov     [line_end],ecx
        call    get_condition_value
        mov     [calm_result],al
        pop     esi
        jmp     calm_execution_unit    
with additional snippets to plug it into the CALM engine:
Code:
alm_determine:
        mov     [value],calm_determine
        jmp     assemble_alm_operation_on_variable    
Code:
--- source/tables.inc
+++ source/tables.inc
@@ -593,10 +593,13 @@
   db 7,'compute',SYMCLASS_INSTRUCTION,VALTYPE_NATIVE_COMMAND,VAL_INTERNAL,0
   dd alm_compute

   db 5,'check',SYMCLASS_INSTRUCTION,VALTYPE_NATIVE_COMMAND,VAL_INTERNAL,0
   dd alm_check
+
+  db 9,'determine',SYMCLASS_INSTRUCTION,VALTYPE_NATIVE_COMMAND,VAL_INTERNAL,0
+  dd alm_determine

   db 4,'jyes',SYMCLASS_INSTRUCTION,VALTYPE_NATIVE_COMMAND,VAL_INTERNAL,0
   dd alm_jyes

   db 3,'jno',SYMCLASS_INSTRUCTION,VALTYPE_NATIVE_COMMAND,VAL_INTERNAL,0    
Post 02 May 2021, 10:02
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3 ... 9, 10, 11

< 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.