Class CallBase

All Implemented Interfaces:
ClosureAcceptingInstr, Site
Direct Known Subclasses:
CallInstr, NoResultCallInstr

public abstract class CallBase extends NOperandInstr implements ClosureAcceptingInstr, Site
  • Field Details

    • callSiteCounter

      public static long callSiteCounter
    • ALL

      private static final EnumSet<FrameField> ALL
    • callSiteId

      public transient long callSiteId
    • callType

      private final CallType callType
    • name

      protected final RubySymbol name
    • callSite

      protected final transient CallSite callSite
    • argsCount

      protected final transient int argsCount
    • hasClosure

      protected final transient boolean hasClosure
    • flagsComputed

      private transient boolean flagsComputed
    • canBeEval

      private transient boolean canBeEval
    • targetRequiresCallersBinding

      private transient boolean targetRequiresCallersBinding
    • targetRequiresCallersFrame

      private transient boolean targetRequiresCallersFrame
    • dontInline

      private transient boolean dontInline
    • splatMap

      private transient boolean[] splatMap
    • procNew

      protected transient boolean procNew
    • potentiallyRefined

      private final boolean potentiallyRefined
    • frameReads

      private transient Set<FrameField> frameReads
    • frameWrites

      private transient Set<FrameField> frameWrites
    • REQUIRED_OPERANDS

      private static final int REQUIRED_OPERANDS
      See Also:
  • Constructor Details

  • Method Details

    • encode

      public void encode(IRWriterEncoder e)
      Overrides:
      encode in class Instr
    • calculateArity

      private int calculateArity()
    • getId

      public String getId()
      raw identifier string (used by method table).
    • getCallSiteId

      public long getCallSiteId()
      Specified by:
      getCallSiteId in interface Site
    • setCallSiteId

      public void setCallSiteId(long callSiteId)
      Specified by:
      setCallSiteId in interface Site
    • getName

      public RubySymbol getName()
    • getClosureArg

      public Operand getClosureArg()
      From interface ClosureAcceptingInstr
      Specified by:
      getClosureArg in interface ClosureAcceptingInstr
    • getClosureArg

      public Operand getClosureArg(Operand ifUnspecified)
    • getReceiver

      public Operand getReceiver()
    • getResult

      public abstract Variable getResult()
    • getArg1

      public Operand getArg1()
      This getter is potentially unsafe if you do not know you have >=1 arguments to the call. It may return null of the closure argument from operands.
    • getArgsCount

      public int getArgsCount()
    • getCallArgs

      public Operand[] getCallArgs()
    • getCallSite

      public CallSite getCallSite()
    • getCallType

      public CallType getCallType()
    • splatMap

      public boolean[] splatMap()
    • setProcNew

      public void setProcNew(boolean procNew)
    • blockInlining

      public void blockInlining()
    • inliningBlocked

      public boolean inliningBlocked()
    • getCallSiteFor

      protected static CallSite getCallSiteFor(IRScope scope, CallType callType, String name, long callsiteId, boolean hasLiteralClosure, boolean potentiallyRefined)
    • hasLiteralClosure

      public boolean hasLiteralClosure()
      Specified by:
      hasLiteralClosure in interface ClosureAcceptingInstr
    • isAllFixnums

      public static boolean isAllFixnums(Operand[] args)
    • isAllFloats

      public static boolean isAllFloats(Operand[] args)
    • isPotentiallyRefined

      public boolean isPotentiallyRefined()
    • computeScopeFlags

      public boolean computeScopeFlags(IRScope scope, EnumSet<IRFlags> flags)
      Description copied from class: Instr
      Does this instruction do anything the scope is interested in?
      Overrides:
      computeScopeFlags in class Instr
      Returns:
      true if it modified the scope or set any flags.
    • setIRFlagsFromFrameFields

      private boolean setIRFlagsFromFrameFields(EnumSet<IRFlags> flags, Set<FrameField> frameFields)
    • simplifyOperands

      public void simplifyOperands(Map<Operand,Operand> valueMap, boolean force)
      Description copied from class: Instr
      This method takes as input a map of operands to their values, and outputs If the value map provides a value for any of the instruction's operands this method is expected to replace the original operands with the simplified values. It is not required that it do so -- code correctness is not compromised by failure to simplify
      Overrides:
      simplifyOperands in class Instr
    • cloneCallArgs

      public Operand[] cloneCallArgs(CloneInfo ii)
    • computeEvalFlag

      private boolean computeEvalFlag()
    • computeRequiresCallersBindingFlag

      private boolean computeRequiresCallersBindingFlag()
    • computeRequiresCallersFrameFlag

      private boolean computeRequiresCallersFrameFlag()
    • potentiallySend

      private static boolean potentiallySend(String name, int argsCount)
    • captureFrameReadsAndWrites

      private void captureFrameReadsAndWrites()
      Determine based on the method name what frame fields it is likely to need.
    • computeFlags

      private void computeFlags()
    • canBeEval

      public boolean canBeEval()
    • targetRequiresCallersBinding

      public boolean targetRequiresCallersBinding()
    • targetRequiresCallersFrame

      public boolean targetRequiresCallersFrame()
    • toStringNonOperandArgs

      public String[] toStringNonOperandArgs()
      Overrides:
      toStringNonOperandArgs in class Instr
    • containsArgSplat

      public static boolean containsArgSplat(Operand[] arguments)
    • arrayifyOperands

      private static Operand[] arrayifyOperands(Operand receiver, Operand[] callArgs, Operand closure)
    • interpret

      public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp)
      Overrides:
      interpret in class Instr
    • prepareArguments

      public IRubyObject[] prepareArguments(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope dynamicScope, Object[] temp)
    • prepareArgumentsSimple

      protected IRubyObject[] prepareArgumentsSimple(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp)
    • prepareArgumentsComplex

      protected IRubyObject[] prepareArgumentsComplex(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp)
    • prepareBlock

      public Block prepareBlock(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp)