Author Topic: SmplMath: A little problem using local stack space  (Read 277 times)

HSE

  • Member
  • *****
  • Posts: 1410
  • <AMD>< 7-32>
SmplMath: A little problem using local stack space
« on: October 03, 2020, 04:42:12 AM »
Hi all!

Developing a program with a lot SmplMath macros show warnings demanding to increase local stack allocation (more and more!).

Apparently qWord forgot to put a line in fSlvTLS()  macro :
Code: [Select]
fSlvTLS macro name:=<fslv_tls>,cb:=<4*@WordSize>
IFB FSBE_ENTITY
EXITM <&name&[1]:BYTE>
ELSEIF fslv_glb_error
EXITM <&name&[1]:BYTE>
ENDIF
% IFDEF fslv_tls_name
.err <TLS duplication>
ELSE
fslv_tls_curr_used = 0 ; <---------------  this line is missing ¿?
fslv_tls_alloc_line = @Line
fslv_tls_cb = FSBE_FNC(%FSBE_ENTITY,%FSEN_TLS_SIZE)
IF fslv_tls_cb NE 0 AND fslv_tls_cb GT cb
fslv_tls_cb = (fslv_tls_cb+15) AND (-16)
ELSE
fslv_tls_cb = (cb+15) AND (-16)
ENDIF
fslv_tls_name TEXTEQU @TrimStr(<&name>)
EXITM @CatStr(<&name&[fslv_tls_cb]:BYTE>)
ENDIF
endm

Regards. HSE

qWord

  • Member
  • *****
  • Posts: 1476
  • The base type of a type is the type itself
    • SmplMath macros
Re: SmplMath: A little problem using local stack space
« Reply #1 on: October 03, 2020, 08:01:08 AM »
Hello HSE and all members old enough to remember me,

I cannot help you with that problem, but looks you have already found a solution. Nearly three years passed since I serious programmed with MASM, so I'm a bit rusty. In addition, currently I have little interest in this kind of programming, so I will not continue the development of the SmplMath macros. The same applies to the "real_math" macros, even if I have recently used them to quickly calculate some big constants. After all these years, the code of the SmplMath macros looks ugly to me, not just under the hood, but also in the public interface. I can't think what came over me choosing names like "fSlv" for macros that actual evaluate some expression ... or OMG "fSlvTLS" (local variables == Thread Local Storage? WTF  :dazzled: ).

Anyway, I was always impressed how stable the SmplMath macros work and it is nice to see that there are still some users!

To cut a long story short: You can take over the development if you are interested in it - I would supply you what I have on my disk. I make you the same offer for the "real_math" macros (which are well written IMO).

Kind regards to all

qWord

PS: Please do not be upset if it takes some days to reply you (hopefully not weeks)
MREAL macros - when you need floating point arithmetic while assembling!

felipe

  • Member
  • *****
  • Posts: 1336
  • Eagles are just great!
Re: SmplMath: A little problem using local stack space
« Reply #2 on: October 03, 2020, 09:00:51 AM »
it's always good to know of an old member of this forum, greeting words!  :thup:
Felipe.

HSE

  • Member
  • *****
  • Posts: 1410
  • <AMD>< 7-32>
Re: SmplMath: A little problem using local stack space
« Reply #3 on: October 03, 2020, 09:47:59 AM »
Hello HSE and all members old enough to remember me,

Hi qWord!!

Good to know you are well  :thumbsup:

After all these years, the code of the SmplMath macros looks ugly to me, not just under the hood, but also in the public interface. I can't think what came over me choosing names like "fSlv" for macros that actual evaluate some expression ... or OMG "fSlvTLS" (local variables == Thread Local Storage? WTF  :dazzled: ).

 :biggrin: :biggrin: :biggrin: Don't worry about names, that is easy to change.

Anyway, I was always impressed how stable the SmplMath macros work and it is nice to see that there are still some users!

Still is making simple some laborius calculations (and forever will be a very interesting challenge to understand that macros  :biggrin:)

To cut a long story short: You can take over the development if you are interested in it - I would supply you what I have on my disk. I make you the same offer for the "real_math" macros (which are well written IMO).

 :thumbsup: Thanks for the offer. At present is working very well, from time to time grow some idea that is possible to solve with a wrapper or something like that. (like fSlvW variable++    :biggrin:)
Because I don't need velocity nor big data, I'm still making seriuos things in 32 bit. Now, I know that building in 64 bit I will have some little problem with fSlv = (something). If you remember why that difference, that could be interesting.

Regards. HSE

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7642
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: SmplMath: A little problem using local stack space
« Reply #4 on: October 03, 2020, 11:20:54 PM »
Good to hear from you, I thought you must have been ambushed by a blonde when you disappeared. Hope you are doing things you enjoy and getting paid for it. Sad to say I never got around to using your maths macros as I confess I am a maths illiterate, mainly count with my fingers and use computers to do the rest.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

qWord

  • Member
  • *****
  • Posts: 1476
  • The base type of a type is the type itself
    • SmplMath macros
Re: SmplMath: A little problem using local stack space
« Reply #5 on: October 05, 2020, 02:37:14 AM »
Good to hear from you, I thought you must have been ambushed by a blonde when you disappeared.
:biggrin:
Good to see that you are still managing the community and keeping up the MASM SDK.

Hope you are doing things you enjoy and getting paid for it.
Yes, of course! A mixed bag from embedded development up to cloud solutions, whatever the customer needs  :smiley:
MREAL macros - when you need floating point arithmetic while assembling!

qWord

  • Member
  • *****
  • Posts: 1476
  • The base type of a type is the type itself
    • SmplMath macros
Re: SmplMath: A little problem using local stack space
« Reply #6 on: October 05, 2020, 02:45:31 AM »
Now, I know that building in 64 bit I will have some little problem with fSlv = (something). If you remember why that difference, that could be interesting.
Sorry, I cannot help you with that, but I am sure will get it, even knowing ml64 is (or was?) limited in it capacities.

I have put my two projects on github, so it should be clear that everyone is free to continue the work or use it as base for something new. The repos are read-only to indicate that there will be probably no more development from my side.

https://github.com/qwordAtGitHub/mreal-macros

https://github.com/qwordAtGitHub/SmplMath

Kind regards to all - MASM forever!

qWord
MREAL macros - when you need floating point arithmetic while assembling!

HSE

  • Member
  • *****
  • Posts: 1410
  • <AMD>< 7-32>
Re: SmplMath: A little problem using local stack space
« Reply #7 on: October 05, 2020, 03:25:23 AM »
I have put my two projects on github, so it should be clear that everyone is free to continue the work or use it as base for something new.
:thumbsup: Fantastic. Good idea.