11.4. Run Time Support.   

Some languages provide run time support to check compatibility between arguments and corresponding procedure parameter specifications (number, type, kind, etc). Does Java need this?

Most modern languages do not require this because nearly all

checking can be done once only at compile time. FORTRAN needs
runtime checking above because subroutines can be compiled
separately but routine checking is rarely done because of
efficiency reasons.

The cost of a procedure call can be higher than suspected since it is the cost of all the code of the summarised actions given above. Minimising this cost is minimising the execution cost. In order to minimise object program size, as many as possible of the overhead tasks should be performed in the called procedure rather than in the code which occurs before the CALL instruction. Why?

Since there are never more procedure declarations than there

are procedure calls in the source program, shortening the call
at the expense of the procedure body will lead to a smaller
object program.

Another form of runtime support can be in catching errors such as:

divide by zero, array bounds error, enumerated type checking,
stack overflow, integer and floating point overflows.

Many new computers/microprocessors have hardware facilities which help catch these errors.

Most computers will have error traps (like interrupts or Exceptions)

which are caused by division by 0, integer and floating overflow.
Runtime support can catch these errors and report to user.

Micro's like the Motorola 68000 have single instructions which can be used to check on array access: if the address is outside a valid range then an error trap occurs. In a similar way, stack overflow errors, i.e. the STACK grows too large, can be caught and the user suitably informed.

Since an enumerated type has an ord value = integer ranging
from 0->MAXSIZE,it would be necessary to check if<0 or>MAXSIZE,
BUT this can be done at compile time. Subranges are different
since if:
i:0..150
then i 12 )checked i j ) run time check
i 200 )at compile input(i) ) needed
time j is integer and is only legal
if 0 < j < 150 .