From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7a58195927ccb785 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Not intended for use in medical devices Date: 1997/05/07 Message-ID: #1/1 X-Deja-AN: 239965411 References: <3.0.32.19970504232023.006f5c8c@mail.4dcomm.com> <5kn99d$jje@top.mitre.org> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-05-07T00:00:00+00:00 List-Id: Michael Brenner says << (1) computers are now finally fast enough to do source code rewriting as part of the optimization, and SHOULD (2) hardware devices should almost always be connected to software via memory boards, not registers or ports>> I really have no idea what (1) might mean. It is of course the case that many significant optimizations cannot be represented at the source level (e.g. register allocation, instruction scheduling), so I really do not know what this is about. As for (2), I don't see that. Indeed memory mapped I/O devices are tricky. Ada programmers in particular are tempted to speak to memory mapped I/O devices by using address clauses, and this almost always results in subtly non-portable code that is making unjustified assumptions. For example, one of our large customers porting a big program wrote type x is array (1 .. 32) of Boolean; pragma Pack (x); vx : x; for vx use at .... ... m := vx(3); and was most distressed that the compiler issued a byte read for the appropriate byte, rather than a word read, as required by their hardware (which did not recognize a byte read, and blew up). For another delicate example of the dangers of memory mapped access. Consider running the above program using old Alsys technology. Well a reference to vx(3) would work fine (doing a read just of that byte or word), but if you do m : boolean renames vx(3); now m is stored as a dynamic bit address, and an access to me will result in reading bytes surrounding the original four bytes -- perfectly valid Ada (though not very efficient), but of course disastrous in this context. Robert Dewar Ada Core Technologies