The present invention provides systems and methods for providing run-time type
checking to prevent software errors. In architecture, a representative system includes
a compiler that parses a program and further comprises a logic that generates a
checksum for a block of code in the program, a logic that stores the checksum in
the block of code, and a logic that inserts checksum instruction code into the
block of code. The present invention can also be viewed as a method for providing
run-time type checking to prevent software errors. A representative method operates
by generating a checksum for a block of code in the program, and storing the checksum
in the block of code. During execution of the program, a run-time checksum is generated
for the block of code, and the block of code is executed if the checksum equals
the run-time checksum, and the execution of the block of code is skipped if the
checksum does not equals the run-time checksum.