PeepholeSafeChecker

org.nlogo.generate.PeepholeSafeChecker
class PeepholeSafeChecker(profilingEnabled: Boolean)

A report_* or perform_* method of a prim is Peephole-Safe if it references each argument at most once. A method with no arguments is trivially PeepholeSafe. This class maintains a table of the Peephole-Safe status of each report* and perform_* method, by checking them the first time a prim's class is used for inlining.

Examples: A _prim with this report method is PeepholeSafe: double report_1(Context context, double arg0, double arg1) { return arg0 + arg1; } A _prim with this report method is NOT PeepholeSafe: double report_1(Context context, double arg0, double arg1) { if (arg1 != 0.0) { return arg0 / arg1; ... } PeepholeSafety actually refers to safety with regard to just one type of peephole optimization, the redundant STORE/LOAD pattern, which is found in [[PeepholeOptimizer3]]. The other PeepholeOptimizers will be run regardless.

Attributes

Source
PeepholeSafeChecker.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def isSafe(m: Method): Boolean

Attributes

Source
PeepholeSafeChecker.scala