methodpool: also call native methods
authorBernhard Urban <lewurm@gmail.com>
Sun, 22 Apr 2012 23:14:45 +0000 (01:14 +0200)
committerBernhard Urban <lewurm@gmail.com>
Sun, 22 Apr 2012 23:14:45 +0000 (01:14 +0200)
commitcf43ecc7ce06b6cbfa675239d050e3de30b15103
treed28bf666f989592a469d62fdce5686ce52fe4364
parentd41300b14108d0fb6d478050852af46bc19069fa
methodpool: also call native methods

some comments:
(1) we need shared libs now, otherwise the binary too big (~24MB).
    please recompile from cabal (see README)
(2) as C doesn't allow '/', '(' and ')' as identifier names (unlike
    forth <3), we replace them with '_', in order to identify a
(unique) native function. the pattern is as follows:
class__methodname__methodsignature
(3) `loadNativeFunction' is quite hackisch now. I don't know if we
    get troubles with it at some point. we should consider:
(3a) ask on stackoverflow
(3b) patch this wtf stuff in ghc
(3c) just determine addresses at compile-time.

(3c) sucks, because you have to write much glue-code for every
native method. but maybe we could solve it with some magic TH
stuff (as suggested by hs_)
Makefile
Mate/MethodPool.hs
Mate/X86CodeGen.hs
README
ffi/native.c [new file with mode: 0644]
tests/Native1.java [new file with mode: 0644]