Commit Graph

15215 Commits

Author SHA1 Message Date
Zoltan Somogyi
478cf3d8d4 Remove the implication from .debug to .tr.
Estimated hours taken: 1
Branches: main

compiler/handle_options.m:
scripts/final_grade_options.sh-subr.m:
	Remove the implication from .debug to .tr. This implication is no
	longer appropriate, since we now have both .tr and .trseg versions
	of trailing, and .trseg is the more useful one. However, since .tr
	is still used, replacing the implication with one from .debug to
	.trseg is not appropriate either.

	Removing the implication yields an executable size reduction of 6.8%,
	and speedup of 10%.
2009-06-04 07:48:21 +00:00
Paul Bone
d1719ad812 Provide access to runtime granularity control primitives.
Estimated hours taken: 10
Branches: main

Provide access to runtime granularity control primitives.

In 2007 Zoltan implemented some runtime granularity control primitives in the
runtime system.  This change provides access to them from procedures in the
par_builtin module, this is useful for testing.  Recording of parallelization
decisions has also been implemented to help verify and debug this approach.
The variables that the runtime granularity control method depends upon have
been made volatile.

The runtime granularity control method is:
	 NumCPUs > (executable contexts + sparks on global queue).

I previously thought that this was incorrect but instead my testing code was
broken, having fixed it this works correctly.

library/par_builtin.m:
    Define a procedure as above so that it can be called explicits from code,
		this is useful for testing.

runtime/mercury_context.c:
runtime/mercury_context.h:
	  Make the variables used by the granularity control method volatile.
		Provide debugging code enabled by a C macro.
2009-06-04 06:42:13 +00:00
Zoltan Somogyi
a2d52f9246 Document the non-dummy definition of pseudo_type_info as a workaround.
Estimated hours taken: 0.1
Branches: main

library/rtti_implementation.m:
	Document the non-dummy definition of pseudo_type_info as a workaround.
2009-06-04 05:41:26 +00:00
Zoltan Somogyi
e1d84ec7cc Minor cleanups.
Estimated hours taken: 2
Branches: main

compiler/type_constraints.m:
	Minor cleanups.
2009-06-04 05:15:41 +00:00
Zoltan Somogyi
675329e4f4 Minor cleanups of the mode constraints code.
Estimated hours taken: 3
Branches: main

Minor cleanups of the mode constraints code.

compiler/abstract_mode_constraints.m:
compiler/build_mode_constraints.m:
compiler/mcsolver.m:
compiler/prop_mode_constraints.m:
	Add some optional diagnostic outputs.
	Pass around the extra data needed by the diagnostic output.

	Change the style of predicate comments to match the rest of the
	compiler. Delete the redundant copies of these comments near the start
	of the predicate definitions.

	Give some predicates, function symbols and types less ambiguous names.

	Use !StateVar ^ ... := ... syntax where applicable.

	Convert some predicates from using clauses to explicit disjunctions.

	Add a missing abort.

compiler/mode_constraints.m:
compiler/ordering_mode_constraints.m:
	Conform to the changes above.
2009-06-04 04:39:20 +00:00
Peter Wang
08eec03b2e Add Java implementation of gmtime_to_timestamp_2.
compiler/timestamp.m:
        Add Java implementation of gmtime_to_timestamp_2.

library/io.m:
library/time.m:
        Make Java implementation of io.file_modification_time return the
        correct type.

library/string.m:
        Make generic version of string.to_char_list avoid bounds checks
        per character.

        Add Java implementations of string.semidet_from_char_list,
        string.append_list.
2009-06-03 07:07:41 +00:00
Peter Wang
f429ea2e63 Make the dummy definition of pseudo_type_info not be a dummy type,
Branches: main

library/rtti_implementation.m:
        Make the dummy definition of pseudo_type_info not be a dummy type,
        to work around the Erlang backend to generating invalid code for this
        module.
2009-06-02 10:37:50 +00:00
Julien Fischer
77157145e5 Fix another problem compiling the standard library in the erlang
grade.

library/backjump.m:
	Add dummy Erlang definitions of builtin_choice_id/1 and
	builtin_backjump/1.
2009-06-02 08:38:42 +00:00
Peter Wang
0363135aa7 Fix inverted condition in erl_var_or_dummy_replacement.
Branches: main

compiler/erl_code_util.m:
	Fix inverted condition in erl_var_or_dummy_replacement.
2009-06-02 07:55:14 +00:00
Julien Fischer
20727a71c0 Do not allow multi-arms switches in the erlang grade.
compiler/handle_options.m:
	Require  --no-allow-multi-arm-switches in the erlang grade.
2009-06-02 06:31:56 +00:00
Zoltan Somogyi
62cb848c20 Compile all modules in the library, not just a few, with
Estimated hours taken: 0.2
Branches: main

library/LIB_FLAGS.in:
library/Mercury.options:
	Compile all modules in the library, not just a few, with
	--optimize-constructor-last-call. I tried this last year, when
	it yielded a slight slowdown on tools/speedtest; but now, it yields
	a speedup of about 3.5%. The downside is not that important: a 2.8%
	increase in the size of the archive file holding the Mercury standard
	library.
2009-06-02 04:21:32 +00:00
Peter Wang
5012b8f45e The Java 5 compiler warns about a method with an array argument:
Branches: main

The Java 5 compiler warns about a method with an array argument:

	m1(Object[] args)

overriding a method declared with varargs:

	m1(Object... args)

The Java 6 compiler accepts it, though I don't know if that was intended.


java/runtime/MethodPtr.java:
	Don't use varargs syntax for MethodPtr.call___0_0.

library/rtti_implementation.m:
	Explicitly create the Object[] arrays in foreign_procs.
2009-06-01 11:06:36 +00:00
Peter Wang
41bf5ef5f1 Avoid problems with overlong command lines when making mer_std.jar.
Branches: main

library/Mmakefile:
	Avoid problems with overlong command lines when making mer_std.jar.

	Call `jar i' to add indices for jar files.

scripts/prepare_install_dir.in:
	Make a copy of the java/runtime directory for the java grade.
2009-06-01 10:29:01 +00:00
Julien Fischer
ee74813099 Avoid warnings from gcc 4.3 in the runtime.
runtime/mercury_stack_trace.c:
	Handle values of type MR_Level in format strings correctly.

runtime/mercury_wrapper.c:
	Check the return value of a call to system().
2009-06-01 09:28:01 +00:00
Julien Fischer
a2b3b6b546 Fix compilation of the standard library in the erlang grade.
library/region_builtin.m:
	Add a dummy Erlang definition for the region/0 type.
2009-06-01 08:21:21 +00:00
Peter Wang
5739b02b14 For Java backend, use static instances to represent enumeration constants
Branches: main

For Java backend, use static instances to represent enumeration constants
instead of dynamically allocating them.  This is similar to using native Java
enums but leaves the possibility of manually assigning ordinal values, which
might be needed to make `:- pragma foreign_enum' do something sensible.

Support `:- pragma foreign_export_enum' for Java.


compiler/add_pragma.m:
        Don't abort on seeing `:- pragma foreign_export_enum' for Java.

compiler/export.m:
        Only output exported enums if `:- pragma foreign_export_enum' was
        declared for C.  Previously it ignored the language.

compiler/mlds.m:
        Remember in `mlds_exported_enum' the type constructor of the exported
        enumeration.  This is needed for mlds_to_java.m.

        Delete the `mlds_type' in `mlds_exported_enum' as it was useless.

        For each exported constant, keep a `mlds_initializer' of its integer
        value, instead of a `mlds_entity_defn'.

compiler/ml_type_gen.m:
compiler/mlds_to_c.m:
        Conform to previous changes.

compiler/mlds_to_java.m:
        Output static instances of enumeration constants.  These are named
        `K<n>' where <n> is the integer value of the constant.

        Use the `K<n>' instances instead of dynamically allocating objects
        for enumeration classes.

        Don't output int fields which hold the integer value for each
        enumeration constructor as they are now useless.

        Output foreign exported enumerations.  These are static class members
        (at the module level) which point to the `K<n>' instances, giving
        them predictable names for foreign code.

library/io.m:
        Fix Java implementation of `io.file_type_2' which previously relied
        on the representation of enums.
2009-05-27 05:48:37 +00:00
Peter Wang
0f589d3e32 Fix a bug where `ml_gen_wrapper_arg_lvals' treated unused arguments
Branches: main

compiler/ml_closure_gen.m:
        Fix a bug where `ml_gen_wrapper_arg_lvals' treated unused arguments
        like output arguments.  This caused the Java code generator to abort
        on some code.

tests/valid/Mmakefile:
tests/valid/wrapper_arg_lvals.m:
        Add test case.
2009-05-25 02:34:35 +00:00
Peter Wang
6dabc1ce92 In the Java grade, an enumeration is represented by a class with a `value'
Branches: main

In the Java grade, an enumeration is represented by a class with a `value'
field, alongside constants named by the user.  A constant named `value'
would conflict with that field, so we rename it to `MR_value'.

compiler/ml_type_gen.m:
compiler/mlds_to_java.m:
        As above.

tests/hard_coded/Mmakefile:
tests/hard_coded/value_enum.exp:
tests/hard_coded/value_enum.m:
        Add test case.
2009-05-25 02:29:20 +00:00
Peter Wang
903a4a1f82 Previously, unqualified Mercury modules would result in Java classes which
Branches: main

Previously, unqualified Mercury modules would result in Java classes which
were placed in the default (unnamed) package.  This is a problem as Java
doesn't allow packaged classes to import types from the unpackaged classes.
This patch gives all Java classes generated from Mercury files the "mercury."
package prefix.

mmake support for Java files is even more broken than before.  It expects
Java files to be placed in the same directory but, due to the "mercury."
prefix, even classes for non-nested modules are placed in a subdirectory
called `mercury'.  (The standard library can still be built with mmake using
custom rules.)

Fix creation of `.jar' files.  It is not enough to package the `.class' files
that we know will be produced for each module.  Nested classes generate
separate `.class' files which also need to be included.

Fix creation of the shell script that launches Java programs.


compiler/java_names.m:
        Add a function to add an outermost "mercury" qualifier on module names.

        Make `java_module_name' add the outermost "mercury" qualifier.

compiler/mlds_to_java.m:
        Add the outermost "mercury" qualifier wherever we are writing out
        a package name.

compiler/compile_target_code.m:
        Fix creation of `.jar' files, as described.

        Use a temporary file and @-syntax to pass the list of class files to
        `jar'.

        Pass `jar -C <dir> <class> -C <dir> <class> ...' as -C only affects
        the argument immediately following it.

        Run `jar i' to add an index to jar files.

compiler/file_names.m:
        Add `get_class_dir_name' to return the directory that contains class
        files.

        Make `choose_file_name' work for Java files again (with package
        directories) when `--use-subdirs' is disabled.

compiler/module_cmds.m:
        Make `create_java_shell_script' work correctly when
        `--use-grade-subdirs' is enabled, and when the main module is
        packaged (as it will be).

        Make Java shell scripts get the path to the class directory from $0,
        and make the path to the Java interpreter overridable by an environment
        variable.

        Make `list_class_files_for_jar' scan the directory containing class
        files, to include nested classes.  Return a list of class files.

        Make `list_class_files_for_jar_mmake' use `get_class_dir_name'.

library/Mmakefile:
        Update hacks to build the standard library in the java grade.

mdbcomp/prim_data.m:
        Delete `insert_module_qualifier' as `add_outermost_qualifier'
        is equivalent.

compiler/module_qual.m:
compiler/prog_type.m:
compiler/write_deps_file.m:
        Conform to changes.
2009-05-22 02:51:21 +00:00
Peter Wang
ee6990b445 Fix a bug where generated Java code could pass `null' to a function
Branches: main

compiler/mlds_to_java.m:
        Fix a bug where generated Java code could pass `null' to a function
        where a non-reference type was required.
2009-05-21 07:55:10 +00:00
Peter Wang
a25bf2b0e2 Avoid a problem with type names and constructor names that are the same.
Branches: main

Avoid a problem with type names and constructor names that are the same.
Java does not allow the name of a nested class to be the same as its
enclosing class.  If we would violate that rule (when generating Java) then
add the prefix "mr_" to the constructor name.  The user can still trigger the
problem by naming a different constructor with the "mr_" prefix.

compiler/ml_type_gen.m:
        Add functions to generate constructor names that avoid the problem.

        Use the functions for naming d.u. constructors.

compiler/ml_unify_gen.m:
        Use the functions for naming d.u. constructors.

compiler/mlds_to_java.m:
        Delete TODO.
2009-05-21 05:57:02 +00:00
Peter Wang
96806a8171 Fix problems with `--track-flags' feature.
Branches: main

Fix problems with `--track-flags' feature.

compiler/file_names.m:
	Make `.track_flags' files grade-dependent, otherwise you get
	unnecessary rebuilds when changing grades with
	"--use-grade-subdirs --track-flags".

compiler/options.m:
doc/user_guide.texi:
	Don't track build system options, otherwise you get unnecessary
	rebuilds just by changing things like the `--jobs <n>' value.
2009-05-21 04:42:16 +00:00
Ralph Becket
65bdaff280 Add a new doc constructor, hard_nl, which always causes a newline
library/pretty_printer.m:
	Add a new doc constructor, hard_nl, which always causes a newline
	(and indentation) to be printed.

	Change the behaviour of the nl constructor so that a newline is
	only started if it increases the amount of space on the line for
	output.

tests/hard_coded/test_pretty_printer.exp:
tests/hard_coded/test_pretty_printer.m:
	Update the indentation test (the new nl behaviour gives different
	output).
2009-05-18 05:55:14 +00:00
Ralph Becket
642fd27303 Fix a bug in the pretty printer for arbitrary terms where it would not
Estimated hours taken: 0.2
Branches: main

library/pretty_printer.m:
	Fix a bug in the pretty printer for arbitrary terms where it would not
	start a new line for a functor that could not fit on the remainder of
	the line.  This made it impossible to see structure from indentation in
	some cases.

tests/hard_coded/test_pretty_printer.exp:
tests/hard_coded/test_pretty_printer.m:
	Update the test case.
2009-05-13 01:44:40 +00:00
Peter Wang
e647b8ebb0 Revert part of a change to support submodules in Java backend
Branches: main

compiler/file_names.m:
        Revert part of a change to support submodules in Java backend
        but broke the high level C backend.
2009-05-12 11:28:46 +00:00
Julien Fischer
22082e872f Remove a .tr grade from the grade list for neptune.
tools/test_mercury:
	Remove a .tr grade from the grade list for neptune.
2009-05-11 17:10:04 +00:00
Peter Wang
c7f4dca5c1 Support generating Java archives (.jar) with `mmc --make'.
Branches: main

Support generating Java archives (.jar) with `mmc --make'.

compiler/make.program_target.m:
compiler/compile_target_code.m:
        Make `build_linked_target_2' call `compile_target_code.link' instead of
        `create_java_shell_script' so that jar targets don't produce shell
        scripts.

        Make `compile_target_code.link' call `create_java_shell_script' so
        that Java executable targets don't try to produce native executables.

compiler/module_cmds.m:
        Rename `list_class_files_for_jar' to `list_class_files_for_jar_mmake'.

        Add a version of `list_class_files_for_jar' where we are given the
        actual list of .class files.  The old version was given only a mmake
        variable reference so generated a shell expression that relied on `sed'
        to strip `Mercury/classs' prefixes off paths.

compiler/write_deps_file.m:
        Conform to renaming.

library/string.m:
NEWS:
        Add string.remove_prefix_if_present/2.
2009-05-11 05:24:08 +00:00
Peter Wang
bc57025e69 Make `mmc --make' support submodules when compiling to Java.
Branches: main

Make `mmc --make' support submodules when compiling to Java.  Java files must
be placed in subdirectories named after the package that each class belongs to.

compiler/java_names.m
compiler/parse_tree.m:
compiler/notes/compiler_design.html:
        Add a new module in the parse_tree package to contain code related to
        name mangling for Java.

compiler/mlds.m:
compiler/java_util.m:
        Move predicates to java_names.m.

compiler/mlds_to_java.m:
        Move predicates to java_names.m.

        Delete an unused predicate.

compiler/file_names.m:
        Rename `erlang_module_name' as it is now also used for Java.

        Make `module_name_to_file_name_general' return file names for `.java'
        and `.class' files that include package subdirectories.

compiler/make.program_target.m:
        Clean `.class' files on make clean.

compiler/mlds_to_il.m:
mdbcomp/prim_data.m:
        Move `sym_name_to_list' to mdbcomp.prim_data.

compiler/compile_target_code.m:
compiler/elds_to_erlang.m:
        Conform to changes.

library/Mmakefile:
        Delete hacks that work around Mercury not writing submodule .java files
        in subdirectories.
2009-05-11 04:56:46 +00:00
Ralph Becket
597eaa4077 Conform to current layout conventions.
Estimated hours taken: 0.2
Branches: main

extras/lazy_evaluation/lazy.m:
	Conform to current layout conventions.
	Remove function modes (they're not needed these days).
	Update closure cells with value cells, rather than new closures
	returning the previously computed result.
2009-05-11 03:05:34 +00:00
Julien Fischer
3bbe61ccf8 neptune now has direct access to the repository.
tools/test_mercury:
	neptune now has direct access to the repository.

	Install .trseg grades instead of .tr grades.
2009-05-08 13:16:52 +00:00
Peter Wang
c2b1704378 Fix I/O problems in Java backend.
Branches: main

Fix I/O problems in Java backend.

library/io.m:
        Don't write to System.out directly in io.write_*/3.  io.write_*/4
        works with a stream layered on top of System.out, and mixing the two
        sets of predicates results output coming out in the wrong order.

        In MR_MercuryFileStruct.put and MR_MercuryFileStruct.write flush a
        text output stream if a newline is written, otherwise the user is
        liable to not see any output at all (the buffering is very
        aggressive).

tests/hard_coded/csharp_test.m:
tests/hard_coded/java_test.m:
        Update some old :- pragma foreign_* syntax.
2009-05-07 07:42:16 +00:00
Peter Wang
2ed239c286 Implement exception handling predicates for Java.
Branches: main

library/exception.m:
        Implement exception handling predicates for Java.

java/runtime/Exception.java:
        Add a helper class.
2009-05-07 07:05:39 +00:00
Peter Wang
3dedf92d05 Fix these problems with string and character literals output by the Java
Branches: main

Fix these problems with string and character literals output by the Java
backend, due to using routines originally designed for C literals:

- string literals cannot be broken into multiple segments

- \a, \v escape characters are not supported

- trigraphs are not supported so don't need to avoid them


compiler/c_util.m:
        Add versions of existing predicates which take the output language as
        an argument.

        Fix the above problems for Java.

compiler/mlds_to_java.m:
        Use the new predicates.
2009-05-07 01:16:27 +00:00
Paul Bone
3737e99727 Add *.int0 and *.date0 entries to .cvsignore lists.
Estimated hours taken: 0.1

Add *.int0 and *.date0 entries to .cvsignore lists.

deep_profiler/.cvsignore:
profiler/.cvsignore:
    As above
2009-05-05 08:05:29 +00:00
Paul Bone
e54fba7c1d Make mmc --help generate output that can be turned into a more correct man
Estimated hours taken: 0.1

Make mmc --help generate output that can be turned into a more correct man
page.  Namely the NAME section of the man page was not being generated which is
used by apropos to search for man pages.  This fixes a lintian warning when
generating a debian package.

compiler/handle_options.m:
    As above
2009-05-05 07:53:00 +00:00
Peter Wang
f733c2c50e With mmc --make, invoke `javac' once only for a linked target, passing it all
Branches: main

With mmc --make, invoke `javac' once only for a linked target, passing it all
the .java files which need compiling.  This is how the Java compiler is meant
to be used, and is much quicker.

compiler/make.program_target.m:
        As above.

        Clear cached timestamps of all `.class' files afterwards.

compiler/compile_target_code.m:
        Change `compile_java_file' to accept multiple Java files.

compiler/make.dependencies.m:
        Fix a bug. `.class' files should depend on the `.java' file only.

compiler/make.module_target.m:
compiler/mercury_compile.m:
        Conform to changes.
2009-05-05 05:53:15 +00:00
Ben Mellor
83968732f9 Address some trvial review comments on an earlier commit.
runtime/mercury_stm.c
    Rephrase a comment to be clearer and more accurate.

runtime/mercury_stm.h
    Parenthesize an argument ofa macro in the macro body.

library/stm_builtin.m
    Change (!defined MR_HIGHLEVEL_CODE) to !defined(MR_HIGHLEVEL_CODE) in
    several places.
2009-05-05 05:37:37 +00:00
Ben Mellor
a31199dddb Allow the Software Transactional Memory (STM) system to work in low level C
grades.

runtime/mercury_stm.h
    In low level grades, define the type MR_STM_ConditionVar as an alias
    for MR_STM_TransLog*, and prototype the MR_STM_condvar_signal procedure.

runtime/mercury_stm.c
    MR_stm_block_thread is now conditional on MR_HIGHLEVEL_CODE.

    In low level grades, MR_STM_condvar_signal is defined to allow the
    transaction logs saved as "condition variables" to be "signalled".

library/stm_builtin.m
    In low level grades, stm_block saves the current context in the waiter
    queues of the STM variables mentioned in the context's transaction log,
    then calls MR_runnext to look for more work.
2009-05-04 01:53:51 +00:00
Ben Mellor
d353fe6b4b Update the debugging thread synchronization procedures to match the pthread_*
calls that are made when thread debugging is not enabled.

runtime/mercury_thread.c
runtime/mercury_thread.h
    Update the functions to which the debug versions of MR_LOCK,
    MR_UNLOCK, MR_SIGNAL, etc, expand. Make them all return int error
    codes, as do the underlying pthread_* functions, make
    MR_cond_signal call pthread_cond_signal instead of
    pthread_cond_broadcast, and create an analogous MR_cond_broadcast
    function.
2009-05-04 01:50:41 +00:00
Ben Mellor
7543a45da2 Test the STM system for a simple conflict between transactions.
Also delete an unsatisfactory test.
2009-05-03 08:03:40 +00:00
Peter Wang
297046f7d7 Fix Java implementation of `get_subterm' to look up the name of the
Branches: main

library/rtti_implementation.m:
        Fix Java implementation of `get_subterm' to look up the name of the
        field to extract, which is necessary if the field in the Mercury type
        was named.
2009-05-01 05:54:11 +00:00
Quan Phan
fb88e85a8c Fix two bugs in RBMM.
Estimated hours taken: 0.1
Branch: main

Fix two bugs in RBMM.

compiler/rbmm.region_instruction.m:
    Add remove instructions for regions reachable from void variables.

runtime/mercury_region.h:
    Add a missing variable declaration.
2009-04-30 07:49:41 +00:00
Peter Wang
376d3acec7 Introduce hacks to make it possible to build the standard library in the Java
Branches: main

Introduce hacks to make it possible to build the standard library in the Java
grade, even though sub-modules aren't yet supported by the Java backend.

library/Mmakefile:
        Copy submodule source files into package directories as expected by
        javac, e.g. thread.mvar.java -> thread_/mvar.java

        Make `jars' target include source files in package directories.
2009-04-30 06:34:29 +00:00
Peter Wang
6f699e9d3e Make `mmc --make' work for Java grade.
Branches: main

Make `mmc --make' work for Java grade.

compiler/make.dependencies.m:
compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
        Make `mmc --make' know to generate `.class' files.

compiler/compile_target_code.m:
        Pass "-sourcepath Mercury/javas" to javac when using subdirectories.

compiler/module_cmds.m:
        Make the shell script we generate to invoke `java' pass command line
        arguments through to the user program.  `exec' the java process.

library/Mmakefile:
        Use $(ALL_JAVACFLAGS) when compiling standard library modules so
        $(EXTRA_JAVACFLAGS) has its effect.
2009-04-30 04:37:27 +00:00
Peter Wang
d1cffc4523 RTTI improvements for Java backend. io.write/3 works for some simple types
Branches: main

RTTI improvements for Java backend.  io.write/3 works for some simple types
(builtin types and non-existential d.u. types).

compiler/mlds_to_java.m:
        Fix problem with cyclic RTTI definitions.  Initialisers could refer to
        other RTTI structures which weren't yet allocated, leading to fields
        being null.  The fix is to allocate all top-level RTTI objects first
        and initialise in a second phase.

java/runtime/DuExistInfo.java:
java/runtime/DuExistLocn.java:
java/runtime/DuFunctorDesc.java:
java/runtime/EnumFunctorDesc.java:
java/runtime/ForeignEnumFunctorDesc.java:
java/runtime/TypeClassConstraint.java:
java/runtime/TypeClassDeclStruct.java:
java/runtime/TypeClassId.java:
java/runtime/TypeCtorInfo_Struct.java:
java/runtime/TypeInfo_Struct.java:
        Separate constructors into constructors for the initial allocation,
        and an `init' method to fill in the fields.

java/runtime/MethodPtr.java:
        Use variadic method support to simplify semidet_call_* and
        result_call_* in rtti_implementation.m.

library/builtin.m:
        Make Java definitions of builtin.unify/2 and builtin.compare/3 call
        rtti_implementation.generic_unify and generic_compare.

library/private_builtin.m:
        Add missing MR_TYPECTOR_REP_FOREIGN_ENUM{,_USEREQ} constants
        for C# and Java.

library/rtti_implementation.m:
        Fix and add missing Java versions of many foreign_procs.

        Add more attributes to foreign_procs.

        Clean up the code a bit (fewer casts and ^ field access functions).

README.Java:
        Bump Java version requirement to J2SE 1.5 or higher.
2009-04-30 00:43:35 +00:00
Peter Wang
7d7ca9866b Fix an abort when compiling private_builtin.m with the Java backend.
Branches: main

Fix an abort when compiling private_builtin.m with the Java backend.
`--optimize-constructor-last-call' is incompatible with Java but the
declarations for the builtins that it uses are in private_builtin.m, and the
predicates were being given bodies which aren't handled by the Java backend.

compiler/add_pred.m:
        If the target language is Java or Erlang, treat
        `private_builtin.store_at_ref_impure' and `store_at_ref' as stubs.
        They should never be called.

        Set `marker_builtin_stub' on those predicates, as well as
        `builtin_compound_eq' and `builtin_compound_lt'.

compiler/hlds_pred.m:
        Add a new marker type `marker_builtin_stub'.

compiler/typecheck.m:
        Generate stub clauses for predicates with the `marker_builtin_stub'
        marker, even if `--allow-stubs' is disabled.

compiler/hlds_out.m:
compiler/intermod.m:
compiler/table_gen.m:
        Conform to changes.
2009-04-29 03:38:12 +00:00
Peter Wang
4ef0b094a3 Update these modules using `:- pragma foreign_export' in Java grades
Branches: main

library/dir.m:
library/io.m:
        Update these modules using `:- pragma foreign_export' in Java grades
        to fix undefined reference errors.

library/Mercury.options:
        Set `--no-halt-at-warn' on io.m for now as compilers more than a week
        old will warn about the foreign_exports, even though they work.
2009-04-28 02:05:54 +00:00
Quan Phan
c59863f857 Convert the parts of the runtime support for RBMM that have been implemented
Estimated hours taken: 10
Branch: main

Convert the parts of the runtime support for RBMM that have been implemented
fully using macros to macros that finally are expanded to function calls.
Using pure macros may improve the performance of small programs but not what
we want in general.
The function version is the default while the macros are kept for experimental
purposes. The macros can be turned on by specifying the C flag
MR_RBMM_USE_MACROS when compiling programs.

This change is the completion of Zoltan's unfinished work before.

runtime/mercury_conf_param.h:
    Add MR_RBMM_USE_MACROS flag as an experimental option.

runtime/mercury_region.h:
runtime/mercury_region.c:
    Implement the functions corresponding to the old macros. There is no
    change in terms of algorithm.
2009-04-27 12:39:53 +00:00
Peter Wang
5e27937316 Don't generate lock objects for a constant mutables in Java grade
Branches: main

compiler/make_hlds_passes.m:
        Don't generate lock objects for a constant mutables in Java grade
        as they won't be used.

compiler/prog_mutable.m:
        Document mutable transformation for Java.
2009-04-27 05:09:22 +00:00
Peter Wang
1b35477376 Add support for mutables in the java grade.
Branches: main

Add support for mutables in the java grade.
`thread_local' mutables are not yet supported.

compiler/make_hlds_passes.m:
        Add support for mutables in the java grade.

compiler/mlds_to_java.m:
        Make generated Java code call mutable initialisation predicates.
        (General module initialisation predicates are not yet working).

compiler/elds_to_erlang.m:
        Add an XXX I noticed while making the change.
2009-04-27 03:23:51 +00:00