Estimated hours taken: 1.5
Branches: main
Implement some library procedures for Java.
library/benchmarking.m:
Implement the following predicates in Java:
report_stats/0
report_full_memory_stats/0
java/runtime/Native.java.in:
Record whether or not there has yet been an attempt to load the
library.
Add the side effect of loading the library to isAvailable(), in case
the static code for benchmarking.java is run before the static code
for Native.java.
Estimated hours taken: 0.25
Branches: main
java/runtime/ReservedAddrFunctorDesc.java:
New file. This corresponds to the C type MR_ReservedAddrFunctorDesc
in runtime/mercury_type_info.h. It will be needed if compiling
to Java with the reserved tag options (--num-reserved-objects
or --num-reserved-addresses) enabled.
Estimated hours taken: 3
Branches: main
Some fixes to the Java back-end, to make it work again after
Zoltan's recent type class RTTI changes.
java/runtime/DuExistInfo.java:
Add a new field "exist_constraints" to the DuExistInfo type
and a corresponding argument to the constructor, to match
Zoltan's recent changes.
java/runtime/TypeClassId.java:
java/runtime/TypeClassMethod.java:
java/runtime/TypeClassDeclStruct.java:
java/runtime/TypeClassConstraint.java:
New files. These correspond to the C types MR_TypeClassId,
MR_TypeClassMethod, MR_TypeClassDeclStruct,
and MR_TypeClassConstraint in the C runtime.
java/runtime/TypeCtorInfo_Struct.java:
Add a comment.
compiler/rtti_to_mlds.m:
Don't cast null pointers to mlds__generic_type; they should have
the right type already. Casting to mlds__generic_type here causes
type errors for the Java back-end, because in Java there are no
implicit conversions from Object (unlike C, which allows implicit
conversions from `void *').
compiler/rtti.m:
Change tc_rtti_name_java_type so that it maps the new typeclass-related
RTTI types to the appropriate Java types.
library/private_builtin.m:
Define MR_PREDICATE and MR_FUNCTION.
java/runtime/PredFunc.java:
Fix a bug in my previous change:
s/MR_PRED/MR_PREDICATE/
s/MR_FUNC/MR_FUNCTION/
Estimated hours taken: 13
Branches: main
Implement some library predicates for Java using JNI.
java/runtime/Native.java.in:
A new class which uses JNI to provide any native functionality
required by predicates of the standard library in Java.
So far it only provides methods relating to timing.
java/runtime/Native.c:
Source code, written in C, which implements all the native methods of
mercury.runtime.Native. Note that this implementation makes use of the
existing C implementation of the equivalent functions.
java/runtime/Mmakefile:
Rules for compiling a shared object from Native.c.
library/time.m:
Implement the following predicates for Java using Native interface:
time__c_clock/3
time__clocks_per_sec/1
time__times/7
library/benchmarking.m:
Implement the following predicates for Java using Native interface:
get_user_cpu_miliseconds/1
library/Mmakefile:
Renamed to library/Mmakefile.in, so as to have access to FULLARCH
constant.
library/Mmakefile.in:
Added rules for incorporating the Native shared object.
Estimated hours taken: 2
Branches: main
Implement library version for Java.
library/library.m:
Implement library__version in Java.
java/runtime/Constants.java.in:
File from which Constants.java is to be generated, which is the source
for a class to hold mercury-related constants, such as the library
version.
configure.in:
Added java/runtime/Constants.java to the list of files to generate.
Estimated hours taken: 5
Branches: main
Implement some library procedures for the Java back end.
library/std_util.m:
Defined the type mutvar(T) as an array of java.lang.Objects (which
will always be size 1)
Implemented the following procedures in Java:
get_registers/3
check_for_floundering/1
discard_trail_ticket/0
swap_heap_and_solutions_heap/0
partial_deep_copy/3
reset_solutions_heap/1
new_mutvar/2
get_mutvar/2
set_mutvar/2
java/runtime/VA_PseudoTypeInfo_Struct0.java:
This new file is a workaround which allows std_util.m to successfully
compile in grade Java.
Estimated hours taken: 4
Branches: main
Implement some library procedures for the Java back end.
library/dir.m:
Updated the imports so interface includes string and io, and altered
style to that of one import per line.
Defined the dir__stream foreign_type as an java.util.Iterator.
Implemented the following procedures in Java:
dir__directory_separator/0
can_implement_make_directory/0
dir__make_single_directory_2/5
dir__open_2/4
dir__close_2/5
dir__read_entry_2/6
java/runtime/VA_PseudoTypeInfo_Struct8.java:
This new file is a workaround which allows dir.m to successfully
compile in grade Java.
Estimated hours taken: 3
Branches: main
Added support for progname and exit status in grade Java.
compiler/mlds_to_java.m:
Added code to maybe_write_main_driver/5 to store the main class's name
and exit status in mercury.runtime.JavaInternal's static variables.
Also, main() now calls java.lang.System.exit() instead of returning,
since Java insists that main must have void return type.
java/runtime/JavaInternal.java:
Added static variables "progname" and "exit_status".
Estimated hours taken: 6
Branches: main
More work on the Java back-end. The standard library now compiles
in grade `java', and hello world (the version using io__write_string,
and linked against the standard library in library/*.m, not the
hand-coded one in java/library/*.java) now works!
compiler/make_hlds.m:
Ignore `pragma type_spec' declarations for the Java back-end.
This works around a problem where javac was failing to compile
some of our generated code due to it overflowing limits on
file name length for the names of the .class files for some
nested classes.
compiler/mlds_to_java.m:
Add some comments. Add myself to the "main authors" list.
library/string.m:
Provide Java definitions of string__first_char and
string__unsafe_index. (These are needed for string.append,
which is used by private_builtin.sorry.)
library/io.m:
Provide Java definitions of io__write_{string,int,char,float}/3.
java/runtime/TypeCtorInfo_Struct.java:
Fix a cut-and-paste error.
java/runtime/TypeInfo_Struct.java:
Improve the implementation of the TypeInfo_Struct(Object)
constructor so that it doesn't throw exceptions during
the initialization of the standard library.
java/runtime/FA_TypeInfo_Struct1.java:
Make this type inherit from TypeInfo_Struct.
Estimated hours taken: 10
Branches: main
Bug fixes for the Java back-end.
The standard library now almost compiles in grade java.
compiler/mlds_to_java.m:
Output Java foreign declarations before any other code,
to fix a problem with references to the TYPE_CTOR_REP
constants in library/private_builtin.m.
Fix some bugs where we were not being consistent about mangling
the module name when naming the classes used to simulate taking
procedure addresses. This bug broke Java compilation of library/char.m.
Fix some bugs where the compiler was getting confused about
which types map to array types in Java.
For MLDS casts that cast to type_info or pseudo_type_info,
generate Java constructor calls, not Java casts.
This fixes type errors in the generated Java code.
Simplify the code for hand_defined_type.
compiler/rtti.m:
Fix a bug in tc_rtti_name_java_type: map typeclass_infos to
the Java type "java.lang.Object[]", not "java.lang.Integer[]".
The latter didn't work because the elements which hold the method
addresses do not have type java.lang.Integer.
java/runtime/DuExistInfo.java:
java/runtime/NotagFunctorDesc.java:
Define constructors for these types.
java/runtime/TypeInfo_Struct.java:
Define some additional constructors for this type.
library/builtin.m:
Provide Java stub definitions of
- classes for the types func/0 and c_pointer/0;
- unify/compare preds for func, c_pointer, tuple, and void;
Define Java definitions for the additional modes of compare/3
(they just call the first mode).
library/exception.m:
Define Java versions of make_io_state and consume_io_state,
and Java stubs for throw_impl and catch_impl.
Change try_all so that it calls catch_impl, like try does,
rather than calling builtin_catch directly. This is needed
since the .NET and Java back-ends only define catch_impl,
not builtin_catch.
library/io.m:
Provide Java `pragma foreign_type' declarations for the types
array.array(T) and io.system_error. This is needed to avoid
compilation errors when building in grade `java'.
library/private_builtin.m:
Delete the Java definition of the type_info for type_info/1,
because that is generated automatically now,
after petdr's recent bug fix.
Provide Java stubs definitions of the unify/compare preds
for ref/1, heap_pointer/0, type_ctor_info, type_info,
base_typeclass_info, and typeclass_info.
Provide Java definition of dummy_var.
library/type_desc.m:
Provide Java stub definitions of
- classes for type_desc/0 and type_ctor_desc/0
- unify/compare preds for those types
library/store.m:
Define unification and comparison predicates for the store(S)
type. This is needed because the automatically generated ones
might not have the right semantics, but also because the Java
back-end generates some invalid code for the automatically
generated unification and compare predicates (the generated
code has some invalid references to "dummy_var").
Estimated hours taken: 2
Branches: main
Runtime fixes for the Java back-end.
java/runtime/DuExistLocn.java:
java/runtime/DuFunctorDesc.java:
java/runtime/DuPtagLayout.java:
Define constructors for these types.
java/runtime/MaybeResAddrFunctorDesc.java:
New file (corresponds to MR_MaybeResAddrFunctorDesc type in C).
java/runtime/MaybeResFunctorDesc.java:
New file (corresponds to MR_MaybeResFunctorDesc type in C).
java/runtime/PseudoTypeInfo.java:
Define constructors.
Make non-abstract (XXX temp work-around only).
java/runtime/TypeCtorInfo_Struct.java:
XXX Pass some parameters of the constructor as "Object",
to work around type errors in invocations of those constructors.
java/runtime/TypeFunctors.java:
java/runtime/TypeLayout.java:
Model the C unions better; use a single field, with accessor
functions that convert to each alternative, not several fields.
java/runtime/TypeclassInfo.java:
Implement as stub (previous code was just copy of TypeInfo.java).
java/runtime/VA_PseudoTypeInfo_Struct*.java:
Fix a bug: change the order of the constructor parameters
to match the way we generate code which invokes those constructors.
Estimated hours taken: 0.1
Branches: main
This change fixes a problem which caused some programs to not compile
in grade `java'.
java/library/prolog.java:
New file. Just a stub, like most of the other *.java files in
this directory.
Estimated hours taken: 18
Branches: main
Some fixes to the Java back-end to make it support RTTI
better. The aim is to at least be able to *compile* code
that makes use of polymorphism (e.g. the Mercury standard
library!), although that aim is not yet achieved with this diff.
Getting code which actually *uses* the RTTI to work is still
a long way off...
compiler/rtti.m:
compiler/mlds_to_java.m:
Fix some bugs in the code to output RTTI type names.
compiler/mlds_to_java.m:
Output the RTTI definitions. This is needed to avoid errors
in code which references them.
Handle initializers better; in particular deal with nested
initializers properly.
Pass the current module name down to output_lval, so that we can
module-qualify data names only if they occur in a different
module. This is needed to ensure that static data defined
in other modules gets module-qualified, but local variables don't.
This also required change some places which were incorrectly
calling output_fully_qualified_name to instead call output_name.
Add comments in the generated output code when generating
"java.lang.Object", so that it is clearer what kind of object
is involved.
Add some special treatment for the types with hand-defined RTTI.
java/runtime/*.java:
Add some definitions of RTTI types, and some new constructors
for the RTTI types that were already defined.
These are currently all just stubs.
Estimated hours taken: 2
Branches: main
Delete the univ type_ctor_rep, since we haven't used it in a long time,
and add two new type_ctor_reps: one for subgoals, so that they won't have
to be treated specially when deconstructed, and one for a future type,
stable_c_pointer, which is the same as c_pointer except that it guarantees
that the entire data structure it points to, directly and indirectly is
read only, which means that its values can be tabled. The intention is
to use stable_c_pointers to represent robdds.
runtime/mercury_type_info.h:
Make the change above.
runtime/mercury_construct.c:
runtime/mercury_deconstruct.c:
runtime/mercury_deep_copy_body.h:
runtime/mercury_ml_expand_body.h:
runtime/mercury_tabling.c:
runtime/mercury_unify_compare_body.h:
Handle the two new type_ctor_reps, and delete the code handling univs.
compiler/mlds_to_gcc.m:
java/runtime/TypeCtorRep.java:
library/private_builtin.m:
runtime/mercury_mcpp.h:
runtime/mercury_mcpp.cpp:
Update the list of type_ctor_reps, including fixing some old errors
in some files.
library/rtti_implementation.m:
Update the list of type_ctor_reps, and modify the routines that
interpret the RTTI accordingly.
Estimated hours taken: 4
Branches: main
Add some more code to the temporary, partial Java versions of the
Mercury library modules. This allows us to test the Java back-end
on a few extra test cases and could help prevent regression errors.
mercury/java/library/array.java:
mercury/java/library/benchmarking.java:
mercury/java/library/bintree.java:
mercury/java/library/bintree_set.java:
mercury/java/library/construct.java:
mercury/java/library/dir.java:
mercury/java/library/exception.java:
mercury/java/library/lexer.java:
mercury/java/library/math.java:
mercury/java/library/parser.java:
mercury/java/library/random.java:
mercury/java/library/rtti_implementation.java:
mercury/java/library/set_ordlist.java:
mercury/java/library/set_unordlist.java:
mercury/java/library/store.java:
mercury/java/library/table_builtin.java:
mercury/java/library/term_io.java:
mercury/java/library/varset.java:
Added these files. They are partial (or empty) versions of
the Mercury library modules written in Java.
mercury/java/library/bool.java:
mercury/java/library/builtin.java:
mercury/java/library/io.java:
mercury/java/library/mr_int.java:
mercury/java/library/private_builtin.java:
mercury/java/library/std_util.java:
mercury/java/library/string.java:
Add additional code to these files.
Estimated hours taken: 0.5
Branches: main
java/library/builtin.java:
Define stubs for the generic unify and compare, to avoid errors
from the Java compiler when compiling automatically-generated
type-specific unify and compare procedures for polymorphic types.
Estimated hours taken: 6
Branches: main
Fix test case failures involving type_ctor_descs in .rt grades.
The cause of the failures was that the type_ctor_rep for type_ctor_descs (which
happens to be 35) does not fit into a signed 8-bit integer in .rt grades,
since those grade require 2 bits for a primary tag (3 bits on 64-bit machines).
The fix is to make the type_ctor_rep field in type_ctor_infos 16 bits in size.
To maintain alignment, this requires swapping that field with the num_ptags
field.
The second part of this change will remove the bootstrapping code and raise
the binary compatibility version number. That part cannot be committed until
this part has been installed on all our machines.
runtime/mercury_type_info.h:
Define a new version of the type_ctor_info structure with this swap
and size increase. Provide backward compatibility for bootstrapping.
runtime/mercury_mcpp.h:
library/rtti_implementation.m:
java/runtime/TypeCtorInfo_Struct.m:
Make the same change.
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/mlds_to_gcc.m:
Generate the new type_ctor_info structure.
compiler/llds_out.m:
compiler/mlds_to_c.m:
Generate a macro that selects the new version of the type_ctor_info
structure.
compiler/type_ctor_info.m:
Update the type_ctor_info version number.
Estimated hours taken: 40
Branches: main
Fix the RTTI of type_descs and type_ctor_descs. Make comparisons between
type_ctor_descs and type_ctor_infos (and therefore between type_descs and
type_infos) more predictable and consistent across backends by basing them
on programmer-visible attributes instead of accident of location in the
executable.
runtime/mercury_type_desc.[ch]:
Implement unification and comparison functions for type_ctor_descs.
(The unification and comparison functions for type_infos also double
as the unification and comparison functions for type_descs.)
Make the comparison function work on the module name, type name and
arity instead of the address of the type_ctor_info structure. This
ensures consistency across back ends.
Add some useful macros.
runtime/mercury_type_info.[ch]:
Make the comparison function on type_ctor_infos also work on module
name, type name and arity. Since this makes comparison slower, add
specialized unification functions for type_infos and type_ctor_infos.
runtime/mercury_type_info.h:
runtime/mercury_mcpp.{h,cpp}:
runtime/mercury.h:
library/private_builtin.m:
library/rtti_implementation.m:
java/runtime/TypeCtorRep.java:
compiler/mlds_to_gcc.m:
Add type_ctor_reps for type_descs and type_ctor_descs. Type_ctor_descs
definitely need it, since their representation is very low level and
not shared with anything else. Type_descs could use the type_ctor_rep
of type_infos, since type_descs and type_infos share the same
representation at the moment. However, we add a new one because
profiling cares about the conceptual distinction between type_infos
and type_descs.
library/type_desc.m:
Delete the Mercury "definition" of type_desc, because it is misleading.
Implement it as a builtin type.
runtime/mercury.[ch]:
Implement type_ctor_desc as a builtin type.
Add missing implementations of unify/compare on type_ctor_infos.
runtime/mercury_deconstruct.c:
runtime/mercury_ml_expand_body.h:
Implement deconstruction for type_descs and type_ctor_descs.
runtime/mercury_ho_call.c:
runtime/mercury_unify_compare_body.h:
Implement unify and compare for type_descs and type_ctor_descs.
Implement unify for type_infos, type_ctor_infos, type_descs and
type_ctor_descs by calling the relevant unification function,
not the relevant comparison function, since the unification
function will be faster.
runtime/mercury_deep_copy_body.h:
runtime/mercury_construct.c:
runtime/mercury_tabling.c:
Minor changes to handle type_descs and type_ctor_descs.
trace/mercury_trace_vars.c:
Enable the printing of type_descs and type_ctor_descs.
tests/debugger/type_desc_test.{m,inp,exp,exp2}:
New test case to check the printing of type_descs and type_ctor_descs.
tests/debugger/Mmakefile:
Enable the new test case.
tests/hard_coded/type_ctor_desc_manip.{m,exp}:
New test case to check the deconstruction and comparison of type_descs
and (especially) type_ctor_descs. Before this change, we got different
results for comparisons of type_ctor_descs, results that were
inconsistent with the results of comparisons of the type_descs
that the type_ctor_descs were derived from.
tests/hard_coded/Mmakefile:
Enable the new test case.
Estimated hours taken: 0.5
Branches: main
mercury/java/Makefile:
Renamed to `Mmakefile'.
mercury/Mmakefile:
Invoke mmake in the mercury/java directory to create symbolic
links for java class directories at build time.
Estimated hours taken: 3
Branches: main
This change introduces some (partial) Java versions of the mercury library
which are currently needed to compile some .java files generated by the
mercury compiler for the tests/benchmarks test cases.
These additions are required temporarily for testing purposes until the
mercury library can be compiled in grade java.
mercury/java/Commit.java:
mercury/java/DuExistInfo.java:
mercury/java/DuExistLocn.java:
mercury/java/DuFunctorDesc.java:
mercury/java/DuPtagLayout.java:
mercury/java/EnumFunctorDesc.java:
mercury/java/JavaInternal.java:
mercury/java/MethodPtr.java:
mercury/java/NotagFunctorDesc.java:
mercury/java/PseudoTypeInfo.java:
mercury/java/Sectag_Locn.java:
mercury/java/TypeCtorInfo_Struct.java:
mercury/java/TypeCtorRep.java:
mercury/java/TypeFunctors.java:
mercury/java/TypeLayout.java:
mercury/java/UnreachableDefault.java:
All files that were located in the mercury/java directory have been
moved to mercury/java/runtime.
mercury/java/Makefile:
A simple Makefile to set up a couple of symbolic links so we can
just include the mercury/java directory in our CLASSPATH.
mercury/java/library/assoc_list.java:
mercury/java/library/bool.java:
mercury/java/library/builtin.java:
mercury/java/library/deconstruct.java:
mercury/java/library/enum.java:
mercury/java/library/integer.java:
mercury/java/library/io.java:
mercury/java/library/list.java:
mercury/java/library/map.java:
mercury/java/library/mer_int.java:
mercury/java/library/mr_char.java:
mercury/java/library/mr_float.java:
mercury/java/library/mr_int.java:
mercury/java/library/ops.java:
mercury/java/library/private_builtin.java:
mercury/java/library/require.java:
mercury/java/library/set.java:
mercury/java/library/std_util.java:
mercury/java/library/string.java:
mercury/java/library/term.java:
mercury/java/library/time.java:
mercury/java/library/tree234.java:
mercury/java/library/type_desc.java:
These are partial Java versions of mercury library modules. They are
very rough but will currently allow for most of the tests/benchmark
directory to run in Java.
Estimated hours taken: 50
Branches: main
Bug fixes and additions to the Java back-end so that it will now successfully
compile and run mercury programs which contain higher order code as well as
non-deterministic code.
With some hacked up Mercury library code (in Java) I am able to compile 10 of
the 11 files in the tests/benchmarks directory into Java and run them to
receive the correct output.
mercury/compiler/mlds_to_java.m:
Many small bug fixes.
Disabled current (incomplete) name mangling code. All class, package
and method names apart from java.* and mercury.runtime.* will be
output as lowercase for the moment.
Added code to prefix some classes/packages so we don't run into the
problem of having a class or package name which is also a Java reserved
word. This is the case with the mercury library modules int and char.
Added code to implement commits.
mercury/compiler/java_util.m:
Added a few missing Java reserved words.
mercury/compiler/ml_code_util.m:
A small change so that in one case where they weren't, multiple return
values are now generated in the MLDS.
mercury/java/Commit.java:
Added this file, a throwable class used for the implementation of
commits.
mercury/java/ProcAddr.java:
mercury/java/Compare.java:
mercury/java/Unify.java:
Removed these files, they're now obsolete as they all use the standard
interface for method pointers provided by MethodPtr.java.
mercury/java/TypeCtorInfo_Struct.java:
Altered to reference mercury.runtime.MethodPtr instead of
mercury.runtime.[Unify|Compare].
Estimated hours taken: 8
Branches: main
Move the RTTI-related parts of std_util.m to three new modules in the standard
library, and (in the case of embedded C code) to new modules in the runtime.
The main reason for this is to allow a reorganization of some of the
RTTi-related functionality without breaking backward compatibility. However,
the new arrangement should also be easier to maintain.
Use a separate type_ctor_rep for functions, to distinguish them from predicates
for RTTI code. (At one point, I thought this could avoid the need for the
change to the initialization files mentioned below. It can't, but it is a good
idea in any case.)
library/std_util.m:
Remove the functionality moved to the new modules, and replace them
with type equivalences and forwarding code. There are no changes in
the meanings of the user-visible predicates, with two exceptions.
- First, the true, equivalence-expanded names of what used to be
std_util:type_desc and std_util:type_ctor_desc are now
type_desc:type_desc and type_desc: type_ctor_desc.
- Second, deconstructing a function term now yields
"<<function>>" instead of "<<predicate>>".
The intention is that the RTTI predicates in std_util.m will continue
to work in a backwards-compatible manner for the near future, i.e. as
the new modules are updated, the code in std_util will be updated to
maintain the same functionality, modulo improvements such as avoiding
unwanted exceptions. When the RTTI functionality in the other modules
has stabilised, the RTTI predicates in std_util.m should be marked
obsolete.
The exported but non-documented functionality of std_util has been
moved to one of the new modules without forwarding code, with one
of the moved predicates being turned into the function it should have
been in the first place.
library/construct.m:
library/deconstruct.m:
library/type_desc.m:
Three new modules for the code moved from std_util.m.
library/library.m:
compiler/modules.m:
Record the names of the three new library modules.
runtime/mercury.[ch]:
compiler/mlds_to_il.m:
Record that type_desc is now in type_desc.m, not std_util.m.
compiler/static_term.m:
Import the deconstruct module, since we are using its undocumented
facilities.
runtime/Mmakefile:
Mention the two new modules.
runtime/mercury_construct.[ch]:
runtime/mercury_type_desc.[ch]:
Two new modules holding the C functions that used to be in foreign_code
in std_util, now using MR_ instead of ML_ prefixes, and being more
consistent about indentation.
runtime/mercury_type_info.h:
Add a new type_ctor_rep for functions, separate from predicates.
(It reuses the EQUIV_VAR type_ctor_rep, which hasn't been used
in ages.)
Use type_ctor_reps to distinguish between the type_ctor_infos of
pred/0 and func/0. However, to create higher order typeinfos, we
still need to know the addresses of the type_ctor_infos for
pred/0 and func/0, and we still need to know the address of the
type_ctor_info for tuples to create typeinfos for tuples. Since
these three type_ctor_infos are defined in the library,
we cannot access them directly from the runtime. We therefore need
to access them indirectly in the usual manner, via address_of
variables initialized by mkinit-generated code.
library/builtin.m:
library/private_builtin.m:
library/rtti_implementation.m:
runtime/mercury.c:
runtime/mercury_mcpp.{h,cpp}:
java/TypeCtorRep.java:
Updates to accommondate the new function type_ctor_rep.
runtime/mercury_type_info.[ch]:
Add some functions from foreign_code in std_util that fit in best here.
runtime/mercury_ml_expand_body.h:
runtime/mercury_tabling.h:
runtime/mercury_unify_compare_body.h:
Delete the code for handling EQUIV_VAR, and add code for handling
functions.
runtime/mercury_init.h:
runtime/mercury_wrapper.[ch]:
Add three variables holding the address of the type_ctor_infos
representing functions, predicates and tuples.
util/mkinit.c:
Fill in these three variables.
tests/general/accumulator/construct.{m,exp}:
tests/general/accumulator/deconstruct.{m,exp}:
tests/hard_coded/construct.{m,exp}:
Rename these tests by adding a _test at the ends of their names,
in order to avoid collisions with the names of the new standard library
modules. The test cases have not changed, with the exception of the :-
module declaration of course.
tests/general/accumulator/Mmakefile:
tests/general/accumulator/INTRODUCED:
tests/hard_coded/Mmakefile:
Record the name changes.
tests/hard_coded/existential_float.exp:
Updated the expected output to reflect that deconstructions now print
"<<function>>" instead of "<<predicate>>" when appropriate.
tests/hard_coded/higher_order_type_manip.exp:
Updated the expected output to reflect the new name of what used to be
std_util:type_desc.
trace/mercury_trace_browse.c:
trace/mercury_trace_external.c:
trace/mercury_trace_help.c:
#include type_desc.h instead of std_util.h, since the C functions
we want to call are now defined there.
trace/mercury_trace_vars.c:
Update to account for the movement of type_desc from std_util to
type_desc, and ensure that we don't refer to any type_ctor_infos
in MLDS grades.
Estimated hours taken: 12
Branches: main
Fix a bug by distinguishing the type_ctor_reps of type_infos and
type_ctor_infos. The type_ctor_infos of types with nonzero arity
cannot be printed, copied etc like type_infos; any attempt to do so
causes a core dump.
For similar reasons, add a separate type_ctor_rep for
base_typeclass_infos separate from typeclass_infos.
runtime/mercury_type_info.h:
runtime/mercury_mcpp.h:
compiler/mlds_to_gcc.m:
library/rtti_implementation.m:
java/TypeCtorRep.java:
Add new type_ctor_reps for type_ctor_infos and base_typeclass_infos.
library/private_builtin.m:
runtime/mercury.c:
Use the new type_ctor_reps in the type_ctor_infos of the builtin types
type_ctor_info and base_typeclass_info.
runtime/mercury_type_info.[ch]:
Add a function for comparing type_ctor_infos.
Move some interface documentation from the source file to the header
file.
runtime/mercury_deep_copy_body.h:
Add code to handle the new type_ctor_reps.
Simplify some code.
Make the whole file use 4-space indentation.
library/std_util.m:
runtime/mercury_ml_expand_body.h:
runtime/mercury_unify_compare_body.h:
runtime/mercury_ho_call.c:
runtime/mercury_tabling.c:
Add code to handle the new type_ctor_reps.
Estimated hours taken: 0.1
Branches: main
java/TypeCtorInfo_Struct.java:
Update the TypeCtorInfo structure to reflect the recent bootstrapping
changes.
Branches: main
Estimated hours taken: 0.5
With this change, the files in the `java' directory now all compile
fine with `javac' (after `mkdir mercury; ln -s .. mercury/runtime')
except for the reference to `mercury.Builtin.builtin_comparison_result_0'
in Compare.java.
java/Sectag_Locn.java:
Fix typos.
Estimated hours taken: 90
Branches: main
Changes and additions to the Java back-end so that:
o While tags shouldn't be generated, they do get generated in some cases
and are now handled correctly.
o The Java back-end now generates class constructors.
o The Java back-end is now able to simulate the behaviour of function
pointers, which are used for closures, continuations, as well as unify
and compare.
mercury/compiler/mlds_to_java.m:
Extensive changes to existing code to implement tags and class
constructors. Also, addition of code to search MLDS for uses of
function pointers and to generate MLDS for wrapper classes. As well
as many small bug fixes.
Removed some (unfinished) code for dealing with Unify and Compare, this
code was redundant now that function pointers have been implemented.
mercury/compiler/java_util.m:
Updated to return noops for most tag operators.
mercury/java/MethodPtr.java:
New file. This is the interface which the wrapper classes used for
function pointers extend.
Estimated hours taken: 10.
Classes used by the Java backend, particularly in the implementation
of RTTI.
java/Compare.java:
java/Unify.java:
New files. Java classes for implementation of wrapper classes
around the builtin `unify'and `compare' predicates.
java/JavaInternal.java:
New file. Java class for storing runtime information such
as command line arguments.
java/DuExistInfo.java:
java/DuExistLocn.java:
java/DuFunctorDesc.java:
java/DuPtagLayout.java:
java/EnumFunctorDesc.java:
java/NotagFunctorDesc.java:
java/ProcAddr.java:
java/PseudoTypeInfo.java:
java/Sectag_Locn.java:
java/TypeCtorInfo_Struct.java
java/TypeCtorRep.java:
java/TypeFunctors.java:
java/TypeLayout.java:
New files. Java classes for implementing Mercury RTTI.
java/UnreachableDefault.java:
New file. Runtime exception that signals that unreachable
default case in a switch statement has been reached.
runtime/mercury_type_info.h:
Update comments to mention that Java runtime classes will
need to be altered if structures in this file are.