gpt4 book ai didi

java - 编译器 asm 字节码表达式

转载 作者:行者123 更新时间:2023-11-30 11:31:42 25 4
gpt4 key购买 nike

如何在不使用新的 JumpInsNode(Opcodes.IF_ICMPEQ) 的情况下计算 asm 字节码中的表达式 2==2

我还想将结果存储在一个变量中。 e.x print (2==2) 结果一定是1

提前致谢。

最佳答案

您可以将两个操作数压入堆栈并应用ixor 指令;如果结果为零,则操作数相等。

bipush 2
bipush 2
ixor // stack holds 0 if operands are equal, nonzero if not equal

您不想使用分支指令的任何特定原因?

关于java - 编译器 asm 字节码表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17023560/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com