new insn: fix wrong behaviour on lazy class init
[mate.git] / Mate / ClassPool.hs
index e6c5bfef8d333b2650755be78844b47021ff8809..88749995a59e7e5b95e7f7f40f73a5bb923d7a55 100644 (file)
@@ -3,6 +3,7 @@
 #include "debug.h"
 module Mate.ClassPool (
   getClassInfo,
+  classLoaded,
   getClassFile,
   getMethodTable,
   getObjectSize,
@@ -58,6 +59,11 @@ getClassInfo path = do
     Nothing -> loadAndInitClass path
     Just ci -> return ci
 
+classLoaded :: B.ByteString -> IO Bool
+classLoaded path = do
+  class_map <- getClassMap
+  return $ M.member path class_map
+
 getClassFile :: B.ByteString -> IO (Class Direct)
 getClassFile path = do
   ci <- getClassInfo path