Estimated hours taken: 1.5
Split llds into two parts. llds.m defines the data types, while llds_out.m
has the predicates for printing the code.
Removed the call_closure instruction. Instead, we use calls to the
system-defined addresses do_call_{det,semidet,nondet}_closure. This is
how call_closure was implemented already. The advantage of the new
implementation is that it allows jump optimization of what used to be
call_closures, without new code in jumpopt.
Estimated hours taken: 30 (?)
Its...
The C to Mercury Interface.
The following changes provide a C to Mercury interface. By making a declaration
such as
:- pragma(export, foo(in, in, out), "FunctionName").
you will be able to call the C function "FunctionName" from C. The arguments
are the same as the Mercury arguments, with outputs passed as pointers.
XXX We don't handle floats or strings properly.
A function prototype is output into <modulename>.h
Execution still has to start in Mercury.
Something went wrong with CVS when I tried to abort a commit just then, and it
thinks I've already commited some files... but here's a description of all
my changes anyway:
compiler/garbage_out.m:
Ignore c_export c_modules.
compiler/hlds_module.m:
Add an annotation to the hlds, indicating which procs are exported
to C.
compiler/llds.m:
Change the way labels are emitted - instead of emitting the label
directly, it first generates a string and then prints the string. This
is useful because I only want the string (to print later). The
preds which return a string are now part of the interface.
compiler/make_hlds.:
Take note of which procs are to be exported to C.
compiler/mercury_compile.pp:
Generate a <module>.h file if necessary.
compiler/mercury_to_mercury.m:
Spit out :- pragma(export, ...) decs.
compiler/prog_io.m:
Read in :- pragma(export, ...) decs.
compiler/export.m:
Handle the outputting of C exports. This includes the generation of
the .h files and the generation of the C functions.