Top Description Inners Fields Constructors Methods
org.jruby.specialized

public Class RubyObjectSpecializer

extends Object
Class Inheritance
Imports
me.qmx.jitescript.CodeBlock, .JDKVersion, .JiteClass, org.jruby.Ruby, .RubyClass, .RubyObject, org.jruby.runtime.Helpers, .ObjectAllocator, org.jruby.runtime.builtin.IRubyObject, org.jruby.util.cli.Options, org.jruby.util.collections.NonBlockingHashMapLong, org.objectweb.asm.Label, org.objectweb.asm.tree.LabelNode, java.lang.invoke.MethodHandles, java.nio.file.Files, .Paths, java.util.Set

A code generator for Ruby objects, to map known instance variables into fields.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final String
public static final MethodHandles.Lookup
private final Ruby
private final NonBlockingHashMapLong<RubyObjectSpecializer.ClassAndAllocator>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static String
private Class<T>
private Class<T>
generateInternal(final String clsPath, int size)

private static JiteClass
generateJiteClass(String clsPath, int size)

private RubyObjectSpecializer.ClassAndAllocator
generateSpecializedRubyObject(String className, int size, boolean cache)

private static String
genericClassName(int size)

private static void
genGetSwitch(String clsPath, int size, CodeBlock block, int offsetVar)

private static void
genPutSwitch(String clsPath, int size, CodeBlock block, int offsetVar)

private RubyObjectSpecializer.ClassAndAllocator
getClassForSize(int size)

public static void
main(String[] args)

Emit all generic RubyObject specializations to disk, so they do not need to generate at runtime.

public ObjectAllocator
specializeForVariables(RubyClass klass, Set<String> foundVariables)

private static String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

GENERATED_PACKAGEback to summary
private static final String GENERATED_PACKAGE
LOOKUPback to summary
public static final MethodHandles.Lookup LOOKUP
runtimeback to summary
private final Ruby runtime
specializedClassesback to summary
private final NonBlockingHashMapLong<RubyObjectSpecializer.ClassAndAllocator> specializedClasses

Constructor Detail

RubyObjectSpecializerback to summary
public RubyObjectSpecializer(Ruby runtime)

Method Detail

classNameFromJiteClassback to summary
private static String classNameFromJiteClass(JiteClass jiteClass)
defineClassback to summary
private Class<T> defineClass(JiteClass jiteClass)
generateInternalback to summary
private Class<T> generateInternal(final String clsPath, int size)
generateJiteClassback to summary
private static JiteClass generateJiteClass(String clsPath, int size)
generateSpecializedRubyObjectback to summary
private RubyObjectSpecializer.ClassAndAllocator generateSpecializedRubyObject(String className, int size, boolean cache)
genericClassNameback to summary
private static String genericClassName(int size)
genGetSwitchback to summary
private static void genGetSwitch(String clsPath, int size, CodeBlock block, int offsetVar)
genPutSwitchback to summary
private static void genPutSwitch(String clsPath, int size, CodeBlock block, int offsetVar)
getClassForSizeback to summary
private RubyObjectSpecializer.ClassAndAllocator getClassForSize(int size)
mainback to summary
public static void main(String[] args) throws Throwable

Emit all generic RubyObject specializations to disk, so they do not need to generate at runtime.

specializeForVariablesback to summary
public ObjectAllocator specializeForVariables(RubyClass klass, Set<String> foundVariables)
uniqueClassNameback to summary
private static String uniqueClassName(RubyClass klass)
org.jruby.specialized back to summary

pack-priv Class RubyObjectSpecializer.ClassAndAllocator

extends Object
Class Inheritance
  • java.lang.Object
  • org.jruby.specialized.RubyObjectSpecializer.ClassAndAllocator

Field Summary

Modifier and TypeField and Description
pack-priv final ObjectAllocator
pack-priv final Class<T>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

allocatorback to summary
pack-priv final ObjectAllocator allocator
clsback to summary
pack-priv final Class<T> cls

Constructor Detail

ClassAndAllocatorback to summary
pack-priv ClassAndAllocator(Class<T> cls, ObjectAllocator allocator)