News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

HJWasm 2.24 release

Started by johnsa, April 04, 2017, 06:47:57 PM

Previous topic - Next topic

johnsa

I've put 2.24 up.

The fixes are:
stackbase:rsp overwriting locals in some cases. (powershadow's bug #1).
stackbase:rbp enforce stack allocations so setting bit 2 of win64 isn't required to get alignment working (aw27's bug).
invoke string literals no longer include the quotes " "s (powershadows bug #2).

stackbase:rsp with win64:15 supports LOCAL alignment to 32 now (if you want to use aligned YMMWORDS or great).
Any structure or union .. in fact any local that is >= 16 bytes in size will be aligned to 16 under both rsp and rbp.

SYSTEM V ABI calls are in now too (this is early days experimental, and too serve as a test-case for adding delphi calls next). It also helps move towards the goal of full OSX and Linux support, now that we have an OSX build of HJWASM too.
To use win64 flags still apply (will be aliased in future), stackbase:rbp must be used and then a proc is simply decorated with:



OPTION ARCH:SSE
nixproc PROC SYSTEMV USES rbx xmm0 arg1:qword, arg2:DWORD, arg3:REAL4
LOCAL mem:DWORD
LOCAL vec:XMMWORD
mov rbx,arg1
mov ecx,arg2
mov eax,10
mov mem,eax
mov ecx,mem
IF @Arch EQ 0
movss xmm10,arg3
movaps xmm0,vec
ELSE
vmovss xmm10,arg3
vmovaps xmm0,vec
ENDIF
ret
nixproc ENDP
OPTION ARCH:AVX



aw27

I don't think this bug has been fixed yet.
Bug

johnsa

Quote from: aw27 on April 04, 2017, 08:45:49 PM
I don't think this bug has been fixed yet.
Bug

Did you try with WIN64:15 ?

powershadow

Link to hjwasm224_x86.zip on terraspace leads to old version  2.23.
Anyway,i just want to try new feature: "Added support for allocating wide strings in data with dw."

Simple code:
.data
buff01 db '12345678',0,0
buff02 dw '1','2','3','4','5','6','7','8',0,0
buff03 dw '12345678',0,0


I think 'buff02' is old ugly style of writing wide chars and 'buff03' is new friendly style. But as I figure out, 'buff02' not equal to 'buff03'.

Result:

mov eax,LENGTHOF buff01 ; mov          eax,00000000A
mov eax,LENGTHOF buff02 ; mov          eax,00000000A
mov eax,LENGTHOF buff03 ; mov          eax,3

mov eax,sizeof buff01 ; mov          eax,00000000A
mov eax,sizeof buff02 ; mov          eax,000000014
mov eax,sizeof buff03 ; mov          eax,6

mov eax,type buff01 ; mov          eax,1
mov eax,type buff02 ; mov          eax,2
mov eax,type buff03 ; mov          eax,2


Only 'type' works. ::)

aw27

Quote from: johnsa on April 04, 2017, 09:09:18 PM
Quote from: aw27 on April 04, 2017, 08:45:49 PM
I don't think this bug has been fixed yet.
Bug

Did you try with WIN64:15 ?
WIN64:15, now add uses xmm6 and retry:

proc1 proc public FRAME uses xmm6 _rcx : qword, _rdx: qword, _r8: qword, _r9 : qword, other: qword
   LOCAL lvar1 : ptr
   LOCAL lvar2 : XMMWORD
   mov eax, 2.0
   movd xmm0, eax
   shufps xmm0, xmm0,0
   movaps XMMWORD ptr lvar2, xmm0
   
   ret
proc1 endp


Adamanteus

#5
And more tips that not works :

.686   
.model flat,stdcall


TEST_evaluate  macro REG
; if TYPE (&REG) and 00000001b
if OPATTR (&REG) and 00000001b
mov ecx, REG
else
movzx ecx, REG
endif
ENDM

.data
len dw 1

    .code

start:
TEST_evaluate len
RET
end start


johnsa

Quote from: powershadow on April 04, 2017, 10:06:15 PM
Link to hjwasm224_x86.zip on terraspace leads to old version  2.23.
Anyway,i just want to try new feature: "Added support for allocating wide strings in data with dw."

Simple code:
.data
buff01 db '12345678',0,0
buff02 dw '1','2','3','4','5','6','7','8',0,0
buff03 dw '12345678',0,0


I think 'buff02' is old ugly style of writing wide chars and 'buff03' is new friendly style. But as I figure out, 'buff02' not equal to 'buff03'.

Result:

mov eax,LENGTHOF buff01 ; mov          eax,00000000A
mov eax,LENGTHOF buff02 ; mov          eax,00000000A
mov eax,LENGTHOF buff03 ; mov          eax,3

mov eax,sizeof buff01 ; mov          eax,00000000A
mov eax,sizeof buff02 ; mov          eax,000000014
mov eax,sizeof buff03 ; mov          eax,6

mov eax,type buff01 ; mov          eax,1
mov eax,type buff02 ; mov          eax,2
mov eax,type buff03 ; mov          eax,2


Only 'type' works. ::)

2.24 packages updated on the site, (link to 2.24 corrected as well), the sizeof, lengthof operators should be right now.

johnsa

Quote from: Adamanteus on April 04, 2017, 10:45:53 PM
And more tips that not works :

.686   
.model flat,stdcall


TEST_evaluate  macro REG
; if TYPE (&REG) and 00000001b
if OPATTR (&REG) and 00000001b
mov ecx, REG
else
movzx ecx, REG
endif
ENDM

.data
len dw 1

    .code

start:
TEST_evaluate len
RET
end start


macro.h

line 62 :

extern ret_code StoreAutoMacro(struct dsym *macro, int i, struct asm_tok tokenarray[], bool store_data, char *macCode[], int macLine, int macLen);  /* store macro content 1st pass (builtin macros) */

data.c

line 1413 :

      if (!foundSubType)
      {
         EmitErr(INVALID_DATA_INITIALIZER, sym->name);
         return EMPTY;
      }

macro.c

line 155 :

            *start = PLACEHOLDER_CHAR;
         start++;
         
line 397, 512, 725, 840 :
         
         "mnames[mindex].label" replace on : mnames[mindex].label ? mnames[mindex].label : "NULL"));


parser.c

line 55 :

#include "lqueue.h"


simsegm.c

line 23 :

#include "equate.h"

This seems to work as expected and generates an asm error? Same outcome with original JWasm, what am I looking for here ? :)

Adamanteus

It's expression in macro TEST_evaluate - that generating error, when argument (len) is not code label !

johnsa

Try this:



if (OPATTR (&REG)) and 00000001b



The expression evaluator seems to need that to force evaluation of opattr first.

This seems to have carried over from jwasm originally as it responds the same.

Adamanteus

Yes, this way everything works - I even found this trick when begun add it to old code. But that I suppose stayed from JWasm, and that is to masm not need, so ...

powershadow

Quote
2.24 packages updated on the site, (link to 2.24 corrected as well), the sizeof, lengthof operators should be right now.

:t . But,  i can't find updated version on Github.

johnsa

It's in the 2.24 branch if you really want it from there, I haven't committed it to master yet as I'm still fixing the USES bug that AW27 mentioned, once I'm happy with that I'll update through to master and the packages again.

jj2007

#13
2.24 (latest version of 20:45 & 20:47) works fine with my big sources :t

johnsa

Hi,

Right the packages have been updated again on git/master and on the site.
Still 2.24 but it should address AW27's USES issue now.

Let me know how that works out for you! :)

Cheers
John