codegen: approx. initial codebuffer size according to codesize @ bytecode
[mate.git] / Mate / MethodPool.hs
index c8cb0848499f9ab74c4b1b828397c218b7037107..5a0f70e73605fa0e256cfcea9b925cbddd2d1520 100644 (file)
@@ -136,7 +136,8 @@ compileBB rawmethod methodinfo = do
 
   cls <- getClassFile (methClassName methodinfo)
   let ebb = emitFromBB cls rawmethod
-  (_, Right right) <- runCodeGen ebb () ()
+  let cgconfig = defaultCodeGenConfig { codeBufferSize = fromIntegral $ (rawCodeLength rawmethod) * 32 }
+  (_, Right right) <- runCodeGenWithConfig ebb () () cgconfig
 
   let ((entry, _, _, new_tmap), _) = right
   setTrapMap $ tmap `M.union` new_tmap -- prefers elements in tmap