org.nlogo.generate

Members list

Type members

Classlikes

abstract class AbstractPeepholeOptimizer(mv: MethodVisitor) extends MethodVisitor

Attributes

Source
AbstractPeepholeOptimizer.scala
Supertypes
class MethodVisitor
class Object
trait Matchable
class Any
Known subtypes
object BytecodeUtils

Attributes

Source
BytecodeUtils.scala
Supertypes
class Object
trait Matchable
class Any
Self type
class CustomClassLoader(normalClassLoader: ClassLoader) extends ClassLoader

Attributes

Source
CustomClassLoader.scala
Supertypes
class ClassLoader
class Object
trait Matchable
class Any
class CustomGenerator(profilingEnabled: Boolean)

Attributes

Source
CustomGenerator.scala
Supertypes
class Object
trait Matchable
class Any
class DisassemblyThunk(bytecode: Array[Byte]) extends Thunk[String]

Attributes

Source
DisassemblyThunk.scala
Supertypes
class Thunk[String]
class Object
trait Matchable
class Any
class EmptyClassVisitor extends ClassVisitor

Attributes

Source
EmptyVisitor.scala
Supertypes
class ClassVisitor
class Object
trait Matchable
class Any
class EmptyFieldVisitor extends FieldVisitor

Attributes

Source
EmptyVisitor.scala
Supertypes
class FieldVisitor
class Object
trait Matchable
class Any
class EmptyMethodVisitor extends MethodVisitor

Attributes

Source
EmptyVisitor.scala
Supertypes
class MethodVisitor
class Object
trait Matchable
class Any
abstract class GeneratedCommand extends Command, GeneratedInstruction

Attributes

Source
GeneratedInstruction.scala
Supertypes
class Command
class Instruction
trait TokenHolder
class InstructionJ
class Object
trait Matchable
class Any
Show all

Attributes

Source
GeneratedInstruction.scala
Supertypes
class Instruction
trait TokenHolder
class InstructionJ
class Object
trait Matchable
class Any
Show all
Known subtypes

Attributes

Source
GeneratedInstruction.scala
Supertypes
class Reporter
class Instruction
trait TokenHolder
class InstructionJ
class Object
trait Matchable
class Any
Show all
object Generator

Attributes

Companion
class
Source
Generator.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Generator.type
class Generator(procedure: Procedure, profilingEnabled: Boolean) extends GeneratorInterface

Attributes

Companion
object
Source
Generator.scala
Supertypes
class Object
trait Matchable
class Any
class GeneratorAdapter(mv: MethodVisitor, access: Int, name: String, desc: String, igen: Generator#InstructionGenerator[_]) extends GeneratorAdapter

Attributes

Source
GeneratorAdapter.scala
Supertypes
class GeneratorAdapter
class LocalVariablesSorter
class MethodVisitor
class Object
trait Matchable
class Any
Show all
class MethodRipper(method: Method, instr: Instruction, mvOut: MethodVisitor, bgen: Generator#InstructionGenerator[_], instrUID: Int)

Attributes

Source
MethodRipper.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Source
MethodSelector.scala
Supertypes
class Object
trait Matchable
class Any
Self type
class PeepholeOptimizer1(mv: MethodVisitor) extends AbstractPeepholeOptimizer

Attributes

Source
PeepholeOptimizer1.scala
Supertypes
class MethodVisitor
class Object
trait Matchable
class Any
class PeepholeOptimizer2(mv: MethodVisitor) extends AbstractPeepholeOptimizer

Attributes

Source
PeepholeOptimizer2.scala
Supertypes
class MethodVisitor
class Object
trait Matchable
class Any

This class serves as a peep-hole optimizer. Its purpose is just to catch one specific inefficient pattern of bytecode that the inliner generates -- the needless STORE / LOAD combination.

This class serves as a peep-hole optimizer. Its purpose is just to catch one specific inefficient pattern of bytecode that the inliner generates -- the needless STORE / LOAD combination.

IMPORTANT: This class is tricky, because the inefficient pattern we want to replace is not always safe to replace.

Even if DLOAD is called right after DSTORE, there may be another DLOAD later in the method body. The only way we can safely use this peep-hole optimizer is if we could guarantee that every argument to a report_* method was only referenced once in the bytecode of the method body. PeepholeSafeChecker checks for this. If a report_* or perform_* method is "PeepholeSafe", then a special label (PEEPHOLE_SAFE_FLAG) is inserted into the bytecode by the InstructionGenerator, which this class looks for, to make sure it is safe to perform the transformation.

~Forrest (6/19/2006)

It's looking for patterns like this: DSTORE 4 (L-special) // PEEPHOLE_SAFE_FLAG label L2 LINENUMBER 2 L2 (L3) // extra junk label DLOAD 4 And replacing them with just: L2 LINENUMBER 2 L2 (L3) ~Forrest (6/19/2006)

Attributes

Companion
class
Source
PeepholeOptimizer3.scala
Supertypes
class Object
trait Matchable
class Any
Self type
class PeepholeOptimizer3(mv: MethodVisitor) extends AbstractPeepholeOptimizer

Attributes

Companion
object
Source
PeepholeOptimizer3.scala
Supertypes
class MethodVisitor
class Object
trait Matchable
class Any
class PeepholeOptimizer3B(mv: MethodVisitor) extends MethodVisitor

This class serves as a peep-hole optimizer. Its purpose is just to clean up the PEEPHOLE_FLAG_LABELs that PeepholeOptimizer3 leaves behind. PeepholeOptimizer3 must ALWAYS be used in conjunction with this class, because otherwise we'll end up placing the PEEPHOLE_FLAG_LABEL in multiple places in the method body, which causes a verifier error.

This class serves as a peep-hole optimizer. Its purpose is just to clean up the PEEPHOLE_FLAG_LABELs that PeepholeOptimizer3 leaves behind. PeepholeOptimizer3 must ALWAYS be used in conjunction with this class, because otherwise we'll end up placing the PEEPHOLE_FLAG_LABEL in multiple places in the method body, which causes a verifier error.

It's looking for patterns like this: Label PEEPHOLE_FLAG_LABEL And replacing them with: (nothing)

~Forrest (6/19/2006)

Attributes

Source
PeepholeOptimizer3.scala
Supertypes
class MethodVisitor
class Object
trait Matchable
class Any
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.

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
Supertypes
class Object
trait Matchable
class Any

Cache ClassReader objects to speed up bytecode inlining. Instead of reading in the bytes for each of the _prim classes each time, using a getResourceAsStream() call, we keep a cache of the ClassReader objects, which maps classnames to the corresponding ClassReaders. This resulted in a good speedup, though not as much as I had hoped for. ~Forrest (7/9/2006)

Cache ClassReader objects to speed up bytecode inlining. Instead of reading in the bytes for each of the _prim classes each time, using a getResourceAsStream() call, we keep a cache of the ClassReader objects, which maps classnames to the corresponding ClassReaders. This resulted in a good speedup, though not as much as I had hoped for. ~Forrest (7/9/2006)

Attributes

Source
PrimitiveCache.scala
Supertypes
class Object
trait Matchable
class Any
Self type
object TypeConverter

Attributes

Source
TypeConverter.scala
Supertypes
class Object
trait Matchable
class Any
Self type