News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Blocks and Bricks: A light OOP System

Started by HSE, November 10, 2023, 01:09:25 AM

Previous topic - Next topic

HSE

Quote from: TimoVJL on December 26, 2023, 09:45:17 AMGlobal OOP optimizer could remove useless code and zero unused methods.

Fantastic  :thumbsup:

How you do that in assembly?

Equations in Assembly: SmplMath

TimoVJL

Only those people, who develops assemblers, compilers and linkers knows that.
Linker have to be OOP aware.
Have been known for long time, those who had read Dr Dobbs long time ago, knows that.
May the source be with you

HSE

Equations in Assembly: SmplMath

jj2007

Quote from: HSE on December 26, 2023, 10:21:21 AMcould remove useless code and zero unused methods.

Unused methods should not generate code in Assembly. If they do, something is wrong with your system.

HSE

Equations in Assembly: SmplMath

daydreamer

Quote from: jj2007 on December 26, 2023, 11:31:48 AM
Quote from: HSE on December 26, 2023, 10:21:21 AMcould remove useless code and zero unused methods.

Unused methods should not generate code in Assembly. If they do, something is wrong with your system.
Isn't it heresy in asm with a system that creates bloat?
There was lightweight oop many years ago I tried
Quote from: TimoVJL on December 26, 2023, 10:30:20 AMOnly those people, who develops assemblers, compilers and linkers knows that.
Linker have to be OOP aware.
Have been known for long time, those who had read Dr Dobbs long time ago, knows that.
Show link if you have it
I only managed to try simplest conditional assembly in source file
I think it was a SSE source code for a math functions, to turn off assembling for unused proc


my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

jj2007

Quote from: HSE on December 26, 2023, 12:07:15 PM
Quote from: jj2007 on December 26, 2023, 11:31:48 AM
Quote from: HSE on December 26, 2023, 10:21:21 AMcould remove useless code and zero unused methods.

I don't say that.

Correct, it was Timo. I had selected these words to use the SMF feature Quote selected text, but apparently SMF can't trace back the quote to its real owner. My apologies :cool:

Quote
Quote from: jj2007 on December 26, 2023, 11:31:48 AMUnused methods should not generate code in Assembly.

Why not?

A OOP "method" is nothing else than an entry in a structure. You may or may not use it, but the mere existence of the entry does not create code.

Rockphorr

#22
Quote from: HSE on December 26, 2023, 08:57:16 AM
Quote from: Rockphorr on December 26, 2023, 08:23:31 AMHow do you implement the heap of objects ?? Is it a list or a tree or a array or something else ?

Can be implemented how you want.



It is interesting for me how it should be implemended.

Something i found here:

https://www.youtube.com/watch?v=Bym7UMqpVEY&list=PL3BR09unfgciJ1_K_E914nohpiOiHnpsK

(russian)

HSE

Quote from: jj2007 on December 26, 2023, 07:19:11 PMapparently SMF can't trace back the quote to its real owner

That was strange  :thumbsup:

Quote from: jj2007 on December 26, 2023, 07:19:11 PM, but the mere existence of the entry does not create code.

So far I understand, the linker don't know if a procedure is used or not, only know if there is a reference to the procedure address. In standard OOP there are references to all methods, then linker include all of them.
Equations in Assembly: SmplMath

TimoVJL

May the source be with you

jj2007


HSE

Quote from: Rockphorr on December 26, 2023, 09:45:47 PMIt is interesting for me how it should be implemended.

There is no unique solution, it depend on Object cycle of live and processes, etc.

Also personal preferences play a role. Biterider use collections a lot. I use perhaps more SDLL.


Quote from: Rockphorr on December 26, 2023, 09:45:47 PMhttps://www.youtube.com/watch?v=Bym7UMqpVEY&list=PL3BR09unfgciJ1_K_E914nohpiOiHnpsK

:thumbsup: Probably interesting in more advanced lessons, but hard to understand  :biggrin:
Equations in Assembly: SmplMath

Biterider

Hi
In the OOP world, there are basically two ways of dealing with methods (also known as procedures). If they are resolved via stored addresses, usually in virtual tables, the linker has no chance of removing code, as the execution path is determined at runtime. 
Static methods, on the other hand, behave like regular procedures. In this case, if e.g. a C compiler is instructed to perform "function-level linking" (/Gy switch - MS), each procedure is stored in its own COMDAT. In this way, the linker is able to remove the dead code.
Unfortunately, to my knowledge, none of the current assemblers are able to do this yet. The only alternative currently known to me would be to compile the individual static methods into a library, so that the linker can take over this task.

Regards, Biterider

TimoVJL

QuoteMicrosoft (R) Macro Assembler Version 12.00.40629.0

/Gy[-] separate functions for linker
May the source be with you

Biterider

Thanks Timo
Good to know. Then that is the way to go.

Biterider