9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Non-stack-based calling conventions
@ 2008-02-19  0:28 Andrew Simmons
  2008-02-19  0:39 ` Brantley Coile
  0 siblings, 1 reply; 74+ messages in thread
From: Andrew Simmons @ 2008-02-19  0:28 UTC (permalink / raw)
  To: 9fans

>Don't let the bastards get you down.  Believe me when I say you're not
>the only one who would vote Bruce off the list if it were an option.

Don't diss brucee. He's one of the few reasons for still keeping a
tenth of an eye on the list. These days I even miss Choate. "Let he
without stone cast the first stone" was pure genius. Most of all I
miss the benign presence of Presotto, forever attempting to pour oil
on troubled waters.


^ permalink raw reply	[flat|nested] 74+ messages in thread
* Re: [9fans] Google search of the day
@ 2008-02-15 16:07 erik quanstrom
  2008-02-15 17:39 ` Eris Discordia
  0 siblings, 1 reply; 74+ messages in thread
From: erik quanstrom @ 2008-02-15 16:07 UTC (permalink / raw)
  To: 9fans

> My understanding has always been that the stack is a fundamental element
> of the x86 architecture. SP and BP registers, later ESP and EBP, are all
> about the stack. All return addresses are stored on the stack. Parameter
> passing relies on it. And I know of no other means of implementing them.
> Except by avoiding call/ret instructions and solely jmp'ing around in a
> true mess of a code. No true "procedures."

while this is true, you are confusing calling convention and architecture.
the arch puts some limits on calling convention, but there is no requirement
to use the stack if you have one.

you could have a calling convention that every function emits a call block
with the arguments at callblock+offset and the return value(s) at callblock-
offset.  doesn't matter if the arch has a stack or not.  you are free to ignore it.
'
> I am almost sure the modern incarnations of FORTRAN (90, or even 77?) do
> support both true procedures and recursion. Though, I have not tried them
> so I do not have a say there.

fortran 95 supports recursion.  this does not imply that the *language*
requires a stack.  it could be done via heap allocation.  i don't know enough
fortran to comment intelligently on how its done.

> Automatic/scoped variables are allocated on the stack frame for procedure
> calls and/or nested code blocks (Flat Assembler's rendition of the IA-32
> "enter" instruction supports up to 32 stack frames). And without them,
> programming would be a lot harder.

some languages -- notibly c -- assume a stack frame.  there are many languages,
like fortran that do not.  you wouldn't notice what the compiler is doing in
those languages.

> There is also the "growing" heap for
> implementing dynamic variables which is quite as problematic as the stack
> because it, too, can grow beyond bounds and give one headaches.

this is an entirely different problem as heap allocations in most languages
are *explicit* thus allowing the programmer to respond to the situation
appropriately.  iirc, v7 sort used a binary search algorithm to figure out
how much memory it could sbrk().  e.g.

	int memsize;

	for(memsize = 1024*1024; memsize >= 4*1024;)
		if(sbrk(memsize)>0)
			break;

- erik


^ permalink raw reply	[flat|nested] 74+ messages in thread

end of thread, other threads:[~2008-02-28 14:15 UTC | newest]

Thread overview: 74+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-19  0:28 [9fans] Non-stack-based calling conventions Andrew Simmons
2008-02-19  0:39 ` Brantley Coile
2008-02-19  0:43   ` Andrew Simmons
2008-02-19  0:52     ` Uriel
2008-02-19  1:06       ` Pietro Gagliardi
2008-02-19  1:33         ` Brantley Coile
2008-02-19  3:18         ` Michaelian Ennis
2008-02-19  3:29           ` Michaelian Ennis
2008-02-19  3:35             ` Pietro Gagliardi
2008-02-19  5:18       ` Skip Tavakkolian
2008-02-19  5:33       ` Skip Tavakkolian
2008-02-19  4:11   ` Bruce Ellis
2008-02-20 14:59     ` maht
2008-02-20 15:28     ` Uriel
  -- strict thread matches above, loose matches on Subject: below --
2008-02-15 16:07 [9fans] Google search of the day erik quanstrom
2008-02-15 17:39 ` Eris Discordia
2008-02-15 23:37   ` [9fans] Non-stack-based calling conventions Lyndon Nerenberg
2008-02-15 23:39     ` Pietro Gagliardi
2008-02-15 23:47       ` Paweł Lasek
2008-02-16  0:23         ` Brantley Coile
2008-02-16 23:32           ` Eris Discordia
2008-02-16 23:41             ` Pietro Gagliardi
2008-02-16 23:49             ` Brantley Coile
2008-02-17  0:04             ` Brantley Coile
2008-02-17 13:30               ` Eris Discordia
2008-02-17 15:04                 ` erik quanstrom
2008-02-17 21:43                   ` Uriel
2008-02-17 23:58                     ` erik quanstrom
2008-02-18  1:54                       ` Bruce Ellis
2008-02-18  3:43                         ` erik quanstrom
2008-02-18  4:31                           ` Bruce Ellis
2008-02-18  4:40                             ` Pietro Gagliardi
2008-02-18  6:22                         ` Robert William Fuller
2008-02-18  7:23                           ` Bruce Ellis
2008-02-18  8:38                             ` Anant Narayanan
2008-02-22 10:02                               ` Douglas A. Gwyn
2008-02-22 19:35                                 ` Anant Narayanan
2008-02-18  8:30                           ` Anant Narayanan
2008-02-18  8:44                             ` Bruce Ellis
2008-02-18 18:50                           ` Federico G. Benavento
2008-02-18 21:53                             ` Lorenzo Fernando Bivens de la Fuente
2008-02-18 22:55                               ` y i y u s
2008-02-18 23:46                                 ` Uriel
2008-02-18 22:14                             ` Pietro Gagliardi
2008-02-18 22:16                               ` Pietro Gagliardi
2008-02-18 22:32                                 ` Federico G. Benavento
2008-02-20 11:39                             ` maht
2008-02-20 17:19                               ` Bruce Ellis
2008-02-22 10:02                               ` Douglas A. Gwyn
2008-02-22 10:02                             ` Douglas A. Gwyn
2008-02-18 22:13                           ` LiteStar numnums
2008-02-18  4:44                       ` Pietro Gagliardi
2008-02-18  4:46                         ` Pietro Gagliardi
2008-02-18  5:03                           ` Uriel
2008-02-17 16:08                 ` Anthony Sorace
2008-02-17 22:03                   ` Charles Forsyth
2008-02-22 10:01                 ` Douglas A. Gwyn
2008-02-22 14:07                   ` Iruata Souza
2008-02-22 10:01               ` Douglas A. Gwyn
2008-02-22 10:01           ` Douglas A. Gwyn
2008-02-16  8:29         ` Lluís Batlle
2008-02-17 23:09           ` Chad Dougherty
2008-02-18 21:50           ` Pietro Gagliardi
2008-02-22 10:02           ` Douglas A. Gwyn
2008-02-26 21:30         ` Paweł Lasek
2008-02-26 22:00           ` maht
2008-02-26 22:32             ` Brantley Coile
2008-02-26 23:15               ` Uriel
2008-02-26 22:33             ` Brantley Coile
2008-02-26 22:46               ` Bruce Ellis
2008-02-27  4:26           ` lucio
2008-02-27  6:52             ` ron minnich
2008-02-27 17:57               ` lucio
2008-02-28  9:33               ` Bill Gunshannon
2008-02-28  9:58                 ` Charles Forsyth
2008-02-28 14:15                 ` Bill Gunshannon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).