public static Term execute(Process proc, Module m, Instruction i, List params) { Integer source1 = i.arg(1).toArg(proc).toInteger(); Integer source2 = i.arg(2).toArg(proc).toInteger(); Integer unit = i.arg(3).toArg(proc).toInteger(); Integer result = source1.add(source2.multiply(unit)); Term destination = i.arg(4); if (destination.isXRegister()) { proc.setX(destination.toRegisterIndex(), result); return null; } else { throw new Error("Not implemented: " + i); } }
public static Term execute(Process proc, Module m, Instruction i, List params) { Tuple tuple = i.arg(0).toArg(proc).toTuple(); List dst = i.arg(2).toList(); while (dst.length() > 0) { Integer arity = dst.head().toInteger(); dst = dst.tail(); Term lbl = dst.head(); if (tuple.arity() == arity.toInt()) { return lbl; } dst = dst.tail(); } return i.arg(1); }
public static Term execute(Process process, Module m, Instruction i, List params) { return i.arg(1); }