Record Class Methods.Inv<MR extends Types.BType,SN extends Emitter.Next,MN extends Emitter.Next>

java.lang.Object
java.lang.Record
ghidra.pcode.emu.jit.gen.util.Methods.Inv<MR,SN,MN>
Type Parameters:
MR - the return type
SN - the contents of the JVM stack
MN - the unmatched parameters types remaining
Record Components:
em - the emitter, which will be given back when the invocation check is complete
Enclosing interface:
Methods

public static record Methods.Inv<MR extends Types.BType,SN extends Emitter.Next,MN extends Emitter.Next>(Emitter<SN extends Emitter.Next> em) extends Record
An invocation object to facilitate the checked popping of arguments for a static method invocation and the final push of its returned value.
  • Constructor Details

    • Inv

      public Inv(Emitter<SN> em)
      Creates an instance of a Inv record class.
      Parameters:
      em - the value for the em record component
  • Method Details

    • takeArg

      public static <P1 extends Types.BNonVoid, A1 extends P1, MR extends Types.BType, MN1 extends Emitter.Next, MN0 extends Emitter.Ent<MN1, P1>, SN1 extends Emitter.Next, SN0 extends Emitter.Ent<SN1, A1>> Methods.Inv<MR,SN1,MN1> takeArg(Methods.Inv<MR,SN0,MN0> inv)
      Pop an argument and match/check it against the next (right-most unmatched) parameter

      NOTE: This will not work for polymorphic arguments. For ref-typed arguments, use takeRefArg(Inv).

      Type Parameters:
      P1 - the parameter type popped from the remaining parameter types
      A1 - the argument type popped from the stack contents
      MR - the return type
      MN1 - the new remaining parameter types
      MN0 - the current parameter types having the popped parameter on top
      SN1 - the new remaining stack contents
      SN0 - the current stack contents having the popped argument on top
      Parameters:
      inv - the invocation object
      Returns:
      the invocation object with remaining parameters and stack contents
    • takeQArg

      public static <MR extends Types.BType, SN1 extends Emitter.Next, SN0 extends Emitter.Ent<SN1, ?>> Methods.Inv<MR,SN1,?> takeQArg(Methods.Inv<MR,SN0,?> inv)
      Pop an argument and a parameter without checking

      NOTE: This should only be used with Methods.MthDesc.reflect(Method). When dealing with a parameter list whose length is only known at runtime, recursion should be favored, so that each argument pushed by the emitter is provably paired with a parameter denoted by calling this method.

      Type Parameters:
      MR - the return type
      SN1 - the new remaining stack contents
      SN0 - the current stack contents having the popped argument on top
      Parameters:
      inv - the invocation object
      Returns:
      the invocation object with remaining parameters and stack contents
    • takeRefArg

      public static <PT, AT extends PT, P1 extends Types.TRef<PT>, A1 extends Types.TRef<AT>, MR extends Types.BType, MN1 extends Emitter.Next, MN0 extends Emitter.Ent<MN1, P1>, SN1 extends Emitter.Next, SN0 extends Emitter.Ent<SN1, A1>> Methods.Inv<MR,SN1,MN1> takeRefArg(Methods.Inv<MR,SN0,MN0> inv)
      Pop a polymorphic reference argument and match/check it against the next (right-most unmatched parameter)
      Type Parameters:
      PT - the parameter's object type
      AT - the argument's object type
      P1 - the parameter type popped from the remaining parameter types
      A1 - the argument type popped from the stack contents
      MR - the return type
      MN1 - the new remaining parameter types
      MN0 - the current parameter types having the popped parameter on top
      SN1 - the new remaining stack contents
      SN0 - the current stack contents having the popped argument on top
      Parameters:
      inv - the invocation object
      Returns:
      the invocation object with remaining parameters and stack contents
    • takeArg

      public static <OT, P1 extends Types.BNonVoid, A1 extends P1, MR extends Types.BType, MN1 extends Emitter.Next, MN0 extends Emitter.Ent<MN1, P1>, SN1 extends Emitter.Next, SN0 extends Emitter.Ent<SN1, A1>> Methods.ObjInv<MR,OT,SN1,MN1> takeArg(Methods.ObjInv<MR,OT,SN0,MN0> inv)
      Pop an argument and match/check it against the next (right-most unmatched) parameter

      NOTE: This will not work for polymorphic arguments. For ref-typed arguments, use takeRefArg(ObjInv).

      Type Parameters:
      OT - the method's owning type
      P1 - the parameter type popped from the remaining parameter types
      A1 - the argument type popped from the stack contents
      MR - the return type
      MN1 - the new remaining parameter types
      MN0 - the current parameter types having the popped parameter on top
      SN1 - the new remaining stack contents
      SN0 - the current stack contents having the popped argument on top
      Parameters:
      inv - the invocation object
      Returns:
      the invocation object with remaining parameters and stack contents
    • takeRefArg

      public static <OT, PT, AT extends PT, P1 extends Types.TRef<PT>, A1 extends Types.TRef<AT>, MR extends Types.BType, MN1 extends Emitter.Next, MN0 extends Emitter.Ent<MN1, P1>, SN1 extends Emitter.Next, SN0 extends Emitter.Ent<SN1, A1>> Methods.ObjInv<MR,OT,SN1,MN1> takeRefArg(Methods.ObjInv<MR,OT,SN0,MN0> inv)
      Pop a polymorphic reference argument and match/check it against the next (right-most unmatched parameter)
      Type Parameters:
      OT - the method's owning type
      PT - the parameter's object type
      AT - the argument's object type
      P1 - the parameter type popped from the remaining parameter types
      A1 - the argument type popped from the stack contents
      MR - the return type
      MN1 - the new remaining parameter types
      MN0 - the current parameter types having the popped parameter on top
      SN1 - the new remaining stack contents
      SN0 - the current stack contents having the popped argument on top
      Parameters:
      inv - the invocation object
      Returns:
      the invocation object with remaining parameters and stack contents
    • takeQArg

      public static <OT, MR extends Types.BType, SN1 extends Emitter.Next, SN0 extends Emitter.Ent<SN1, ?>> Methods.ObjInv<MR,OT,SN1,?> takeQArg(Methods.ObjInv<MR,OT,SN0,?> inv)
      Pop an argument and a parameter without checking

      NOTE: This should only be used with Methods.MthDesc.reflect(Method). When dealing with a parameter list whose length is only known at runtime, recursion should be favored, so that each argument pushed by the emitter is provably paired with a parameter denoted by calling this method.

      Type Parameters:
      OT - the method's owning type
      MR - the return type
      SN1 - the new remaining stack contents
      SN0 - the current stack contents having the popped argument on top
      Parameters:
      inv - the invocation object
      Returns:
      the invocation object with remaining parameters and stack contents
    • takeObjRef

      public static <OT, MR extends Types.BType, SN1 extends Emitter.Next, SN0 extends Emitter.Ent<SN1, ? extends Types.TRef<? extends OT>>> Methods.Inv<MR,SN1,Emitter.Bot> takeObjRef(Methods.ObjInv<MR,OT,SN0,Emitter.Bot> inv)
      Pop the object reference from the stack and check it against the owning type

      This must be used, but only once the parameter type list is empty

      Type Parameters:
      OT - the method's owning type
      MR - the return type
      SN1 - the new remaining stack contents
      SN0 - the current stack contents having popped the reference on top
      Parameters:
      inv - the invocation object
      Returns:
      the invocation object with remaining stack contents
    • takeQObjRef

      public static <OT, MR extends Types.BType, SN1 extends Emitter.Next, SN0 extends Emitter.Ent<SN1, ? extends Types.TRef<? extends OT>>> Methods.Inv<MR,SN1,Emitter.Bot> takeQObjRef(Methods.ObjInv<MR,OT,SN0,?> inv)
      Pop the object reference from the stack without checking it

      NOTE: This should only be used with Methods.MthDesc.reflect(Method). This must be used, but only when sufficient arguments have been popped to satisfy the reflected parameters. It is up to the caller to know how many arguments are expected.

      Type Parameters:
      OT - the method's owning type
      MR - the return type
      SN1 - the new remaining stack contents
      SN0 - the current stack contents having popped the reference on top
      Parameters:
      inv - the invocation object
      Returns:
      the invocation object with remaining stack contents
    • retVoid

      public static <SN extends Emitter.Next> Emitter<SN> retVoid(Methods.Inv<Types.TVoid,SN,Emitter.Bot> inv)
      Finish checking an invocation of a static void method
      Type Parameters:
      SN - the stack contents after the invocation
      Parameters:
      inv - the invocation object
      Returns:
      the emitter typed with the resulting stack
    • retQVoid

      public static <SN extends Emitter.Next> Emitter<SN> retQVoid(Methods.Inv<?,SN,?> inv)
      Finish an invocation of a static void method without checking

      NOTE: This should only be used with Methods.MthDesc.reflect(Method).

      Type Parameters:
      SN - the stack contents after the invocation
      Parameters:
      inv - the invocation object
      Returns:
      the emitter typed with the resulting stack
    • ret

      public static <MR extends Types.BNonVoid, SN extends Emitter.Next> Emitter<Emitter.Ent<SN,MR>> ret(Methods.Inv<MR,SN,Emitter.Bot> inv)
      Finish checking an invocation of a static method
      Type Parameters:
      MR - the return type
      SN - the stack contents before pushing the returned result
      Parameters:
      inv - the invocation object
      Returns:
      the emitter typed with the resulting stack, i.e., having pushed the returned value
    • retQ

      public static <RT extends Types.BNonVoid, SN extends Emitter.Next> Emitter<Emitter.Ent<SN,RT>> retQ(Methods.Inv<?,SN,?> inv, RT returnType)
      Finish invocation of a static method without checking

      NOTE: This should only be used with Methods.MthDesc.reflect(Method).

      Type Parameters:
      RT - the asserted return type
      SN - the stack contents before pushing the returned result
      Parameters:
      inv - the invocation object
      returnType - the asserted return type
      Returns:
      the emitter typed with the resulting stack, i.e., having pushed the returned value
    • step

      public <R> R step(Function<? super Methods.Inv<MR,SN,MN>,R> func)
      A syntactic workaround for static method chaining
      Type Parameters:
      R - the return type of func
      Parameters:
      func - the method to invoke
      Returns:
      the return value from func
    • step

      public <R, A1> R step(BiFunction<? super Methods.Inv<MR,SN,MN>,A1,R> func, A1 arg1)
      A syntactic workaround for static method chaining
      Type Parameters:
      R - the return type of func
      A1 - the first argument type of func
      Parameters:
      func - the method to invoke
      arg1 - the first argument to func
      Returns:
      the return value from func
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • em

      public Emitter<SN> em()
      Returns the value of the em record component.
      Returns:
      the value of the em record component