Make the Java backend not use native code to implement any standard library

Branches: main

Make the Java backend not use native code to implement any standard library
procedures.  The only such procedures were related to benchmarking and timing,
which aren't very important so I just make a best effort using methods that
the Java standard library provides.

library/benchmarking.m:
        Implement `benchmarking.report_stats' for Java as closely as possible
        without native code.  Add real time output.

        Add `benchmarking.ML_initialise' to remember the time when the
        program starts up.

compiler/mlds_to_java.m:
        Make the main wrapper call `benchmarking.ML_initialise' at startup.

library/time.m:
        Implement `time.clock', `time.times', `time.clocks_per_sec',
        `time.clk_tck' as closely as possible without native code.

library/Mmakefile:
        Comment out commands to build and install Native.so.

java/runtime/Native.c:
        Even though this is not used any more, update the function names for
        the "jmercury" package prefix.

README.Java:
        Update section on unimplemented procedures.
This commit is contained in:
Peter Wang
2009-08-14 06:34:03 +00:00
parent fe4c25c16f
commit 9fc47f5c91
6 changed files with 119 additions and 83 deletions

View File

@@ -127,7 +127,11 @@ A. The following implementation features are not supported:
benchmarking.report_stats/0:
benchmarking.report_full_memory_stats/0:
Memory usage statistics are not yet available, and cpu time
is obtained via native code as per time.m.
is not the same as in the C backends, as per time.m.
io.set_environment_var/4:
The Java APIs do not allow setting environment variables hence
this predicate simply throws an exception.
store.arg_ref/5:
store.new_arg_ref/5:
@@ -139,9 +143,8 @@ A. The following implementation features are not supported:
time.times/7:
time.clk_tck/0:
Because the current Java APIs do not provide any way of
implementing these procedures in pure Java, we have implemented
them using a native code library implemented in C and accessed
via JNI. This approach sacrifices some portability.
implementing these procedures exactly in pure Java, we have
approximated them with what is available.
This list is probably not complete.