flat assembler
Message board for the users of flat assembler.

Index > Heap > HLLs suck!

Goto page 1, 2, 3, 4, 5, 6, 7, 8  Next
Author
Thread Post new topic Reply to topic
Azu



Joined: 16 Dec 2008
Posts: 1160
Azu
Wtf is this? Found it in d3d9.dll

Code:
add   esp, 0Ch
mov esp, ebp    



Evil or Very Mad

_________________
Post 27 Nov 2009, 18:03
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2466
Location: Bucharest, Romania
Borsuc
You think that sucks? Laughing

Look at .NET, Java and other languages who don't even run natively, who are bloated beyond reason. If you gotta fight for optimization, fight with the worst offenders first. Wink

I'm sick of seeing 300KB executables for even the simplest programs with a very simple GUI. It's not just the HLL, it's the laziness, using MFC (and embedding the library in the app) and other bloated crap. Seriously, that is what you should be worried about.

_________________
Previously known as The_Grey_Beast
Post 27 Nov 2009, 18:31
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
At what address you have found that instructions sequence?
Post 27 Nov 2009, 18:50
View user's profile Send private message Reply with quote
Fanael



Joined: 03 Jul 2009
Posts: 168
Fanael
Oh, very cool. One useless instruction in whole file. No wonder we're buying faster and faster hardware, but programs are still running at the same speed.
Post 27 Nov 2009, 19:01
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Borsuc: 300kb executables don't really matter that much, though, and hasn't for quite a while. It's taken me several years to accept this, even if I don't particularly like to admit it, and still cringe when I see BCB/Delphi apps with statically linked VCL.

But even on a pmmx-200 with 64 megabytes of ram and a 4GB harddrive, those executables ran fine, and didn't exactly flood your harddrive. The exception is when somebody releases a software suite consisting of 10+ applications, all statically linked against VCL, qt, wxwidgets or whatever - that's borderline insanity, but mostly because of the huge download size.

As for java and dotNET, ho humm. The languages are pretty decent, but the applications do come with quite a bit of size overhead because of the massive runtimes. At least you don't have the opportunity to link those statically Smile. And for business app that spend most of their time waiting for user input or database results, runtime speed definitely isn't an issue - development time and bughunting much more so.

_________________
Image - carpe noctem
Post 27 Nov 2009, 20:02
View user's profile Send private message Visit poster's website Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2466
Location: Bucharest, Romania
Borsuc
Funnily the bloated apps are usually the most unstable from my experience. The optimized small apps are very solid most times, maybe it's because the devs are more focused on it than marketing. Smile

(I mean if they don't do lazy man's job of auto garbage collection, because the bug is still there in the code... even if it is wiped -- it's still there!).

_________________
Previously known as The_Grey_Beast
Post 27 Nov 2009, 20:07
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Don't get me wrong, I prefer apps that have been "cared about" - heck, some of my applications are still writting using WTL or even raw win32 API code. It's such a pain compared to the GUI toolkits, though Smile

As for garbage collection, I'm not entirely against it. I think it's a big problem when a language doesn't have destructor support because of GC, since memory is only a minor part of what can be leaked... in Java you might get the memory from your stream objects etc cleaned when there's no more references to them, but is the file handle closed? I much prefer smartpointers/collections in C++'s, since you (re)gain control of when resources are freed, but you don't have to do it manually. RAII is good Smile
Post 27 Nov 2009, 20:26
View user's profile Send private message Visit poster's website Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 764
Location: Massachusetts, USA
bitshifter
Sometimes they put things like that in code for a hot patch in the future.
Post 27 Nov 2009, 20:50
View user's profile Send private message Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1160
Azu
Fanael wrote:
Oh, very cool. One useless instruction in whole file. No wonder we're buying faster and faster hardware, but programs are still running at the same speed.
Actually, there are a lot more. And in almost every file. It was just an example. Laughing

bitshifter wrote:
Sometimes they put things like that in code for a hot patch in the future.

Then why not NOPs? And wouldn't the hotpatch be at the very beginning or very end? They are trying to balence the stack from a cdecl call.. and then restoring the stack pointer from ebp.. Laughing

_________________
Post 28 Nov 2009, 03:09
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Azu wrote:
bitshifter wrote:
Sometimes they put things like that in code for a hot patch in the future.

Then why not NOPs? And wouldn't the hotpatch be at the very beginning or very end? They are trying to balence the stack from a cdecl call.. and then restoring the stack pointer from ebp.. Laughing
Sub-optimal code? yes. Any real-life relevance? no.

Even with a thousand functions with three exit points per function, how many bytes would this amount to? Smile

_________________
Image - carpe noctem
Post 28 Nov 2009, 03:13
View user's profile Send private message Visit poster's website Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1160
Azu
f0dder wrote:
Azu wrote:
bitshifter wrote:
Sometimes they put things like that in code for a hot patch in the future.

Then why not NOPs? And wouldn't the hotpatch be at the very beginning or very end? They are trying to balence the stack from a cdecl call.. and then restoring the stack pointer from ebp.. Laughing
Sub-optimal code? yes. Any real-life relevance? no.

Even with a thousand functions with three exit points per function, how many bytes would this amount to? Smile
It's the principle of it!
If they make such obvious, easy to avoid failures.. imagine how much they must be screwing up the complicated stuff!

_________________
Post 28 Nov 2009, 03:17
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 693
Location: Adelaide
sinsi
Guess where this code comes from?
Code:
.text:0000000000401000 48 83 EC 08                       sub     rsp, 8
.text:0000000000401004 48 83 EC 20                       sub     rsp, 20h
.text:0000000000401008 48 C7 C1 00 00 00+                mov     rcx, 0          ; lpModuleName
.text:000000000040100F FF 15 7F 30 00 00                 call    cs:GetModuleHandleA
.text:0000000000401015 48 83 C4 20                       add     rsp, 20h
.text:0000000000401019 48 89 05 E0 1F 00+                mov     cs:qword_403000, rax
.text:0000000000401020 48 89 05 F1 0F 00+                mov     cs:qword_402018, rax
.text:0000000000401027 48 83 EC 20                       sub     rsp, 20h
    
Post 28 Nov 2009, 03:23
View user's profile Send private message Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1160
Azu
Obviously the beginning of a DLL (due to GetModuleHandleA, where as EXEs use LoadLibraryA).. most likely one compiled in an HLL (since the code sucks).

_________________
Post 28 Nov 2009, 03:29
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 693
Location: Adelaide
sinsi
C:\fasm\EXAMPLES\WIN64\MANDEL\MANDEL.ASM
Post 28 Nov 2009, 03:35
View user's profile Send private message Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1160
Azu
:\

It's using a bunch of HLL macros. That doesn't count. Just avoid invoke or write your own.

_________________
Post 28 Nov 2009, 03:41
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Azu wrote:
It's using a bunch of HLL macros. That doesn't count. Just avoid invoke or write your own.
Of course it counts, since a lot of people use those macros for convenience Smile

_________________
Image - carpe noctem
Post 28 Nov 2009, 03:47
View user's profile Send private message Visit poster's website Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1160
Azu
f0dder wrote:
Azu wrote:
It's using a bunch of HLL macros. That doesn't count. Just avoid invoke or write your own.
Of course it counts, since a lot of people use those macros for convenience Smile

Crying or Very sad
Image

_________________
Post 28 Nov 2009, 03:53
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
BTW, someone else hit the code Azu posted? I binary searched for "89 EC" but gave nothing interesting, then for "8B E5" and gave lots of "mov esp, ebp". But searching for "0C 8B E5" and "0C 00 00 00 8B E5" gave nothing at all...

WinXP SP3's d3d9.dll version 5.3.2600.5512.
Post 28 Nov 2009, 03:56
View user's profile Send private message Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1160
Azu
LocoDelAssembly wrote:
BTW, someone else hit the code Azu posted? I binary searched for "89 EC" but gave nothing interesting, then for "8B E5" and gave lots of "mov esp, ebp". But searching for "0C 8B E5" and "0C 00 00 00 8B E5" gave nothing at all...

WinXP SP3's d3d9.dll version 5.3.2600.5512.


0x75472262

Code:
loc_75472249:
mov      ecx, [ebp+arg_0]
lea eax, [ebp+var_4]
push        eax
push     0
push       ecx
mov      [ebp+var_4], 0
call  sub_7541DDD1
mov     eax, [ebp+var_4]
add esp, 0Ch
mov esp, ebp
pop ebp
retn     4
Direct3DCreate9 endp    


Version: 6.1.7600.16384
Location: C:\Windows\SysWOW64\d3d9.dll

_________________
Post 28 Nov 2009, 04:00
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2466
Location: Bucharest, Romania
Borsuc
hmm I don't usually use the macros, I either make my own (mostly for data, obviously, not to recalculate offsets by hand and all that Razz), or just use the plain instructions? What's so bad about them? Confused

BTW Azu, awesome pic lol.
Post 28 Nov 2009, 04:11
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2, 3, 4, 5, 6, 7, 8  Next

< 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 can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.