Path: csiph.com!aioe.org!.POSTED!not-for-mail From: Rod Pemberton Newsgroups: comp.lang.forth Subject: Re: Are stack machines inherently faster? Date: Sun, 27 Nov 2016 05:08:58 -0500 Organization: Aioe.org NNTP Server Lines: 48 Message-ID: <20161127050858.1dbc490d@_> References: <40b9c778-3a98-450b-b65b-6cbaee444921@googlegroups.com> <6a4467c7-1b3b-4e36-b10d-c6a4c98433c6@googlegroups.com> <0ebbb961-6537-4472-8170-f899bd801edb@googlegroups.com> <34e47822-500b-421c-a53d-a9e0fcc1f6ae@googlegroups.com> <87vavld5g6.fsf@nightsong.com> <582ee232.719393556@news.eternal-september.org> <582f1934.733475657@news.eternal-september.org> NNTP-Posting-Host: n4wpt9zq8xR26Ttf9mo2BA.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Claws Mail 3.13.1 (GTK+ 2.24.13; x86_64-unknown-linux-gnu) Xref: csiph.com comp.lang.forth:52895 On Sun, 27 Nov 2016 00:25:22 -0800 (PST) polymorph self wrote: > > Probably not. Remember also that assembler code is harder to write > > and to maintain, and affects both cost and time to market. As I keep > > pointing out, I haven't written an interrupt routine in assembler > > for an ARM for about 15 years ... except to prove that I can still > > do it. A good code generator is an enabling technology. > > > by the gods I can't even imagine writing an interrupt in assembler It's no different than coding a subroutine or procedure in assembly. You just have to take care of some extra steps. There are a bunch of people who have done so for the x86 processor on alt.os.development. I have yet to see anyone on a.o.d. who codes for the ARM processor. > how the hell did you learn such? You read the programmer instruction manuals from the processor manufacturer. You teach yourself how to program in assembly. Then, like everything else in life, you solve the puzzle. You make it work by doing what needs to be done. Think of it as a procedure with a few extra layers wrapped around the code for a procedure. For x86, the basic sequence is: disable interrupts preserve registers (optionally) switch stacks do what needs to be done for the interrupt procedure (optionally) restore stacks restore registers enable interrupts return from interrupt Of course, you have to do that sequence in assembly. But, you don't have to code the interrupt in assembly. You can code most of it in a high level language like C. However, most high level languages don't provide a mechanism to implement interrupt routines. So, you have to find a method to transfer from assembly to the high level language, and a way to transfer back too. This is more assembly code. This code is custom to each compiler. Rod Pemberton