Commits

Even Wiik Thomassen committed bf19c6f

Enable loading GHC modules in get_module again.

  • Participants
  • Parent commits 2b12a78
  • Branches even

Comments (0)

Files changed (2)

File pyhaskell/interpreter/jscparser.py

 from pypy.rlib.parsing.ebnfparse import parse_ebnf, make_parse_function
 from pypy.rlib.parsing.tree import RPythonVisitor, Nonterminal
 from pypy.rlib.streamio import open_file_as_stream
-from pypy.rlib.jit import elidable
 
 from pyhaskell.interpreter.module import CoreMod
 from pyhaskell.interpreter.primtype import Int, Double, Char, Addr
     return var
 
 
-@elidable
 def get_module(name):
     """Returns module 'name', load from external JSCore file if necessary."""
-    assert name in CoreMod.all_modules
-    return CoreMod.all_modules[name]
-    #try:
-    #    result = CoreMod.all_modules[name]
-    #except KeyError:
-    #    print "Loading GHC module from hcj:", name
-    #    module_path = name.replace('.', '/').replace(':', '/')
-    #    js = parse_js('./ghc_modules/%s.hcj' % module_path)
-    #    result = AST().get_ast(js)
-    #assert isinstance(result, CoreMod)
-    #return result
+    if name in CoreMod.all_modules:
+        result = CoreMod.all_modules[name]
+    else:
+        print "Loading GHC module from hcj:", name
+        assert False
+        module_path = name.replace('.', '/').replace(':', '/')
+        js = parse_js('./ghc_modules/%s.hcj' % module_path)
+        result = AST().get_ast(js)
+    assert isinstance(result, CoreMod)
+    return result
 
 
 def parse_js(path):

File pyhaskell/interpreter/test/test_jit.py

 from pyhaskell.interpreter.test.test_haskell import (
         fromto, app, ForwardReference, function, to_list,
         take, from_, map_, succ, iterate, filter_, not_, id_, append,
-        prim_seq, prim_sub, prim_add, w_true, w_nil, cons)
+        prim_seq, prim_sub, prim_add, w_true, w_nil, cons, length_)
 
 
 # jit tests
             ([w_nil, n], n),
             ([xs, m], app(last, xs))], recursive=True))
 
+        # l = app(length_, app(fromto, Int(1), Int(100)))
         # l = app(take, Int(100), app(iterate, not_, w_true))
         # l = app(filter_, id_, app(take, Int(100),
         #                           app(iterate, not_, w_true)))
-        l = app(map_, succ, app(fromto, Int(1), Int(100)))
+        # l = app(map_, succ, app(fromto, Int(1), Int(100)))
         # l = app(take, Int(100), app(from_, Int(1)))
         # l = app(map_, succ, app(take, Int(100), app(from_, Int(1))))
         # l = to_list(range(100))
-        # l = app(fromto, Int(1), Int(100))
+        l = app(fromto, Int(0), Int(1200))
         # l = app(append, app(fromto, Int(1), Int(100)), app(fromto, Int(1), Int(100)))
 
         def interp(i):