![]() | ![]() | ![]() | Generating Code for Procedures |
< Code to pass parameter values > | |
JSR | proc-name |
proc-name | LINK | A6,#-<local variable space size> |
< Code for procedure body > | ||
UNLK | ||
RTD | #-param-count |
target.method( ... )where it is obvious that the interpretation of "method" may depend on the type of the object currently associated with the variable "target" (which can be any subclass of the type of "target").
meth( ... )since the object executing the method that contains such a simple invocation may be a member of a subclass of the class in which that method's definition was written. In that case, you again have to use the object's method table in case "meth" has been overridden.
Note: If you are just dying to do something clever to improve the quality of the code you produce you should observe that it is safe to skip the method table if the class containing the method being invoked has no subclasses or if none of the subclasses override the method.
meth( ... )in which "meth" is defined in the same class as the method that contains the invocation, this actually isn't an issue since the active object isn't changed so A5 should remain the same.
meth( ... )in which meth is defined in a surrounding class definition (i.e. scope rules rule), you have to follow the chain of static links stored in objects to get "up" to the object corresponding to the class in which the method was defined.
expr.meth( ... )the object produced by "expr" becomes the active object.
meth( ... )you should modify the syntax tree by turning this into a subtree for an expression of the form
expr.meth( ... )where "expr" is a chain of refvar nodes that loads the needed values from the chain of static links. I said "goofed" in this case because if you try to do this during code generation instead of during the binding phase you will discover that you don't have enough information. The level information in a method's decldesc cannot be used to decide if a method is non-local (since it might have been inherited). You have to instead use the level information in binding stack entries (which are no longer accessible during code generation).
![]() | ![]() | ![]() | Generating Code for Procedures |