当前位置: 首页>>代码示例>>Java>>正文


Java MethodDescription.getStackSize方法代码示例

本文整理汇总了Java中net.bytebuddy.description.method.MethodDescription.getStackSize方法的典型用法代码示例。如果您正苦于以下问题:Java MethodDescription.getStackSize方法的具体用法?Java MethodDescription.getStackSize怎么用?Java MethodDescription.getStackSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.bytebuddy.description.method.MethodDescription的用法示例。


在下文中一共展示了MethodDescription.getStackSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: apply

import net.bytebuddy.description.method.MethodDescription; //导入方法依赖的package包/类
public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext,
    MethodDescription instrumentedMethod) {

  checkMethodSignature(instrumentedMethod);

  try {
    StackManipulation stack = buildStack();
    StackManipulation.Size finalStackSize = stack.apply(methodVisitor, implementationContext);

    return new Size(finalStackSize.getMaximalSize(),
        instrumentedMethod.getStackSize() + 2); // 2 stack slots for a single local variable

  } catch (NoSuchMethodException | NoSuchFieldException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:bramp,项目名称:unsafe,代码行数:17,代码来源:CopierImplementation.java

示例2: apply

import net.bytebuddy.description.method.MethodDescription; //导入方法依赖的package包/类
@Override
public Size apply(
    MethodVisitor methodVisitor,
    Context implementationContext,
    MethodDescription instrumentedMethod) {
  Map<String, FieldDescription> fieldsByName = CodeGenUtil.fieldsByName(implementationContext);
  StackManipulation.Size operandStackSize =
      new StackManipulation.Compound(
              new TextConstant(unserializedFieldValue),
              SerializeSupport_serializeString,
              FieldAccess.forField(fieldsByName.get(fieldName)).write())
          .apply(methodVisitor, implementationContext);
  return new Size(operandStackSize.getMaximalSize(), instrumentedMethod.getStackSize());
}
 
开发者ID:curioswitch,项目名称:curiostack,代码行数:15,代码来源:SetSerializedFieldName.java

示例3: appender

import net.bytebuddy.description.method.MethodDescription; //导入方法依赖的package包/类
@Override
public ByteCodeAppender appender(final Target implementationTarget) {
  return new ByteCodeAppender() {
    @Override
    public Size apply(
        MethodVisitor methodVisitor,
        Context implementationContext,
        MethodDescription instrumentedMethod) {
      StackManipulation.Size size =
          new StackManipulation.Compound(
                  // Load the this reference
                  MethodVariableAccess.REFERENCE.loadFrom(0),
                  // Load the delegate argument
                  MethodVariableAccess.REFERENCE.loadFrom(1),
                  // Invoke the super constructor (default constructor of Object)
                  MethodInvocation.invoke(
                      new TypeDescription.ForLoadedType(DoFnInvokerBase.class)
                          .getDeclaredMethods()
                          .filter(
                              ElementMatchers.isConstructor()
                                  .and(ElementMatchers.takesArguments(DoFn.class)))
                          .getOnly()),
                  // Return void.
                  MethodReturn.VOID)
              .apply(methodVisitor, implementationContext);
      return new Size(size.getMaximalSize(), instrumentedMethod.getStackSize());
    }
  };
}
 
开发者ID:apache,项目名称:beam,代码行数:30,代码来源:ByteBuddyDoFnInvokerFactory.java

示例4: appender

import net.bytebuddy.description.method.MethodDescription; //导入方法依赖的package包/类
@Override
public ByteCodeAppender appender(final Target implementationTarget) {
  return new ByteCodeAppender() {
    @Override
    public Size apply(
        MethodVisitor methodVisitor,
        Context implementationContext,
        MethodDescription instrumentedMethod) {
      StackManipulation.Size size =
          new StackManipulation.Compound(
                  // Load the this reference
                  MethodVariableAccess.REFERENCE.loadFrom(0),
                  // Invoke the super constructor (default constructor of Object)
                  MethodInvocation.invoke(
                      new TypeDescription.ForLoadedType(Object.class)
                          .getDeclaredMethods()
                          .filter(
                              ElementMatchers.isConstructor()
                                  .and(ElementMatchers.takesArguments(0)))
                          .getOnly()),
                  // Load the this reference
                  MethodVariableAccess.REFERENCE.loadFrom(0),
                  // Load the delegate argument
                  MethodVariableAccess.REFERENCE.loadFrom(1),
                  // Assign the delegate argument to the delegate field
                  FieldAccess.forField(
                          implementationTarget
                              .getInstrumentedType()
                              .getDeclaredFields()
                              .filter(ElementMatchers.named(FN_DELEGATE_FIELD_NAME))
                              .getOnly())
                      .write(),
                  // Return void.
                  MethodReturn.VOID)
              .apply(methodVisitor, implementationContext);
      return new Size(size.getMaximalSize(), instrumentedMethod.getStackSize());
    }
  };
}
 
开发者ID:apache,项目名称:beam,代码行数:40,代码来源:ByteBuddyOnTimerInvokerFactory.java

示例5: apply

import net.bytebuddy.description.method.MethodDescription; //导入方法依赖的package包/类
@Override
public final ByteCodeAppender.Size apply(MethodVisitor mv, Implementation.Context ctx, MethodDescription method) {
    StackManipulation.Size size = sm.apply(mv, ctx);
    return new ByteCodeAppender.Size(size.getMaximalSize(), method.getStackSize());
}
 
开发者ID:project-avral,项目名称:oo-atom,代码行数:6,代码来源:BtGenerateMethod.java


注:本文中的net.bytebuddy.description.method.MethodDescription.getStackSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。