-executeMain bclspath cls = do
- hmap <- parseMethod cls "main"
- case hmap of
- Just hmap' -> do
- let methods = classMethods cls; methods :: [Method Direct]
- let method = find (\x -> methodName x == "main") methods
- case method of
- Just m -> do
- let mi = MethodInfo "main" bclspath $ methodSignature m
- entry <- compileBB hmap' mi
- addMethodRef entry mi [bclspath]
-#ifdef DEBUG
- printf "executing `main' now:\n"
-#endif
- executeFuncPtr entry
- Nothing -> error "main not found"
+executeMain bclspath cls = do
+ initGC --required on some platforms. [todo bernhard: maybe this should be moved somewhere else - maybe at a global place where vm initialization takes place
+
+ let methods = classMethods cls; methods :: [Method Direct]
+ case find (\x -> methodName x == "main") methods of
+ Just m -> do
+ let mi = MethodInfo "main" bclspath $ methodSignature m
+ rawmethod <- parseMethod cls "main" $ methodSignature m
+ entry <- compileBB mi rawmethod mi
+ addMethodRef entry mi [bclspath]
+ printfInfo "executing `main' now:\n"
+ executeFuncPtr $ fst entry