docs: 优化 CmpJumpGenerator 的代码注释
- 移除了类注释中的多余空行和标点符号 - 调整了代码缩进,保持一致性 - 删除了不必要的注释,使代码更清晰
This commit is contained in:
parent
5177d00dce
commit
82069629dd
@ -11,14 +11,14 @@ import org.jcnc.snow.compiler.ir.value.IRVirtualRegister;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>条件比较跳转指令生成器</b>
|
* 条件比较跳转指令生成器
|
||||||
* <p>
|
* <p>
|
||||||
* 该类实现了 {@link InstructionGenerator} 接口,
|
* 该类实现了 {@link InstructionGenerator} 接口,
|
||||||
* 负责将 IR 中的 {@link IRCompareJumpInstruction}(条件比较并跳转指令)
|
* 负责将 IR 中的 {@link IRCompareJumpInstruction}(条件比较并跳转指令)
|
||||||
* 转换为目标虚拟机(VM)可执行的指令序列。
|
* 转换为目标虚拟机(VM)可执行的指令序列。
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <b>主要功能</b>
|
* 主要功能
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>根据 IR 比较指令左右操作数的类型,自动进行类型提升与转换</li>
|
* <li>根据 IR 比较指令左右操作数的类型,自动进行类型提升与转换</li>
|
||||||
* <li>生成相应的 VM 加载、类型转换、比较与跳转指令</li>
|
* <li>生成相应的 VM 加载、类型转换、比较与跳转指令</li>
|
||||||
@ -60,7 +60,7 @@ public class CmpJumpGenerator implements InstructionGenerator<IRCompareJumpInstr
|
|||||||
// 1. 获取左右操作数的槽位与静态类型
|
// 1. 获取左右操作数的槽位与静态类型
|
||||||
int leftSlot = slotMap.get(ins.left());
|
int leftSlot = slotMap.get(ins.left());
|
||||||
int rightSlot = slotMap.get(ins.right());
|
int rightSlot = slotMap.get(ins.right());
|
||||||
char lType = out.getSlotType(leftSlot); // 若未登记则默认 'I'
|
char lType = out.getSlotType(leftSlot);
|
||||||
char rType = out.getSlotType(rightSlot);
|
char rType = out.getSlotType(rightSlot);
|
||||||
char tType = TypePromoteUtils.promote(lType, rType); // 公共类型提升
|
char tType = TypePromoteUtils.promote(lType, rType); // 公共类型提升
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user