LocalOptImpls

dotty.tools.backend.jvm.opt.LocalOptImpls
object LocalOptImpls

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

sealed abstract class RemoveHandlersResult

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Value members

Concrete methods

Compact the local variable slots used in the method's implementation. This prevents having unused slots for example after eliminating unreachable code.

Compact the local variable slots used in the method's implementation. This prevents having unused slots for example after eliminating unreachable code.

This transformation reduces the size of the frame for invoking the method. For example, if the method has an ISTORE instruction to the local variable 3, the maxLocals of the method is at least 4, even if some local variable slots below 3 are not used by any instruction.

This could be improved by doing proper register allocation.

Attributes

def minimalRemoveUnreachableCode(method: MethodNode, ownerClassName: InternalName, callGraph: CallGraph, backendUtils: BackendUtils): Boolean

Remove unreachable code from a method.

Remove unreachable code from a method.

This implementation only removes instructions that are unreachable for an ASM analyzer / interpreter. This ensures that future analyses will not produce null frames. The inliner depends on this property.

Attributes

Returns

A set containing the eliminated instructions

Remove exception handlers that cover empty code blocks. A block is considered empty if it consists only of labels, frames, line numbers, nops and gotos.

Remove exception handlers that cover empty code blocks. A block is considered empty if it consists only of labels, frames, line numbers, nops and gotos.

There are no executable instructions that we can assume don't throw (e.g., ILOAD). The JVM spec basically says that a VirtualMachineError may be thrown at any time: https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.3

Note that no instructions are eliminated.

Returns a pair of booleans (handlerRemoved, liveHandlerRemoved)

The liveHandlerRemoved result depends on removeUnreachableCode being executed before, so that BackendUtils.isLabelReachable gives a correct answer.

Attributes

Removes LineNumberNodes that don't describe any executable instructions.

Removes LineNumberNodes that don't describe any executable instructions.

As a side effect, this traversal removes the LABEL_REACHABLE_STATUS flag from all label's status fields.

This method expects (and asserts) that the start label of each LineNumberNode is the lexically preceding label declaration.

Attributes

def removeUnreachableCodeImpl(method: MethodNode, ownerClassName: InternalName, callGraph: CallGraph, backendUtils: BackendUtils): Boolean

Removes unreachable basic blocks, returns true if instructions were removed.

Removes unreachable basic blocks, returns true if instructions were removed.

When this method returns, each labelNode.getLabel has a status set whether the label is live or not. This can be queried using BackendUtils.isLabelReachable.

Attributes

def removeUnusedLocalVariableNodes(method: MethodNode)(firstLocalIndex: Int = ..., renumber: Int => Int = ...): Boolean

Remove all non-parameter entries from the local variable table which denote variables that are not actually read or written.

Remove all non-parameter entries from the local variable table which denote variables that are not actually read or written.

Note that each entry in the local variable table has a start, end and index. Two entries with the same index, but distinct start / end ranges are different variables, they may have not the same type or name.

Attributes

Apply various simplifications to branching instructions.

Apply various simplifications to branching instructions.

Attributes