Merge: Interpreter FFI: fix running the interpreter FFI in the interpreter
authorJean Privat <jean@pryen.org>
Wed, 20 Apr 2016 17:21:55 +0000 (13:21 -0400)
committerJean Privat <jean@pryen.org>
Wed, 20 Apr 2016 17:21:55 +0000 (13:21 -0400)
commit0abe6c99210c244527be1842907e176638e40073
tree765a1f5ad1be30bc66f999261b7b3cdeed10474f
parent9c33e8a15cb314b18d3622dd436aeac7f9ac5cbd
parent4d7a5d430ad1b564d1f9ea1da8b1dca04aefb0b7
Merge: Interpreter FFI: fix running the interpreter FFI in the interpreter

Let's start with a bit of context, the interpreter supports only the light FFI, a subset of the full FFI supported by the compiler. The interpreter uses an heuristic to guess which extern methods are supported. The problem of #2018, was in this heuristic. The heuristic states that if a parameter of an extern method is a standard Nit class and not an universal or an extern class, then that method probably uses the full FFI. However, sometimes this is false, like in the interpreter where instances of Nit standard classes are stored as pointer in the C code, still without using the full FFI.

To fix #2018, this PR intro a new annotation `light_ffi` to be used on extern methods wrongly detected as full FFI. It bypasses the heuristic and force the interpreter to compile and run the method. (or it tries to) This annotation should not be used otherwise, the heuristic is pretty good at detecting when a method is supported or not.

Pull-Request: #2020
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Reviewed-by: Jean Privat <jean@pryen.org>