![]() |
![]() |
#21 |
Coder/webmaster/gamer
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,669
|
@BruceAbbott:
Why is it "not very useful"? Because it requires BB2 rather than BB0? I don't think there are many users still running without any Boing Bags installed. Last edited by Minuous; 05 June 2019 at 06:33. |
![]() |
![]() |
#22 | |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,302
|
Quote:
Do you call the $VER: cookie a discusting kludge? Do you expect that average Joe User knows how much stack a particular program needs? Do you expect that average Joe User *remembers* to set the stack in the shell? Tripos and the Tripos executable format (aka AmigaDOS) is not extensible without breaking backwards compatibility, so there is no room for such meta-information without stopping old versions of the segment loader to break with such extensions, or without additional tools accidentally removing them. Or, put in different words: Do you have anything better to suggest? Provided that a) it works transparently with older Os releases, b) it embeds information such that it cannot get lost easily, and c) it can be easily detected? |
|
![]() |
![]() |
#23 | |||||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,351
|
Quote:
Quote:
Quote:
![]() Programs don't crash if $VER is not supported. Quote:
But granted, programs shouldn't force the user to think about these details. There are, however, better ways to do that than stupid $STACK cookie. Quote:
From OS V37 we have something called StackSwap. |
|||||
![]() |
![]() |
#24 |
Registered User
Join Date: Jun 2015
Location: Germany
Posts: 1,924
|
Why would that be? I guess you could still check the stack size assigned to your program and allocate some extra stack if the original stack isn't enough. Of course, you can do this in earlier OS versions, too, but with the $STACK cookie you can at least avoid wasting the memory allocated for the original stack.
|
![]() |
![]() |
#25 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,351
|
Quote:
And if it does not, why can't the program itself do the same thing ? |
|
![]() |
![]() |
#26 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,302
|
No, it does not. You do not know how AmigaOs handles the stack. To remind you: The "STACK" command does not allocate any stack at all. It just records the stack size in the CommandLineInterface structure. The stack is allocated *every time* you execute a program from the shell (or the workbench), anew. Thus, whether you use the STACK command, or the $STACK cookie makes no freaking difference whatsoever.
|
![]() |
![]() |
#27 | |||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,302
|
Quote:
Quote:
Quote:
|
|||
![]() |
![]() |
#28 | |||||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,351
|
Quote:
And this means we have two stacks already : the one of the CLI process itself, and the one of the currently running program... This implies not using the cookie but using instead a proper way to handle the stack. Quote:
Quote:
And you silently rejected the other - yes, a change in the hunk structure would have been a more intelligent way (not that it is clever in the absolute, but still better than the stack cookie). Anyway... code properly, and you won't need big stacks at all ![]() (That's 3 better ways than the cookie already, btw.) Quote:
So either the user does, in that case the cookie is utterly useless. Or he does not, in that case the program crashes. In both cases the cookie does not fare very well. Of course if the program itself allocated a stack, the cookie becomes redundant and more useless than ever. Right, it could check if the cookie worked before allocating anything, but it's a lot simpler to allocate the stack in all cases. Quote:
If your program uses huge 300kb stack, are you really after 4k ? The mere fact of using a compiler to build your program wastes a magnitude more than that due to significantly larger code - but you would still defend doing it... Furthermore, what happens if we copy original stack contents and do not restore the old stack upon exit ? |
|||||
![]() |
![]() |
#29 |
Registered User
Join Date: Jun 2015
Location: Germany
Posts: 1,924
|
@meynaf: you act like you are forced to use the STACK cookie...
|
![]() |
![]() |
#30 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,351
|
Nonsense. I can perfectly tell something is a bad idea without being forced to use it in any way. Please refrain speaking about people, especially those you do not know.
Besides, the problem is far from being located there. The problem would be if someone actually uses it, i run the program believing the stack size is automatically handled, but it crashes because in reality it is not. |
![]() |
![]() |
#31 | ||||||||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,302
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
||||||||
![]() |
![]() |
#32 | |
Registered User
Join Date: Jun 2015
Location: Germany
Posts: 1,924
|
Quote:
Actually all your complaining is about how AmigaOS was lacking severely with regard to stack handling right from the start and how this got fixed (more or less) when AmigaOS was already a dead fish in the water. I don't see how Thomas is the right person to complain to. |
|
![]() |
![]() |
#33 | ||||||||||||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,351
|
Quote:
Quote:
Quote:
It would have been fine if programs did not need to check their stack size at all. But they sometimes need to, and no amount of cookies will change this. Quote:
And now the cookie is hidden in crunched data and thus is not able to do what it has been designed to do. Congratulations, flotsam. Quote:
Maybe, but that remains a rare case. Quote:
Should be. But it only does that in a limited number of cases. In the others -- gives a false impression of safety. Quote:
Quote:
(I'm trying here to resist the temptation of saying 10 bytes is actually not enough...) Even if the cost is extra risk of crashing on other people's setups ? Quote:
Especially when some users will complain the program crashes and you take a lot of time in debug just to discover their setup did not support the cookie. If you want to spare time by using a compiler, at least let the compiler setup the stack by more compatible means - i think they can do this. And why ? A stack is allocated when running the program and freed afterwards, why would changing it during the program crash anything ? Is the stack address and size stored in other place than in exec task structure, where it can be changed ? Quote:
Certainly not the one calling RunCommand directly. So what about file managers, or worse, debuggers ? Are all possible paths for program execution patched to check the cookie ? I doubt. And now the stack cookie gets ignored in some cases, leaving the user wonder why his program crashes (whereas mere stackswap would have worked everywhere). Quote:
Quote:
|
||||||||||||
![]() |
![]() |
#34 |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 56
Posts: 2,029
|
Right, for me ths is dirty hack only, not very useful too. The only good and clean solution is updating dos.library routine LoadSeg for new hunk type StackSize. Maybe exec.library must be updated too, i dont remember.
|
![]() |
![]() |
#35 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,302
|
Ok, so you update the programs that work on the Amiga hunk structure, would you? Please start with SLink, and let me know when you are done. Until then, I stick to the stack cookie.
|
![]() |
![]() |
#36 | |||||||||||||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,302
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
|||||||||||||
![]() |
![]() |
#37 |
Registered User
Join Date: Jun 2015
Location: Germany
Posts: 1,924
|
It's only not very useful because it wasn't introduced with say Kick 1.3 or 2.0 but with something even after 3.1. If it had been introduced much earlier, it would be a perfectly acceptable (because widely accepted) solution for something that was broken from the start.
|
![]() |
![]() |
#38 | ||||||||||||||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,351
|
Quote:
Quote:
The hunk structure is more the way it should have been done initially. Quote:
And if relying on the cookie alone, the program is non-loadable on older versions of the OS (well, actually it is loadable and will fail silently). Maybe. But i've seen a lot more crunched programs than i've seen stack cookies. Quote:
But even if it's fast, what do we have ? Well, the memory wasted is small, the amount of time wasted is small. Seems it's equal at the end. I still prefer using the memory, though, as at least it's always safe. Quote:
Rather, we should do our possible to make it reasonably safe. Quote:
Quote:
Quote:
Quote:
![]() It can only increase the stack, but the point is for when it does not ! Quote:
Quote:
Quote:
![]() And if programs don't look there... well, they're broken because it's quite standard way of doing things since very long - which is not the case for the cookie. Quote:
It's just that i prefer methods that work regardless of the setup. Quote:
Why having to scan a whole hunk of data for an info which can be put directly in the header ? |
||||||||||||||
![]() |
![]() |
#39 | |
Registered User
Join Date: Jun 2015
Location: Germany
Posts: 1,924
|
Quote:
The argument with the slow loading of the program doesn't seem very convincing because, again, it is up to the user whether he wants to use an updated loader that needs to search the binary for the cookie or not. For all I know typical 3.9BB users aren't of the A500 with 1MB RAM kind. |
|
![]() |
![]() |
#40 | |||||||||||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,302
|
Quote:
Quote:
Code:
static const char *stack="$STACK:8192\n"; Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
|||||||||||
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Moving supervisor stack | roondar | Coders. Asm / Hardware | 6 | 18 July 2017 17:13 |
Stack available | mritter0 | Coders. General | 4 | 03 August 2014 18:31 |
TCP/IP Stack | redneon | Amiga scene | 18 | 24 July 2005 16:01 |
Stack Up | Galaxy | request.Old Rare Games | 5 | 08 September 2004 03:06 |
Who wants a stack of originals? | FromWithin | Games images which need to be WHDified | 41 | 31 July 2003 09:31 |
|
|