embedded systems developers tools, cross compilers
  Home  |   SwiftX Archive  |   SwiftForth Archive  |

Re: TARGET : <name> ORDER no *EQUATES

From: Leon Wagner <leon_at_forth.com>
Date: Fri, 3 Dec 2004 10:20:19 -0800

As stated in Section 4.4, EQU words have no target code. Therefore, if they
were in the search order, all they would do is push their values onto the
host's stack at compile time. The compiler itself treats the EQU words
exactly as if they were literals. It could not do that if *EQUATES were in
the search order. Remember the most fundamental decision made inside the
compiler loop: look up the word and if not in the dictionary attempt to
compile it as a literal. So:

1 EQU ONE
: POO 1 ;
: FOO ONE ;

To the compiler, 1 and ONE are identical:

SEE POO
318C R11 R12 ! STMDB E92C0800
3190 1 R11 MOV E3A0B001
3194 LR PC MOV E1A0F00E

SEE FOO
3198 R11 R12 ! STMDB E92C0800
319C 1 R11 MOV E3A0B001
31A0 LR PC MOV E1A0F00E

This is even more interesting in systems with a code optimizer:

100 EQU CENT
: POO 100 + ;
: FOO CENT + ;

SEE POO
FA99 64 # ADDD C30064
FA9C RTS 39

SEE FOO
FA9D 64 # ADDD C30064
FAA0 RTS 39

Note: For diversity, I used the ARM processor for the first example, and the
68HC11 for the second.

> -----Original Message-----
> From: swiftx-bounce_at_forth.com [mailto:swiftx-bounce_at_forth.com]On Behalf
> Of Bulgrien, Dennis
> Sent: Friday, December 03, 2004 10:05
> To: 'swiftx_at_forth.com'
> Subject: [swiftx] Re: TARGET : <name> ORDER no *EQUATES
>
>
> Read, and understand *what* happens, yet not *how* it can since the
> definition is in *EQUATES which is not in the search order when
> compiling a
> target word.
>
> -----Original Message-----
> From: swiftx-bounce_at_forth.com [mailto:swiftx-bounce_at_forth.com]On Behalf
> Of Leon Wagner
> Sent: Friday, December 03, 2004 11:54
>
> ...
> Described in SwiftX Reference manual section 4.4, 2nd paragraph.
>
> -----Original Message-----
> From: swiftx-bounce_at_forth.com [mailto:swiftx-bounce_at_forth.com]On Behalf
> Of Bulgrien, Dennis
> Sent: Friday, December 03, 2004 09:18
>
> How do TARGET : definitions access EQU words since *EQUATES isn't in
> Context?
>
> -----Original Message-----
> Sent: Friday, December 03, 2004 10:53
> Subject: [swiftx] Re: TARGET : <name> ORDER using COMPILER
>
> ...
> Context: *COMPILER *TARGET *SHELL
> Current: *TARGET ok
> ----------------------------------------------------------------------
> swiftx_at_forth.com The SwiftX programming discussion email list
> To unsubscribe, send subject "unsubscribe" to swiftx-request_at_forth.com
> For list command help, send subject "help" to swiftx-request_at_forth.com
> Message archives are located at http://www.forth.com/archive/swiftx
> ----------------------------------------------------------------------
> This list is a forum for SwiftX users. For product support and bug
> reports, please send email to support_at_forth.com
> ----------------------------------------------------------------------
>
>

----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe" to swiftx-request_at_forth.com
For list command help, send subject "help" to swiftx-request_at_forth.com
Message archives are located at http://www.forth.com/archive/swiftx
----------------------------------------------------------------------
This list is a forum for SwiftX users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Fri Dec 03 2004 - 10:20:42 PST

This archive was generated by hypermail 2.2.0 : Tue Dec 02 2008 - 03:04:50 PST