Permalink
Browse files

Handle fnegate INSN

Which appears to be the last unhandled instruction
Hooray!
  • Loading branch information...
1 parent 6378f31 commit e4a32f0d7200ab7963e80e1e8366b7b2eac2d0ff @krestenkrab krestenkrab committed Sep 23, 2013
Showing with 17 additions and 2 deletions.
  1. +17 −2 src/main/java/erjang/beam/analysis/BeamTypeAnalysis.java
@@ -453,6 +453,21 @@ private void accept_2(BlockVisitor2 vis, BeamExceptionHandler exh) {
break;
}
+ case fnegate: {
+ Insn.LSD insn = (Insn.LSD)insn_;
+ EAtom name = opcode.symbol;
+ int failLabel = decode_labelref(insn.label, type_map.exh);
+ Arg[] in = new Arg[] {src_arg(insn_idx, insn.src)};
+ Type[] inTypes = new Type[] {in[0].type};
+ Arg out = dest_arg(insn_idx, insn.dest);
+
+ BuiltInFunction bif = BIFUtil.getMethod("erlang", name.getName(), inTypes,
+ failLabel != 0, true);
+
+ vis.visitInsn(opcode, failLabel, in, out, bif);
+ break;
+ }
+
case fconv:
case fmove:
case move: {
@@ -1069,8 +1084,8 @@ private void accept_2(BlockVisitor2 vis, BeamExceptionHandler exh) {
vis.visitBitStringAppend(opcode, decode_labelref(insn.label, type_map.exh), extra_size, src, unit, flags, dst);
break;
}
- default:
- throw new Error("unhandled insn: " + insn_.toSymbolicTuple());
+ //default:
+ // throw new Error("unhandled insn: " + insn_.toSymbolicTuple());
}
}

0 comments on commit e4a32f0

Please sign in to comment.