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


Java StackSize.getSize方法代码示例

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


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

示例1: drainStack

import net.bytebuddy.implementation.bytecode.StackSize; //导入方法依赖的package包/类
/**
 * Drains the stack to only contain the top value. For this, the value on top of the stack is temporarily stored
 * in the local variable array until all values on the stack are popped off. Subsequently, the top value is pushed
 * back onto the operand stack.
 *
 * @param store The opcode used for storing the top value.
 * @param load  The opcode used for loading the top value.
 * @param size  The size of the value on top of the operand stack.
 * @return The minimal size of the local variable array that is required to perform the operation.
 */
public int drainStack(int store, int load, StackSize size) {
    int difference = current.get(current.size() - 1).getSize() - size.getSize();
    if (current.size() == 1 && difference == 0) {
        return 0;
    } else {
        super.visitVarInsn(store, freeIndex);
        if (difference == 1) {
            super.visitInsn(Opcodes.POP);
        } else if (difference != 0) {
            throw new IllegalStateException("Unexpected remainder on the operand stack: " + difference);
        }
        doDrain(current.subList(0, current.size() - 1));
        super.visitVarInsn(load, freeIndex);
        return freeIndex + size.getSize();
    }
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:27,代码来源:StackAwareMethodVisitor.java

示例2: resolveSize

import net.bytebuddy.implementation.bytecode.StackSize; //导入方法依赖的package包/类
@Override
protected Size resolveSize(StackSize fieldSize) {
    int sizeChange = fieldSize.getSize() - targetSizeChange;
    return new Size(sizeChange, sizeChange);
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:6,代码来源:FieldAccess.java

示例3: MethodInvocationTest

import net.bytebuddy.implementation.bytecode.StackSize; //导入方法依赖的package包/类
public MethodInvocationTest(StackSize stackSize) {
    this.stackSize = stackSize;
    this.expectedSize = stackSize.getSize() - ARGUMENT_STACK_SIZE;
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:5,代码来源:MethodInvocationTest.java


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