Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #19310
| From | stephenXXX@mpeforth.com (Stephen Pelc) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: About stack access profundity |
| Message-ID | <510a62ea.510135172@192.168.0.50> (permalink) |
| References | (7 earlier) <JIidnQ2d7p40AprMnZ2dnUVZ_oSdnZ2d@supernews.com> <2013Jan29.162133@mips.complang.tuwien.ac.at> <5107ff7c.353609431@192.168.0.50> <2013Jan29.185800@mips.complang.tuwien.ac.at> <1950087.W2tCE9ddpV@sunwukong.fritz.box> |
| Date | 2013-01-31 12:32 +0000 |
On Tue, 29 Jan 2013 20:17:54 +0100, Bernd Paysan <bernd.paysan@gmx.de> wrote: >Anton Ertl wrote: >> I would have to look at the concrete code (before and after the >> change) to give a proper comment on that. But if all that happens is >> that you replace a "5 PICK" (which should produce a register reference >> or, if there are not enough registers, a memory reference to the >> memory part of the stack) with something like "DUP .X @", "OVER .X @", >> "R@ .X @" (which should produce at least one memory reference, for the >> @), the use of structures should not be shorter and faster. > >Not convinced. VFX doesn't do that too well: > >begin-structure point ok-2 >field: .x ok-2 >field: .y ok-2 >end-structure ok >: test ( addr -- ) >r r@ .x @ r@ .y @ 2dup + r@ .x ! - r> .y ! ; ok >see test >TEST >( 080BC940 53 ) PUSH EBX >( 080BC941 8B1424 ) MOV EDX, [ESP] >( 080BC944 8B4A04 ) MOV ECX, [EDX+04] >( 080BC947 030B ) ADD ECX, 0 [EBX] >( 080BC949 8B0424 ) MOV EAX, [ESP] >( 080BC94C 8D6DF4 ) LEA EBP, [EBP+-0C] >( 080BC94F 894D00 ) MOV [EBP], ECX >( 080BC952 8B4A04 ) MOV ECX, [EDX+04] >( 080BC955 894D04 ) MOV [EBP+04], ECX >( 080BC958 8B13 ) MOV EDX, 0 [EBX] >( 080BC95A 895508 ) MOV [EBP+08], EDX >( 080BC95D 8BD8 ) MOV EBX, EAX >( 080BC95F 8B5500 ) MOV EDX, [EBP] >( 080BC962 8913 ) MOV 0 [EBX], EDX >( 080BC964 8B5D08 ) MOV EBX, [EBP+08] >( 080BC967 2B5D04 ) SUB EBX, [EBP+04] >( 080BC96A 5A ) POP EDX >( 080BC96B 895A04 ) MOV [EDX+04], EBX >( 080BC96E 8B5D0C ) MOV EBX, [EBP+0C] >( 080BC971 8D6D10 ) LEA EBP, [EBP+10] >( 080BC974 C3 ) NEXT, >( 53 bytes, 21 instructions ) > >That's 21 instructions, clearly not what I would have written by hand. The code from the LEA up to but not including the SUB is a stack shuffle (we ran out of registers) followed by a store. Although it's possible to do it without the shuffle, VFX's "rip up and retry" rules are not clever enough here. Marcel's iForth version is for 64 bit code with 16 registers. This means more registers, so no shuffle, and because there are more registers, some can be used for the return stack. Nice code. Stephen -- Stephen Pelc, stephenXXX@mpeforth.com MicroProcessor Engineering Ltd - More Real, Less Time 133 Hill Lane, Southampton SO15 5AF, England tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691 web: http://www.mpeforth.com - free VFX Forth downloads
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
About stack access profundity Pablo Hugo Reda <pabloreda@gmail.com> - 2013-01-27 12:11 -0800
Re: About stack access profundity humptydumpty <ouatubi@gmail.com> - 2013-01-28 00:59 -0800
Re: About stack access profundity Pablo Hugo Reda <pabloreda@gmail.com> - 2013-01-28 07:17 -0800
Re: About stack access profundity Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-01-28 03:10 -0600
Re: About stack access profundity Pablo Hugo Reda <pabloreda@gmail.com> - 2013-01-28 07:23 -0800
Re: About stack access profundity Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-01-28 10:46 -0600
Re: About stack access profundity anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-29 08:20 +0000
Re: About stack access profundity Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-01-29 03:25 -0600
Re: About stack access profundity anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-29 09:47 +0000
Re: About stack access profundity Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-01-29 04:08 -0600
Re: About stack access profundity anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-29 15:21 +0000
Re: About stack access profundity Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-01-29 09:57 -0600
Re: About stack access profundity anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-29 17:01 +0000
Re: About stack access profundity Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-01-29 12:22 -0600
Re: About stack access profundity anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-30 17:40 +0000
Re: About stack access profundity Paul Rubin <no.email@nospam.invalid> - 2013-01-30 11:49 -0800
Re: About stack access profundity anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-02-04 16:39 +0000
Re: About stack access profundity Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-01-30 16:32 -0600
Re: About stack access profundity anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-31 16:02 +0000
Re: About stack access profundity stephenXXX@mpeforth.com (Stephen Pelc) - 2013-01-29 17:06 +0000
Re: About stack access profundity anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-29 17:58 +0000
Re: About stack access profundity Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-01-29 12:29 -0600
Re: About stack access profundity anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-30 17:22 +0000
Re: About stack access profundity Bernd Paysan <bernd.paysan@gmx.de> - 2013-01-29 20:17 +0100
Re: About stack access profundity mhx@iae.nl (Marcel Hendrix) - 2013-01-29 21:44 +0200
Re: About stack access profundity Bernd Paysan <bernd.paysan@gmx.de> - 2013-01-29 22:14 +0100
Re: About stack access profundity anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-30 16:29 +0000
Re: About stack access profundity Pablo Hugo Reda <pabloreda@gmail.com> - 2013-01-30 09:58 -0800
Re: About stack access profundity stephenXXX@mpeforth.com (Stephen Pelc) - 2013-01-31 12:32 +0000
Re: About stack access profundity Bernd Paysan <bernd.paysan@gmx.de> - 2013-01-31 15:37 +0100
Re: About stack access profundity Mark Wills <forthfreak@gmail.com> - 2013-01-29 23:12 -0800
Re: About stack access profundity stephenXXX@mpeforth.com (Stephen Pelc) - 2013-01-29 10:08 +0000
Re: About stack access profundity Pablo Hugo Reda <pabloreda@gmail.com> - 2013-01-29 07:10 -0800
Re: About stack access profundity anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-29 15:17 +0000
Re: About stack access profundity Mark Wills <forthfreak@gmail.com> - 2013-01-29 00:57 -0800
Re: About stack access profundity Mark Wills <forthfreak@gmail.com> - 2013-01-28 01:56 -0800
Re: About stack access profundity anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-01-29 15:30 +0000
Re: About stack access profundity Pablo Hugo Reda <pabloreda@gmail.com> - 2013-01-29 09:06 -0800
Re: About stack access profundity Pablo Hugo Reda <pabloreda@gmail.com> - 2013-02-03 06:22 -0800
Re: About stack access profundity Mark Wills <forthfreak@gmail.com> - 2013-02-03 07:25 -0800
Re: About stack access profundity Pablo Hugo Reda <pabloreda@gmail.com> - 2013-02-03 15:51 -0800
Re: About stack access profundity Coos Haak <chforth@hccnet.nl> - 2013-02-04 01:12 +0100
Re: About stack access profundity Mark Wills <forthfreak@gmail.com> - 2013-02-03 23:10 -0800
Re: About stack access profundity Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-02-04 03:26 -0600
Re: About stack access profundity humptydumpty <ouatubi@gmail.com> - 2013-02-03 11:26 -0800
Re: About stack access profundity Pablo Hugo Reda <pabloreda@gmail.com> - 2013-02-03 15:49 -0800
csiph-web