GP-0: Fix EMPTY needs to still include language userops.

This commit is contained in:
Dan
2026-09-23 20:06:31 +00:00
parent aacf846ce7
commit 534dc7cd7b
3 changed files with 7 additions and 15 deletions

View File

@@ -523,8 +523,7 @@ class DecoderExecutor extends FoldingExecutor implements DisassemblerContextAdap
* @param the computed reachability of the source block. Use {@link CtxReach#WITHOUT_CTXMOD} for
* the seed.
*/
private void collectCtxReach(Map<JitBlock, CtxReach> into, JitBlock cur,
CtxReach how) {
private void collectCtxReach(Map<JitBlock, CtxReach> into, JitBlock cur, CtxReach how) {
CtxReach curHow = into.get(cur);
if (blockModifiesContext(cur)) {

View File

@@ -140,7 +140,7 @@ public class PcodeProgram {
throw new IllegalArgumentException("Instruction must be parsed using Sleigh");
}
PcodeOp[] pcode = instruction.getPcode(includeOverrides);
return new PcodeProgram(slang, List.of(pcode), PcodeUseropSymbolMap.EMPTY);
return new PcodeProgram(slang, List.of(pcode), PcodeUseropSymbolMap.empty(slang));
}
/**
@@ -162,8 +162,8 @@ public class PcodeProgram {
InjectContext ctx = library.buildInjectContext();
InjectPayload payload = library.getPayload(type, name);
PcodeOp[] pcode = payload.getPcode(program, ctx);
return new PcodeProgram((SleighLanguage) program.getLanguage(), List.of(pcode),
PcodeUseropSymbolMap.EMPTY);
SleighLanguage language = (SleighLanguage) program.getLanguage();
return new PcodeProgram(language, List.of(pcode), PcodeUseropSymbolMap.empty(language));
}
protected final SleighLanguage language;

View File

@@ -51,17 +51,10 @@ public interface PcodeUseropLibrary<T> {
*/
record PcodeUseropSymbolMap(SleighLanguage language, Map<Integer, UserOpSymbol> byIndex,
Map<String, UserOpSymbol> byName) {
public PcodeUseropSymbolMap {
if (!byIndex.isEmpty() || !byName.isEmpty()) {
Objects.requireNonNull(language);
}
}
/**
* The empty set of symbols
*/
public static final PcodeUseropSymbolMap EMPTY =
new PcodeUseropSymbolMap(null, Map.of(), Map.of());
public static PcodeUseropSymbolMap empty(SleighLanguage language) {
return new PcodeUseropSymbolMap(language, Map.of());
}
private static Map<String, UserOpSymbol> byName(Map<Integer, UserOpSymbol> byIndex) {
return byIndex.values()