# See the License for the specific language governing permissions and
# limitations under the License.
-# FFI support for the compilers
+# Light FFI support for the compiler
module light
intrude import abstract_compiler
intrude import ffi::light_ffi
redef class MModule
+ # `CCompilationUnit` used for nitni signatures and code specific to the compiler
var nitni_ccu: nullable CCompilationUnit = null
private fun nmodule(v: AbstractCompilerVisitor): nullable AModule
var n = nmodule(v)
if n == null then return
n.ensure_compile_ffi_wrapper
- finalize_ffi_wrapper(v.compiler.modelbuilder.compile_dir, v.compiler.mainmodule)
+ finalize_ffi_wrapper(v.compiler.toolchain.compile_dir, v.compiler.mainmodule)
for file in ffi_files do v.compiler.extern_bodies.add(file)
ensure_compile_nitni_base(v)
"""
var cflags = self.cflags[""].join(" ")
- nitni_ccu.write_as_nitni(self, v.compiler.modelbuilder.compile_dir)
+ nitni_ccu.write_as_nitni(self, v.compiler.toolchain.compile_dir)
for file in nitni_ccu.files do
var f = new ExternCFile(file, cflags)
private fun compile_ffi_support_to_c(v: AbstractCompilerVisitor)
do
var mmodule = mpropdef.mclassdef.mmodule
- var mainmodule = v.compiler.mainmodule
var amodule = v.compiler.modelbuilder.mmodule2node(mmodule)
var mclass_type = mpropdef.mclassdef.bound_mtype
end
redef class CCompilationUnit
+ # Compile a `_nitni` files, used to implement nitni features for the compiler
fun write_as_nitni(mmodule: MModule, compdir: String)
do
var base_name = "{mmodule.c_name}._nitni"