basicblock: annotate BBs with exceptions
[mate.git] / Mate / Types.hs
index 060ffb7403e3d1e036bbec9cedbc97eab3659288..de17e3780aa4cf8c695e72ce4a6891fb505a64e8 100644 (file)
@@ -42,6 +42,7 @@ type BlockID = Int
 -- Represents a CFG node
 data BasicBlock = BasicBlock {
   code :: [Instruction],
+  exception :: B.ByteString,
   successor :: BBEnd }
 
 -- describes (leaving) edges of a CFG node
@@ -67,12 +68,15 @@ data RawMethod = RawMethod {
 type TrapMap = M.Map NativeWord TrapCause
 
 type TrapPatcher = CPtrdiff -> CodeGen () () CPtrdiff
+type TrapPatcherEax = CPtrdiff -> CPtrdiff -> CodeGen () () CPtrdiff
+type TrapPatcherEsp = TrapPatcherEax
 
 data TrapCause
-  = StaticMethod MethodInfo -- for static calls
+  = StaticMethod TrapPatcher -- for static calls
   | VirtualCall Bool MethodInfo (IO NativeWord) -- for invoke{interface,virtual}
-  | InstanceOf B.ByteString -- class name
-  | NewObject B.ByteString -- class name
+  | InstanceOf TrapPatcherEax
+  | ThrowException TrapPatcherEsp
+  | NewObject TrapPatcher
   | StaticField StaticFieldInfo
   | ObjectField TrapPatcher