Forum > Beginners
Strange behaviour of BOOLEAN type
Martin_fr:
Just to give a few more details.
The bug in the initial post of the thread was caused by the peephole optimizer. The peephole optimizer is a kind of "replace certain patterns engine". It has no idea what is boolean, it has no idea how boolean is stored or handled. It just replace a sequence of asm statements, with a different sequence of asm statements, if both statement-sequences do the same.
As the bug was caused by a part of the compiler that neither knows, nor depends on what boolean is, the bug is not be related to how boolean is defined or handled.
Thaddy:
Then can you explain away my examples? You can't. AI has nothing to do with that....
Martin_fr:
--- Quote from: Thaddy on June 07, 2024, 01:12:41 pm ---Then can you explain away my examples? You can't. AI has nothing to do with that....
--- End quote ---
To much work. Sorry, not interested.
As I said:
1) the peephole optimizer has no idea about boolean. It has no idea about Pascal. You could throw any piece of asm into the peephole optimizer, and it would optimize that asm.
2) The issue in this thread was fixed by a fix to that peephole optimizer
3) Ergo, it can not be related to the compiles definition/understanding/handling of boolean.
So it does not matter what your examples show (or don't show) about what happens with boolean.
At this point I haven't even bothered to check if your examples are correct. It simply doesn't affect the case.
If the compiler generates code like
--- Code: ASM [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---mov rax, rbxmov rcx, rdxThe order of those can be changed. And the peephole optimizer might do that, if it results in faster/shorter code.
But
--- Code: ASM [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---mov rax, rbxmov rbx, rdxrelies on that order.
If the peephole optimizer changes that, it is wrong.
But in neither case it matters in any way what the original Pascal (or C, or any other language) code was. And if that language code does not matter, then it does not matter what "boolean" means in that language.
(that is, it does not matter for what the peephole optimizer does / and/or does wrong)
And as for you point (the correctness of which I have not verified ) "the expansion to full register" => that was not affected by the peephole optimizer. It happening (or not happening) was kept the same as it was in the asm that was feed into the peephole optimizer. And yet, the issue is now fixed, with it still happening (or not happening) the same as it has before.
Thaddy:
I fully understand the internals. Always did... You keep repeating yourself just as many times as I do.
Let's close it.
Bug is proven.
rvk:
--- Quote from: Thaddy on June 07, 2024, 02:50:21 pm ---Bug is proven.
--- End quote ---
And it's the an open bugreport for it?
A separate one, not connected to some other issue which could cloud things.
Preferable with a patch ;)
Navigation
[0] Message Index
[#] Next page
[*] Previous page