flat assembler
Message board for the users of flat assembler.

Index > Main > Stack Realignment "Techniques"

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



Joined: 01 Sep 2013
Posts: 670
system error 28 Aug 2017, 13:32
No you dumbfcuk, high-level compilers don't work that way!

The abstraction layer between your C source code and the underlying machine binaries is so thick that you can't anticipate and suggest a 'small' ASM solution to it. They have lots and lots of compilation phases to go through before generating the machine binaries, be it on ARM, Linux, Arduino, UNIX, Sparc.

See, they have to consider other machines as well. C compilers, parsers, lexers do not even begin with assembly language NO! Don't you get it dumbfcuk?

TWO C sources may produce TWO different assemblies at any given time on the same machine depending on the compilation route, optimization and resources available at that point!

And the worse part it, GCC authors will laugh in your pathetic face for your "special technique" and ASM programmers will laugh in your face twice as hard for your garbage alignment technique! Hahahaha xD

So my suggestion to you, DON'T DO IT. STOP. Don't patch anything to current GCC. Don't try to look important. Do not try to impress anyone. Because in the end, you'll only bring BIG DISGRACE to ASM community! XD
Post 28 Aug 2017, 13:32
View user's profile Send private message Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 2493
Furs 28 Aug 2017, 13:54
system error wrote:
No you dumbfcuk, high-level compilers don't work that way!
Dude, I *am* a contributor to GCC. I am fully aware how it works, stop talking shit you have *no idea* about. What the fuck is wrong with you?

Show me the code in GCC source code that handles the realignment then. I told you the exact function in GCC source code that does it, what else do you want? I don't give a shit what you say or how you imagine them to work. You have a nice imagination, but keep other people out of it.

I'd link the mirror of i386.c on github but I know you don't click on links like a true internet warrior man-child. So, other than telling you exactly what function does the realignment (and should swap the and with sub in RTL gen), I don't know what to tell you. Grow up.
Post 28 Aug 2017, 13:54
View user's profile Send private message Reply with quote
system error



Joined: 01 Sep 2013
Posts: 670
system error 28 Aug 2017, 14:14
Furs wrote:
system error wrote:
No you dumbfcuk, high-level compilers don't work that way!
Dude, I *am* a contributor to GCC. I am fully aware how it works, stop talking shit you have *no idea* about. What the fuck is wrong with you?

Show me the code in GCC source code that handles the realignment then. I told you the exact function in GCC source code that does it, what else do you want? I don't give a shit what you say or how you imagine them to work. You have a nice imagination, but keep other people out of it.

I'd link the mirror of i386.c on github but I know you don't click on links like a true internet warrior man-child. So, other than telling you exactly what function does the realignment (and should swap the and with sub in RTL gen), I don't know what to tell you. Grow up.


No you are not. You THINK you're contributing to GCC. You're just making a FAKE IMPRESSION. It goes with your 'i am a very important person' attitude.

Seek help. You're sick. But I enjoy trolling you anyway! xD
Post 28 Aug 2017, 14:14
View user's profile Send private message Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 2493
Furs 28 Aug 2017, 14:15
Contributor (to open source software) means that you've submitted patches which were accepted. And that is a fact (and quite a few of them), so that makes me a contributor.

All I see from you is "Blah"
Post 28 Aug 2017, 14:15
View user's profile Send private message Reply with quote
system error



Joined: 01 Sep 2013
Posts: 670
system error 28 Aug 2017, 14:28
Furs wrote:
Contributor (to open source software) means that you've submitted patches which were accepted. And that is a fact (and quite a few of them), so that makes me a contributor.

All I see from you is "Blah"
...and I am the King of Poland.

How difficult could that be? xD
Post 28 Aug 2017, 14:28
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
comrade 29 Aug 2017, 01:18
Internet anonymity can bring out the worst in people. User system error being a prime example. Would the self-proclaimed King of Poland dare to be as rude and condescending if Fuchs and he argued this face-to-face? Who brought system error up - where are his manners?

Knowledge and righteousness-of-argument aside, there is no excuse for a civil, well-brought up man to act as such. Absolutely disgusting.

Internet is a giant trash can, with a spoon of honey hidden deep inside. Sometimes you have weed through a lot of trash before you get to this honey, and many times this process is not worth it.

We currently live in the Golden Era of Internet Liberties - it should be not be surprising (in any society that wishes to enforce civility and prevent degeneracy) that real identities for telecommunications (along with logged chats and backdoored encryption) are mandated by the government. Yes, previous attempts at this have been made before (Google+ when it came out) and some are still in effect (Internet in China, Yarovaya Law in Russia). This can be discussed at length - whether it is good or bad, necessary or overreach by the government - I am simply stating facts and articulating trends.

On a smaller scale, I recommend that the moderators of this forum enforce civility in this particular forum thread.


Last edited by comrade on 29 Aug 2017, 01:27; edited 1 time in total
Post 29 Aug 2017, 01:18
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
comrade 29 Aug 2017, 01:26
Re: technical argument

There is a concept called peephole optimization that is prevalent in the compiler toolchain, that implements architecture-specific optimizations higher up the layer (whereas, in the classic compiler model, these layers would have zero knowledge about the target architecture or its instruction set).
Post 29 Aug 2017, 01:26
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
system error



Joined: 01 Sep 2013
Posts: 670
system error 29 Aug 2017, 01:55
comrade wrote:
Internet anonymity can bring out the worst in people. User system error being a prime example. Would the self-proclaimed King of Poland dare to be as rude and condescending if Fuchs and he argued this face-to-face? Who brought system error up - where are his manners?

Knowledge and righteousness-of-argument aside, there is no excuse for a civil, well-brought up man to act as such. Absolutely disgusting.

Internet is a giant trash can, with a spoon of honey hidden deep inside. Sometimes you have weed through a lot of trash before you get to this honey, and many times this process is not worth it.

We currently live in the Golden Era of Internet Liberties - it should be not be surprising (in any society that wishes to enforce civility and prevent degeneracy) that real identities for telecommunications (along with logged chats and backdoored encryption) are mandated by the government. Yes, previous attempts at this have been made before (Google+ when it came out) and some are still in effect (Internet in China, Yarovaya Law in Russia). This can be discussed at length - whether it is good or bad, necessary or overreach by the government - I am simply stating facts and articulating trends.

On a smaller scale, I recommend that the moderators of this forum enforce civility in this particular forum thread.


You can't teach civility that easy to people who come from barbaric culture like Furs. AFAIK, he's the one starting his barbaric attitude on this board. You can confirm that from the forums Administrators. I am just giving him a taste of his own medicine so that he can learn something and finally become a civilized person.

And am I really the King of Poland? who knows.... xD
Post 29 Aug 2017, 01:55
View user's profile Send private message Reply with quote
system error



Joined: 01 Sep 2013
Posts: 670
system error 29 Aug 2017, 02:00
Furs wrote:
Local variables? It's mentioned in the first post. I have a 256-bit AVX vector on the stack and an 4-byte int. 32+4 = 36, and to keep esp aligned (after the sub) to 32-byte the nearest is 64. Aligning esp after the subtraction, though, requires only a sub 36, because it gets aligned after anyway. If the sub 36 makes it misaligned, the bitwise and will align it. It guarantees there's at least 36 bytes of space, so [esp] will be aligned (and use the vector there).


No you dumbfcuk! You don't need 64 bytes allocation for a 36 bytes of data. Just use my "tester1" example to precisely allocate the exact space of 36 bytes (1 aligned avx, 1 local)! Is that too technical for you? hmmmmm????
Post 29 Aug 2017, 02:00
View user's profile Send private message Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 2493
Furs 29 Aug 2017, 13:30
system error wrote:
You can't teach civility that easy to people who come from barbaric culture like Furs.
He was talking purely about your behavior. Don't be so dense, grow up for once.
system error wrote:
AFAIK
That's the problem. (see the emphasis)

I'm not sure what part of "GCC generates sub esp, 64" do you not understand. Taking out the volatile int from the stack makes it "sub esp, 32" (only the vector). Must suck living in ignorance.
Post 29 Aug 2017, 13:30
View user's profile Send private message Reply with quote
system error



Joined: 01 Sep 2013
Posts: 670
system error 29 Aug 2017, 14:03
Furs wrote:
I'm not sure what part of "GCC generates sub esp, 64" do you not understand. Taking out the volatile int from the stack makes it "sub esp, 32" (only the vector). Must suck living in ignorance.


No you DUMBFCUK, it's not about that "SUB ESP,64" I was referring to. It's about your comment that comes with it....

Code:
sub esp, 64  ; because it won't fit in 32-bytes and has to be aligned to 32 for some reason?    


What did you mean by

1) "WON'T FIT?"
Hahahaha. This is where I detected that you are just as INCOMPETENT as the APE in interpreting bare metal low-level Assembly instruction! No, DUMBFCUK, it FITS! xD

2) "has to be aligned to 32 for some reason?"
OMG dumbFCUK, it has already been aligned to 32- from the top. It just a matter of your technical knowledge on where to put and to locate your AVX data to that location.

See that, INCOMPETENT DUMBFCUK?? You can't even understand low-level codes! That STUPID QUESTIONS of yours are showing exactly that. And now you're boasting about sending a "patch" to GCC people to teach them a lesson or two about assembly language?

HAHAHAHAHAHA xD


Last edited by system error on 29 Aug 2017, 14:07; edited 1 time in total
Post 29 Aug 2017, 14:03
View user's profile Send private message Reply with quote
system error



Joined: 01 Sep 2013
Posts: 670
system error 29 Aug 2017, 14:06
Let's see how Mr Know-all re-calibrate his face and his "know-all" image after some nice bitchslapping to the face xD
Post 29 Aug 2017, 14:06
View user's profile Send private message Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 2493
Furs 29 Aug 2017, 14:09
How do you fit a 32-byte vector plus a 4-byte int into 32 bytes again? What I literally said it won't fit in 32 bytes. Since it's 32+4 = 36 bytes minimum.

Oh you want a quote to see just how terrible you are at reading? Here's from my first post: "Also used a volatile int to test it".

"and has to be aligned" -> I'm talking about esp (since that's what is in the instruction). Man, not only are you a man-child, you can't even understand basic english properly, and instead of apologizing for being bad at english, you think you're a hotshot for it.

Do you understand the simple fact that GCC (yes, GCC, not me) wants to keep esp aligned to 32 byte, not just the vector? GCC keeps [esp] (that is, [esp+0] in case you still don't get it) aligned to the largest alignment that the stack frame has. Since in this case, the stack frame's alignment is 32-bytes, it will want to keep [esp+0] aligned to 32 bytes. Regardless of where the vector is. In fact, GCC places the vector at [esp+32] for some reason, not at [esp+0]. And it places the int at [esp+28].

This is one area where your stupid example fails. Your [esp+4] is aligned to 32 bytes, so it won't work for GCC, which wants [esp+0] also aligned (not JUST the vector).

Why? I don't know. I know how it does it, but I don't know why it does it. Go fucking ask them (GCC maintainers) on bugzilla and embarrass yourself there. Stop bugging me with stupid shit.

Mr. "xD"

EDIT: Guess what though? My example keeps vector at [esp+0], while also having [esp+0] aligned. So it's what GCC wants, while using less stack space, hence a patch can be applied. It uses the exact same instruction sizes, same stack size, same performance, same uops, same everything, except swapping "and" with "sub".

Tell me again how you are so smart and how your method is in any way superior to mine. You know it isn't, and that's exactly what makes you so butthurt.

Just FYI, this is my method from the first post:
Code:
sub esp, 36
and esp, -32    
See? Not 64.
Post 29 Aug 2017, 14:09
View user's profile Send private message Reply with quote
system error



Joined: 01 Sep 2013
Posts: 670
system error 29 Aug 2017, 14:20
Another STUPID question from an incompetent Mr-Know-All

Quote:
No, the problem is why is and before sub. In fact, this question is broader than GCC: why is the "common idiom" to bitwise and before the subtraction?!?


Answer: No monkey. It doesn't always like that. In many cases, GCC also emits SUB before AND.

xD
Post 29 Aug 2017, 14:20
View user's profile Send private message Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 2493
Furs 29 Aug 2017, 14:23
system error wrote:
Answer: No monkey. It doesn't always like that. In many cases, GCC also emits SUB before AND.
For the stack frame? (i.e. final esp sub). Not possible, since it's in the sources.

Show me the code that compiles to sub before and with GCC. "xD" (you can verify it on gcc.godbolt.org, so no, you can't lie yourself like a 6 year old out of this one)

Oh, also, so you admit that my method of sub before and is superior? Then in that case, you just shot yourself in the foot.
Post 29 Aug 2017, 14:23
View user's profile Send private message Reply with quote
system error



Joined: 01 Sep 2013
Posts: 670
system error 29 Aug 2017, 14:26
Furs wrote:
How do you fit a 32-byte vector plus a 4-byte int into 32 bytes again? What I literally said it won't fit in 32 bytes. Since it's 32+4 = 36 bytes minimum.


No MONKEY. It fits just nicely if you know your way around the stack. But the problem is, you're just as clueless as your KEYBOARD. The only difference with your keyboard is, you have a BIG MOUTH.

See my TESTER1

The stack fit your 36-byte data just nicely!

Just admit it that you're INCOMPETENT with a BIG MOUTH xD

[/b]
Post 29 Aug 2017, 14:26
View user's profile Send private message Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 2493
Furs 29 Aug 2017, 14:28
Quote from first post:
Furs wrote:
because it won't fit in 32-bytes
The mere fact you resort to "36" bytes to prove your inexistent point shows you got completely destroyed.

Also I have nothing to discuss with you until you show me the code that, when compiled with GCC on gcc.godbolt.org, it will use "sub esp, X" before "and esp, X". This is what you claimed, so **PROVE** it.

Understand? Good. Now show me the code, because this is a programming forum, not a kindergarten.

My GCC version was 6.3.0. You can start with that. Feel free to use any code (except assembly, that's obviously cheating).
Post 29 Aug 2017, 14:28
View user's profile Send private message Reply with quote
system error



Joined: 01 Sep 2013
Posts: 670
system error 29 Aug 2017, 14:35
Furs wrote:
Show me the code that compiles to sub before and with GCC. "xD" (you can verify it on gcc.godbolt.org, so no, you can't lie yourself like a 6 year old out of this one)


One 3-second search from google:
https://stackoverflow.com/questions/4175281/what-does-it-mean-to-align-the-stack

See, SUB comes before AND. There are millions of such examples out there. This is just a simple "hello world". I bet you don't understand those assembly listing simply because you're INCOMPETENT!! xD


Quote:
Oh, also, so you admit that my method of sub before and is superior? Then in that case, you just shot yourself in the foot.


No INCOMPETENT DUMBFCUK. In assembly programmers's circle, it's not called a "special technique" or a "special method". You are the only one thinking that you've produced something special (that goes PERFECTLY with your "I KNOW ALL" attitude". It's just a normal stack programming technique. Not a method. Not a special. Just a normal instructions.

What makes you think you''re or you've produced something "special"? xD
Post 29 Aug 2017, 14:35
View user's profile Send private message Reply with quote
system error



Joined: 01 Sep 2013
Posts: 670
system error 29 Aug 2017, 14:44
Furs wrote:
Quote from first post:
Furs wrote:
because it won't fit in 32-bytes


What do you mean by that? I am quoting your very first post and EVERYBODY here can see that very clearly. You clearly stated that you want you stack space to maintain:

1) a space for an AVX data (32-bytes, aligned)
2) a space for DWORD (4-bytes)

So simple 5th grader math (and I am repeating this TWICE already, exactly the same content!)

32 + 4 = 36 bytes!

So, I did offer you 2 normal techniques commonly used by REAL assembly programmers.

TESTER1
TESTER2

Both are aligned. Both are 36-bytes just like you wanted it. Nothing special there. All you need is COMPETENCY in dealing with AVX aligned data, stack programming.

That COMPETENCY is something that you don't have. And I am not wrong when I call you an INCOMPETENT IDIOT! <<<------ Hahahahaha xD
Post 29 Aug 2017, 14:44
View user's profile Send private message Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 2493
Furs 29 Aug 2017, 14:44
I thought I was pretty clear about a gcc.godbolt.org link so I can verify it. I guess the style of "programming" you do fits perfectly: Googling for others' work. I don't even know the GCC version used -- or the settings used -- how can it be verified? It could be a hand-written asm file for all you know.

Also, you forgot 3)

3) [esp+0] aligned to 32 bytes

Deal with it.
Post 29 Aug 2017, 14:44
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  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 cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.