View Single Post
Old 01 August 2015, 17:39   #157
Total Chaos forever!

Samurai_Crow's Avatar
Join Date: Aug 2007
Location: Ft. Collins, CO USA
Age: 43
Posts: 1,026
Send a message via Yahoo to Samurai_Crow
Originally Posted by Mrs Beanbag View Post
i do really like the idea of managed code, but it does tie you down to writing in particular supported languages. So no Asm!

Although i have been wondering lately about the possibility of safer instruction set architectures. Perhaps it would be an easy mod of 68k to, for instance, forbid address register indirect modes if the relevant address register is zero (including lea instructions).
Ummm... You do realize you can make up your own macros in Assembly in such a way that there is a debug and release version of the macros, don't you? Also remember that the '020+ has exception vectors specifically for the purpose of range checks and such.

To check the address of an array lookup of type long for range validity, you do something like this on 68020+:
CHK.W #ARRAY_MAX,D0 ; range check
TST.L A0 ; null check
MOVE.L (A0,D0.W*4),D1 ; actual load with scaling address mode
Of course, the trap vectors must be initialized in a debugger or runtime library for these opcodes to be useful. Also, if the index is an immediate value, it can be constant folded for efficiency. Likewise, redundant null checks can be removed via dead-code elimination as well.
Samurai_Crow is offline  
Page generated in 0.04581 seconds with 10 queries