Abstract: Intra-procedural and inter-procedural dynamic type propagation can be used to optimize code by devirtualizing virtual functions. In the intra-procedural pass each function in the program is inspected. If the dynamic type of a variable within the function is determined, the static type is replaced by the dynamic type. If the dynamic type of a variable within the function is not determinable, a placeholder type is inserted. After each function and each statement in the function and each statement outside of the function is examined, an attempt is made to resolve all of the placeholder types references created in the first pass, replacing the placeholder type with the dynamic type. This process is iterated until additional dynamic type determination ends.
Abstract: The invention relates to a method for checking and/or transformation of a computer program present in a programming language which supports first-class functions and in which a type check of the program or of at least a part of the program is performed in order to assign a type to each expression of the program or part of the program, the type consisting of a base type and a binding time. The set of base types comprises at least base types for describing simple values and a function type for describing functions, and the set of binding times comprises at least one static binding time and one dynamic binding time, and a function type is only accepted during the type check together with the static binding time.
Abstract: Optimistically type assumptions in a dynamically typed language may involve a compiler parsing code and detecting a program element that results from an operation of the code that has an unspecified type. In response, the compiler may make a first type assumption treating the element as a first type. The assumed type may be selected from multiple types as expected to have a lowest performance cost of the multiple types. The compiler may generate compiled code using the first (assumed) type. During runtime of the compiled code, it may be detected that the first type assumption is invalid for the compiled code and in response a portion of the compiled code may be replaced with other compiled code. The other compiled code may treat the element according to a second type assumption that may be selected as a type expected to have the second lowest performance cost.