Class ConstantCache

java.lang.Object
org.jruby.runtime.opto.ConstantCache

public class ConstantCache extends Object
A tuple representing the data needed to verify a cached constant:
  • The value of the constant
  • The generation of the constant's invalidator at the time of caching
  • The constant's invalidator
  • (Optional) the hashcode of the module form which the constant was cache
  • Field Details

    • value

      public final IRubyObject value
    • generation

      public final Object generation
    • invalidator

      public final Invalidator invalidator
    • id

      public final int id
  • Constructor Details

    • ConstantCache

      public ConstantCache(IRubyObject value, Object generation, Invalidator invalidator, int targetHash)
      Construct a new ConstantCache with the given elements.
      Parameters:
      value -
      generation -
      invalidator -
      targetHash -
    • ConstantCache

      public ConstantCache(IRubyObject value, Object generation, Invalidator invalidator)
      Construct a new ConstantCache with the given elements.
      Parameters:
      value -
      generation -
      invalidator -
  • Method Details

    • isCachedFrom

      public static boolean isCachedFrom(RubyModule target, ConstantCache cache)
      Check if the given ConstantCache is non-null and valid, given the target module. This method is static to ensure it is inlinable as trivially as possible.
    • isCached

      public static boolean isCached(ConstantCache cache)
      Check if the given ConstantCache is non-null and valid. This method is static to ensure it is inlinable as trivially as possible.