Skip to content

Commit b9d33a2

Browse files
committed
Modify JavaHelper.ts and cseMachine/java/components/Control.tsx to be able to run conditional expressions on the CSEC machine
1 parent 5024596 commit b9d33a2

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/commons/utils/JavaHelper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export async function javaRun(
112112
try {
113113
const binaryWriter = new BinaryWriter();
114114
const classes = compileFromSource(javaCode);
115+
console.debug(classes)
115116
classes.forEach(c => {
116117
compiled[c.className + '.class']
117118
= Buffer.from(binaryWriter.generateBinary(c.classFile)).toString('base64');

src/features/cseMachine/java/components/Control.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ export class Control extends Visible {
128128
return `res ${resInstr.name}`;
129129
case ECE.InstrType.DEREF:
130130
return 'deref';
131+
case ECE.InstrType.COND:
132+
return `cond`;
131133
default:
132134
return 'INSTRUCTION';
133135
}
@@ -188,6 +190,8 @@ export class Control extends Visible {
188190
return `Resolve field ${resInstr.name} of most recently pushed value from stash`;
189191
case ECE.InstrType.DEREF:
190192
return 'Dereference most recently pushed value from stash';
193+
case ECE.InstrType.COND:
194+
return 'Evaluate condition and push either consequent or alternative to stash';
191195
default:
192196
return 'INSTRUCTION';
193197
}

0 commit comments

Comments
 (0)