From 1b648d0ac2bc4e4bb4e80af236435c8f39f4c523 Mon Sep 17 00:00:00 2001 From: Peter Wang Date: Wed, 17 Jun 2009 07:48:16 +0000 Subject: [PATCH] Put all Mercury-generated Java classes into the package `jmercury' and Branches: main Put all Mercury-generated Java classes into the package `jmercury' and runtime classes into `jmercury.runtime'. The Mercury module hierarchy is not reflected in the package name. We name sub-module classes using their fully-qualified module names with `__' between components, e.g. `bit_buffer.read' produces `class bit_buffer__read'. As all generated Java code is in the same package we don't need to package qualify identifiers, and we don't need the hack to avoid clashing package and class names. It also makes it easier to write Java foreign code because generated Java class names are easier to predict from Mercury module names. The package names are not `mercury' and `mercury.runtime' because on case-insensitive file systems we may end up with a `mercury' directory that could be confused with the `Mercury' directory. compiler/java_names.m: Delete code related to mangling package names. Remove the extra `mercury' prefix added to standard library module names, as it is redundant with `jmercury'. Change runtime package name. compiler/mlds_to_java.m: Make generated code follow the new packaging scheme. Don't automatically import all runtime classes. It doesn't seem necessary. Update for new packaging scheme. compiler/file_names.m: Fix Java file paths for the new packaging scheme. compiler/module_cmds.m: compiler/rtti.m: library/array.m: library/backjump.m: library/benchmarking.m: library/bitmap.m: library/builtin.m: library/exception.m: library/io.m: library/library.m: library/mutvar.m: library/private_builtin.m: library/rtti_implementation.m: library/store.m: library/string.m: library/time.m: library/type_desc.m: java/runtime/*.java: Rename package names. Delete unnecessary package qualification. compiler/mlds.m: Add some XXXs to be fixed later. library/Mmakefile: Update for new packaging scheme. Let mmake --use-mmc-make work in this directory. --- compiler/file_names.m | 15 +-- compiler/java_names.m | 115 +++--------------- compiler/mlds.m | 11 ++ compiler/mlds_to_java.m | 135 +++++++++------------- compiler/module_cmds.m | 6 +- compiler/rtti.m | 14 +-- java/runtime/Commit.java | 2 +- java/runtime/Constants.java.in | 2 +- java/runtime/DuExistInfo.java | 11 +- java/runtime/DuExistLocn.java | 2 +- java/runtime/DuFunctorDesc.java | 17 ++- java/runtime/DuPtagLayout.java | 11 +- java/runtime/EnumFunctorDesc.java | 2 +- java/runtime/Exception.java | 2 +- java/runtime/ForeignEnumFunctorDesc.java | 2 +- java/runtime/JavaInternal.java | 2 +- java/runtime/MaybeResAddrFunctorDesc.java | 2 +- java/runtime/MaybeResFunctorDesc.java | 2 +- java/runtime/MercuryType.java | 2 +- java/runtime/MethodPtr.java | 2 +- java/runtime/Mmakefile | 3 +- java/runtime/Native.java.in | 5 +- java/runtime/NotagFunctorDesc.java | 6 +- java/runtime/PredFunc.java | 2 +- java/runtime/PseudoTypeInfo.java | 2 +- java/runtime/ReservedAddrFunctorDesc.java | 2 +- java/runtime/Sectag_Locn.java | 2 +- java/runtime/TypeClassConstraint.java | 4 +- java/runtime/TypeClassDeclStruct.java | 2 +- java/runtime/TypeClassId.java | 2 +- java/runtime/TypeClassMethod.java | 2 +- java/runtime/TypeCtorInfo_Struct.java | 42 ++++--- java/runtime/TypeCtorRep.java | 2 +- java/runtime/TypeFunctors.java | 18 +-- java/runtime/TypeInfo_Struct.java | 2 +- java/runtime/TypeLayout.java | 18 +-- java/runtime/UnreachableDefault.java | 2 +- library/Mmakefile | 28 ++--- library/array.m | 2 +- library/backjump.m | 2 +- library/benchmarking.m | 12 +- library/bitmap.m | 4 +- library/builtin.m | 22 ++-- library/exception.m | 64 +++++----- library/io.m | 28 ++--- library/library.m | 4 +- library/mutvar.m | 4 +- library/private_builtin.m | 99 ++++++++-------- library/rtti_implementation.m | 82 ++++++------- library/store.m | 18 +-- library/string.m | 10 +- library/time.m | 16 +-- library/type_desc.m | 76 ++++++------ 53 files changed, 420 insertions(+), 524 deletions(-) diff --git a/compiler/file_names.m b/compiler/file_names.m index b69795bdf..4a4ffbf96 100644 --- a/compiler/file_names.m +++ b/compiler/file_names.m @@ -183,19 +183,16 @@ module_name_to_file_name_general(ModuleName, Ext, Search, MkDir, FileName, % Look up the module in the module->file mapping. source_file_map.lookup_module_source_file(ModuleName, FileName, !IO) ; - % Java files need to be placed in package subdirectories, e.g. the - % source file for `a.b.c' goes in `a_/b_/c.java'. + % Java files need to be placed into a package subdirectory and may need + % mangling. ( string.suffix(Ext, ".java") ; string.suffix(Ext, ".class") ) -> - JavaModuleName = java_module_name(ModuleName), - ( sym_name_get_module_name(JavaModuleName, ParentModules) -> - BaseParentDirs = sym_name_to_list(ParentModules) - ; - BaseParentDirs = [] - ), - BaseName = unqualify_name(JavaModuleName) ++ Ext, + BaseParentDirs = ["jmercury"], + mangle_sym_name_for_java(ModuleName, module_qual, "__", + MangledModuleName), + BaseName = MangledModuleName ++ Ext, choose_file_name(ModuleName, BaseParentDirs, BaseName, Ext, Search, MkDir, FileName, !IO) ; diff --git a/compiler/java_names.m b/compiler/java_names.m index 50f67fc46..59153f20e 100644 --- a/compiler/java_names.m +++ b/compiler/java_names.m @@ -19,8 +19,6 @@ :- import_module mdbcomp.prim_data. -:- import_module bool. - %-----------------------------------------------------------------------------% % For the Java back-end, we need to distinguish between module qualifiers @@ -34,38 +32,10 @@ ---> module_qual ; type_qual. - % Java doesn't allow a fully-qualified class to have the same name as a - % package. Our workaround is to name package components with trailing - % underscores, e.g. `mammal_.primate_.chimp' where `chimp' is a class. - % This is enabled with `package_name_mangling'. - % - % The packages `mercury' and `mercury.runtime' are named without - % underscores simply because there is existing handwritten code already - % using those names. - % -:- type package_name_mangling - ---> package_name_mangling - ; no_package_name_mangling. - % Mangle a name so that it is suitable for Java. % :- pred mangle_sym_name_for_java(sym_name::in, java_qual_kind::in, - string::in, package_name_mangling::in, string::out) is det. - - % Returns yes iff the given package is one provided by the Mercury - % implementation, `mercury' or `mercury.runtime'. - % -:- func is_mercury_provided_java_package(sym_name) = bool. - - % Used in module_name_to_file_name to derive file names for Java files. - % Returns a module name which each component mangled. - % -:- func java_module_name(module_name) = module_name. - - % Return the given module name with an outermost "mercury" qualifier, - % if it is not already present. - % -:- func enforce_outermost_mercury_qualifier(module_name) = module_name. + string::in, string::out) is det. % If the given name conficts with a reserved Java word we must add a % prefix to it to avoid compilation errors. @@ -85,10 +55,6 @@ % :- func flip_initial_case_of_final_part(sym_name) = sym_name. - % The package containing the Mercury standard library. - % -:- func mercury_std_library_package_name = sym_name. - % The package containing the Mercury Java runtime classes. % :- func mercury_runtime_package_name = sym_name. @@ -106,17 +72,22 @@ %-----------------------------------------------------------------------------% -mangle_sym_name_for_java(SymName, QualKind, QualifierOp, - PackageNameMangling, JavaSafeName) :- - mangle_sym_name_for_java_2(SymName, QualKind, PackageNameMangling, - MangledSymName), +mangle_sym_name_for_java(SymName0, QualKind, QualifierOp, JavaSafeName) :- + % Modules in the Mercury standard library get a `mercury' prefix when + % mapped to MLDS module names. Since we place all Java classes inside a + % `jmercury' package, the extra prefix is just redundant so we remove it. + ( strip_outermost_qualifier(SymName0, "mercury", StrippedSymName) -> + SymName = StrippedSymName + ; + SymName = SymName0 + ), + mangle_sym_name_for_java_2(SymName, QualKind, MangledSymName), JavaSafeName = sym_name_to_string_sep(MangledSymName, QualifierOp). :- pred mangle_sym_name_for_java_2(sym_name::in, java_qual_kind::in, - package_name_mangling::in, sym_name::out) is det. + sym_name::out) is det. -mangle_sym_name_for_java_2(SymName, QualKind, PackageNameMangling, - MangledSymName) :- +mangle_sym_name_for_java_2(SymName, QualKind, MangledSymName) :- ( SymName = unqualified(Name), JavaSafeName = java_safe_name_component(QualKind, Name), @@ -124,22 +95,7 @@ mangle_sym_name_for_java_2(SymName, QualKind, PackageNameMangling, ; SymName = qualified(ModuleName0, PlainName), mangle_sym_name_for_java_2(ModuleName0, module_qual, - PackageNameMangling, MangledModuleName0), - ( - PackageNameMangling = package_name_mangling, - MercuryProvided = is_mercury_provided_java_package(ModuleName0), - ( - MercuryProvided = yes, - MangledModuleName = MangledModuleName0 - ; - MercuryProvided = no, - MangledModuleName = append_underscore_sym_name( - MangledModuleName0) - ) - ; - PackageNameMangling = no_package_name_mangling, - MangledModuleName = MangledModuleName0 - ), + MangledModuleName), JavaSafePlainName = java_safe_name_component(QualKind, PlainName), MangledSymName = qualified(MangledModuleName, JavaSafePlainName) ). @@ -157,45 +113,6 @@ java_safe_name_component(QualKind, Name) = JavaSafeName :- MangledName = name_mangle(FlippedName), JavaSafeName = valid_java_symbol_name(MangledName). -is_mercury_provided_java_package(ModuleName) = MercuryProvided :- - ( ModuleName = mercury_std_library_package_name -> - MercuryProvided = yes - ; ModuleName = mercury_runtime_package_name -> - MercuryProvided = yes - ; - MercuryProvided = no - ). - -:- func append_underscore_sym_name(sym_name) = sym_name. - -append_underscore_sym_name(SymName0) = SymName :- - ( - SymName0 = unqualified(Name), - SymName = unqualified(Name ++ "_") - ; - SymName0 = qualified(ModuleSymName, Name), - SymName = qualified(ModuleSymName, Name ++ "_") - ). - -%-----------------------------------------------------------------------------% - -java_module_name(ModuleName) = JavaModuleName :- - % Put a "mercury" prefix on the module name if it doesn't already have one, - % so that even unqualified module names to end up in a Java package. - % Java doesn't allow packaged classes to import types from the default - % unnamed package. We don't do this earlier so as not to disturb other - % MLDS backends. - QualModuleName = enforce_outermost_mercury_qualifier(ModuleName), - mangle_sym_name_for_java_2(QualModuleName, module_qual, - package_name_mangling, JavaModuleName). - -enforce_outermost_mercury_qualifier(ModuleName) = QualModuleName :- - ( outermost_qualifier(ModuleName) = "mercury" -> - QualModuleName = ModuleName - ; - QualModuleName = add_outermost_qualifier("mercury", ModuleName) - ). - %-----------------------------------------------------------------------------% valid_java_symbol_name(SymName) = ValidSymName :- @@ -290,9 +207,7 @@ flip_initial_case_of_final_part(qualified(Qual, Name)) = %-----------------------------------------------------------------------------% -mercury_std_library_package_name = unqualified("mercury"). - -mercury_runtime_package_name = qualified(unqualified("mercury"), "runtime"). +mercury_runtime_package_name = qualified(unqualified("jmercury"), "runtime"). %-----------------------------------------------------------------------------% diff --git a/compiler/mlds.m b/compiler/mlds.m index 6ebbde29d..9416cd5c9 100644 --- a/compiler/mlds.m +++ b/compiler/mlds.m @@ -417,10 +417,13 @@ ---> il_assembly_name(mlds_module_name). % An mlds_module_name specifies the name of an mlds package or class. + % XXX This is wrongly named as it is also used for class names. % :- type mlds_module_name. % An mlds_package_name specifies the name of an mlds package. + % XXX This is wrongly named as it is used for module names in the Java + % backend. % :- type mlds_package_name == mlds_module_name. @@ -1907,11 +1910,19 @@ mlds_get_arg_types(Parameters) = ArgTypes :- %-----------------------------------------------------------------------------% +% For IL: % An MLDS module name consists of two parts. One part is the package % which the module name is defined in, and the other part is the actual % module name. For example the module name System.XML could be defined % in the package XML. % +% For Java: +% The "package_name" is really the name of the Mercury module, and the +% "module_name" is the "package_name" plus additional qualifiers (if any). +% For example, a type `c' in module `a.b' would have package_name == `a.b' +% and module_name == `a.b.c'. +% XXX clean this up +% % Note that modules in the Mercury standard library map get a `mercury' % prefix e.g. `mercury.builtin', `mercury.io', `mercury.univ', etc., % when mapped to MLDS package names. diff --git a/compiler/mlds_to_java.m b/compiler/mlds_to_java.m index b7857de6a..ffd725575 100644 --- a/compiler/mlds_to_java.m +++ b/compiler/mlds_to_java.m @@ -279,9 +279,7 @@ reverse_string(String0, String) :- :- pred output_imports(mlds_imports::in, io::di, io::uo) is det. output_imports(Imports, !IO) :- - list.foldl(output_import, Imports, !IO), - % We should always import the mercury.runtime classes. - io.write_string("import mercury.runtime.*;\n\n", !IO). + list.foldl(output_import, Imports, !IO). :- pred output_import(mlds_import::in, io::di, io::uo) is det. @@ -300,9 +298,7 @@ output_import(Import, !IO) :- unexpected(this_file, "foreign import in Java backend") ), SymName = mlds_module_name_to_sym_name(ImportName), - PackageSymName = enforce_outermost_mercury_qualifier(SymName), - mangle_sym_name_for_java(PackageSymName, module_qual, ".", - package_name_mangling, ClassFile), + mangle_sym_name_for_java(SymName, module_qual, "__", ClassFile), % There are issues related to using import statements and Java's naming % conventions. To avoid these problems, we output dependencies as comments % only. This is ok, since we always use fully qualified names anyway. @@ -836,7 +832,7 @@ create_addr_wrapper_name(CodeAddr, MangledClassEntityName) :- % (predicate) name. ModuleQualifierSym = mlds_module_name_to_sym_name(ModuleQualifier), mangle_sym_name_for_java(ModuleQualifierSym, convert_qual_kind(QualKind), - "__", no_package_name_mangling, ModuleNameStr), + "__", ModuleNameStr), ClassEntityName = "addrOf__" ++ ModuleNameStr ++ "__" ++ PredName, MangledClassEntityName = name_mangle_maybe_shorten(ClassEntityName). @@ -1045,42 +1041,31 @@ output_init_2(Indent, InitPred, !IO) :- output_src_start(Indent, MercuryModuleName, Imports, ForeignDecls, Defns, !IO) :- - JavaSafeModuleName = java_module_name(MercuryModuleName), output_auto_gen_comment(MercuryModuleName, !IO), indent_line(Indent, !IO), io.write_string("/* :- module ", !IO), prog_out.write_sym_name(MercuryModuleName, !IO), io.write_string(". */\n\n", !IO), - output_package_info(JavaSafeModuleName, !IO), + indent_line(Indent, !IO), + io.write_string("package jmercury;\n", !IO), + output_imports(Imports, !IO), io.write_list(ForeignDecls, "\n", output_java_decl(Indent), !IO), io.write_string("public class ", !IO), - ClassName = unqualify_name(JavaSafeModuleName), + mangle_sym_name_for_java(MercuryModuleName, module_qual, "__", ClassName), io.write_string(ClassName, !IO), io.write_string(" {\n", !IO), - maybe_write_main_driver(Indent + 1, JavaSafeModuleName, Defns, !IO). - - % Output a `package' directive at the top of the Java source file, - % if necessary. - % -:- pred output_package_info(sym_name::in, io::di, io::uo) is det. - -output_package_info(unqualified(_), !IO). -output_package_info(qualified(JavaSafeModule, _), !IO) :- - io.write_string("package ", !IO), - PackageName = sym_name_to_string(JavaSafeModule), - io.write_string(PackageName, !IO), - io.write_string(";\n", !IO). + maybe_write_main_driver(Indent + 1, ClassName, Defns, !IO). % Check if this module contains a `main' predicate and if it does insert % a `main' method in the resulting Java class that calls the % `main' predicate. Save the command line arguments in the class - % variable `args' in the class `mercury.runtime.JavaInternal'. + % variable `args' in the class `jmercury.runtime.JavaInternal'. % -:- pred maybe_write_main_driver(indent::in, sym_name::in, +:- pred maybe_write_main_driver(indent::in, string::in, list(mlds_defn)::in, io::di, io::uo) is det. -maybe_write_main_driver(Indent, JavaSafeModuleName, Defns, !IO) :- +maybe_write_main_driver(Indent, ClassName, Defns, !IO) :- ( defns_contain_main(Defns) -> indent_line(Indent, !IO), io.write_string("public static void main", !IO), @@ -1089,24 +1074,23 @@ maybe_write_main_driver(Indent, JavaSafeModuleName, Defns, !IO) :- io.write_string("{\n", !IO), % Save the progname and command line arguments in the class variables - % of `mercury.runtime.JavaInternal', as well as setting the default + % of `jmercury.runtime.JavaInternal', as well as setting the default % exit status. - ClassName = unqualify_name(JavaSafeModuleName), indent_line(Indent + 1, !IO), - io.write_string("mercury.runtime.JavaInternal.progname = """, !IO), + io.write_string("jmercury.runtime.JavaInternal.progname = """, !IO), io.write_string(ClassName, !IO), io.write_string(""";\n", !IO), indent_line(Indent + 1, !IO), - io.write_string("mercury.runtime.JavaInternal.args = args;\n", !IO), + io.write_string("jmercury.runtime.JavaInternal.args = args;\n", !IO), indent_line(Indent + 1, !IO), - io.write_string("mercury.runtime.JavaInternal.exit_status = ", !IO), + io.write_string("jmercury.runtime.JavaInternal.exit_status = ", !IO), io.write_string("0;\n", !IO), indent_line(Indent + 1, !IO), - prog_out.write_sym_name(JavaSafeModuleName, !IO), + io.write_string(ClassName, !IO), io.write_string(".main_2_p_0();\n", !IO), indent_line(Indent + 1, !IO), io.write_string("java.lang.System.exit", !IO), - io.write_string("(mercury.runtime.JavaInternal.exit_status);", !IO), + io.write_string("(jmercury.runtime.JavaInternal.exit_status);", !IO), io.nl(!IO), indent_line(Indent, !IO), io.write_string("}\n", !IO) @@ -1306,9 +1290,8 @@ output_interface(Interface, !IO) :- Arity, _) -> SymName = mlds_module_name_to_sym_name(ModuleQualifier), - PackageSymName = enforce_outermost_mercury_qualifier(SymName), - mangle_sym_name_for_java(PackageSymName, convert_qual_kind(QualKind), - ".", package_name_mangling, ModuleName), + mangle_sym_name_for_java(SymName, convert_qual_kind(QualKind), + ".", ModuleName), io.format("%s.%s", [s(ModuleName), s(Name)], !IO), % % Check if the interface is one of the ones in the runtime @@ -1861,50 +1844,48 @@ output_maybe_qualified_name(QualifiedName, CurrentModuleName, !IO) :- ( ModuleName = CurrentModuleName -> output_name(Name, !IO) ; - output_fully_qualified_thing(QualifiedName, output_name, ".", !IO) + output_fully_qualified_thing(QualifiedName, output_name, !IO) ). :- pred output_fully_qualified_name(mlds_qualified_entity_name::in, io::di, io::uo) is det. output_fully_qualified_name(QualifiedName, !IO) :- - output_fully_qualified_thing(QualifiedName, output_name, ".", !IO). + output_fully_qualified_thing(QualifiedName, output_name, !IO). :- pred output_fully_qualified_proc_label(mlds_qualified_proc_label::in, io::di, io::uo) is det. output_fully_qualified_proc_label(QualifiedName, !IO) :- - output_fully_qualified_thing(QualifiedName, mlds_output_proc_label, ".", - !IO). + output_fully_qualified_thing(QualifiedName, mlds_output_proc_label, !IO). :- pred output_fully_qualified_thing(mlds_fully_qualified_name(T)::in, - pred(T, io, io)::pred(in, di, uo) is det, string::in, io::di, io::uo) - is det. + pred(T, io, io)::pred(in, di, uo) is det, io::di, io::uo) is det. -output_fully_qualified_thing(qual(ModuleName, QualKind, Name), OutputFunc, - Qualifier, !IO) :- - mlds_module_name_to_package_name(ModuleName) = PackageName, - mlds_module_name_to_sym_name(ModuleName) = WholeModuleName, +output_fully_qualified_thing(qual(MLDS_ModuleName, QualKind, Name), OutputFunc, + !IO) :- + % XXX These functions are named wrongly for Java. + mlds_module_name_to_package_name(MLDS_ModuleName) = OuterName, + mlds_module_name_to_sym_name(MLDS_ModuleName) = InnerName, - % Write the package name components. - QualPackageName = enforce_outermost_mercury_qualifier(PackageName), - mangle_sym_name_for_java(QualPackageName, module_qual, Qualifier, - package_name_mangling, MangledPackageName), - io.write_string(MangledPackageName, !IO), + % Write the part of the qualifier that corresponds to a top-level Java + % class. + mangle_sym_name_for_java(OuterName, module_qual, "__", MangledOuterName), + io.write_string(MangledOuterName, !IO), - % Any module components following the package name will correspond to - % class names, so should *not* be suffixed with underscores. - ( PackageName = WholeModuleName -> + % Write the later parts of the qualifier correspond to nested Java classes. + ( OuterName = InnerName -> true ; - remove_sym_name_prefixes(WholeModuleName, PackageName, NonPackageName), - mangle_sym_name_for_java(NonPackageName, convert_qual_kind(QualKind), - Qualifier, no_package_name_mangling, MangledNonPackageName), - io.write_string(Qualifier, !IO), - io.write_string(MangledNonPackageName, !IO) + io.write_string(".", !IO), + remove_sym_name_prefixes(InnerName, OuterName, Suffix), + mangle_sym_name_for_java(Suffix, convert_qual_kind(QualKind), ".", + MangledSuffix), + io.write_string(MangledSuffix, !IO) ), - io.write_string(Qualifier, !IO), + % Write the qualified thing. + io.write_string(".", !IO), OutputFunc(Name, !IO). :- pred remove_sym_name_prefixes(sym_name::in, sym_name::in, sym_name::out) @@ -2125,7 +2106,7 @@ output_type(_, mlds_foreign_type(ForeignType), !IO) :- output_type(_, mlds_class_type(Name, Arity, _ClassKind), !IO) :- % We used to treat enumerations specially here, outputting % them as "int", but now we do the same for all classes. - output_fully_qualified_thing(Name, output_class_name, ".", !IO), + output_fully_qualified_thing(Name, output_class_name, !IO), io.format("_%d", [i(Arity)], !IO). output_type(Style, mlds_ptr_type(Type), !IO) :- % XXX should we report an error here, if the type pointed to @@ -2135,20 +2116,20 @@ output_type(Style, mlds_array_type(Type), !IO) :- output_type(Style, Type, !IO), output_array_brackets(Style, !IO). output_type(_, mlds_func_type(_FuncParams), !IO) :- - io.write_string("mercury.runtime.MethodPtr", !IO). + io.write_string("jmercury.runtime.MethodPtr", !IO). output_type(_, mlds_generic_type, !IO) :- io.write_string("java.lang.Object", !IO). output_type(_, mlds_generic_env_ptr_type, !IO) :- io.write_string("/* env_ptr */ java.lang.Object", !IO). output_type(_, mlds_type_info_type, !IO) :- - io.write_string("mercury.runtime.TypeInfo", !IO). + io.write_string("jmercury.runtime.TypeInfo", !IO). output_type(_, mlds_pseudo_type_info_type, !IO) :- - io.write_string("mercury.runtime.PseudoTypeInfo", !IO). + io.write_string("jmercury.runtime.PseudoTypeInfo", !IO). output_type(_, mlds_cont_type(_), !IO) :- % XXX Should this actually be a class that extends MethodPtr? - io.write_string("mercury.runtime.MethodPtr", !IO). + io.write_string("jmercury.runtime.MethodPtr", !IO). output_type(_, mlds_commit_type, !IO) :- - io.write_string("mercury.runtime.Commit", !IO). + io.write_string("jmercury.runtime.Commit", !IO). output_type(Style, mlds_rtti_type(RttiIdMaybeElement), !IO) :- rtti_id_maybe_element_java_type(RttiIdMaybeElement, JavaTypeName, IsArray), io.write_string(JavaTypeName, !IO), @@ -2188,7 +2169,7 @@ output_mercury_type(Style, Type, CtorCat, !IO) :- io.write_string("double", !IO) ; CtorCat = ctor_cat_void, - io.write_string("mercury.builtin.Void_0", !IO) + io.write_string("builtin.Void_0", !IO) ; CtorCat = ctor_cat_variable, io.write_string("java.lang.Object", !IO) @@ -2293,10 +2274,10 @@ type_category_is_array(CtorCat) = IsArray :- hand_defined_type(ctor_cat_system(Kind), SubstituteName) :- ( Kind = cat_system_type_info, - SubstituteName = "mercury.runtime.TypeInfo_Struct" + SubstituteName = "jmercury.runtime.TypeInfo_Struct" ; Kind = cat_system_type_ctor_info, - SubstituteName = "mercury.runtime.TypeCtorInfo_Struct" + SubstituteName = "jmercury.runtime.TypeCtorInfo_Struct" ; Kind = cat_system_typeclass_info, SubstituteName = "/* typeclass_info */ java.lang.Object[]" @@ -2744,7 +2725,7 @@ output_stmt(Indent, ModuleInfo, FuncInfo, DoCommitStmt, _, ExitMethods, DoCommitStmt = ml_stmt_do_commit(Ref), indent_line(Indent, !IO), output_rval(ModuleInfo, Ref, FuncInfo ^ func_info_name ^ mod_name, !IO), - io.write_string(" = new mercury.runtime.Commit();\n", !IO), + io.write_string(" = new jmercury.runtime.Commit();\n", !IO), indent_line(Indent, !IO), io.write_string("throw ", !IO), output_rval(ModuleInfo, Ref, FuncInfo ^ func_info_name ^ mod_name, !IO), @@ -2763,7 +2744,7 @@ output_stmt(Indent, ModuleInfo, FuncInfo, TryCommitStmt, _, ExitMethods, indent_line(Indent, !IO), io.write_string("}\n", !IO), indent_line(Indent, !IO), - io.write_string("catch (mercury.runtime.Commit commit_variable)\n", !IO), + io.write_string("catch (jmercury.runtime.Commit commit_variable)\n", !IO), indent_line(Indent, !IO), io.write_string("{\n", !IO), indent_line(Indent + 1, !IO), @@ -2980,7 +2961,7 @@ output_switch_default(Indent, _ModuleInfo, _FuncInfo, Context, indent_line(Context, Indent, !IO), io.write_string("default: /*NOTREACHED*/\n", !IO), indent_line(Context, Indent + 1, !IO), - io.write_string("throw new mercury.runtime.UnreachableDefault();\n", !IO), + io.write_string("throw new jmercury.runtime.UnreachableDefault();\n", !IO), ExitMethods = set.make_singleton_set(can_throw). %-----------------------------------------------------------------------------% @@ -3329,7 +3310,7 @@ output_unop(ModuleInfo, Unop, Expr, ModuleName, !IO) :- ( Unop = cast(Type), % rtti_to_mlds.m generates casts from int to - % mercury.runtime.PseudoTypeInfo, but for Java + % jmercury.runtime.PseudoTypeInfo, but for Java % we need to treat these as constructions, not casts. % Similarly for conversions from TypeCtorInfo to TypeInfo. ( @@ -3337,7 +3318,7 @@ output_unop(ModuleInfo, Unop, Expr, ModuleName, !IO) :- Expr = ml_const(mlconst_int(_)) -> maybe_output_comment("cast", !IO), - io.write_string("new mercury.runtime.PseudoTypeInfo(", !IO), + io.write_string("new jmercury.runtime.PseudoTypeInfo(", !IO), output_rval(ModuleInfo, Expr, ModuleName, !IO), io.write_string(")", !IO) ; @@ -3346,7 +3327,7 @@ output_unop(ModuleInfo, Unop, Expr, ModuleName, !IO) :- ) -> maybe_output_comment("cast", !IO), - io.write_string("new mercury.runtime.TypeInfo_Struct(", !IO), + io.write_string("new jmercury.runtime.TypeInfo_Struct(", !IO), output_rval(ModuleInfo, Expr, ModuleName, !IO), io.write_string(")", !IO) ; @@ -3635,9 +3616,7 @@ mlds_output_proc_label(mlds_proc_label(PredLabel, ProcId), !IO) :- mlds_output_data_addr(data_addr(ModuleQualifier, DataName), !IO) :- SymName = mlds_module_name_to_sym_name(ModuleQualifier), - PackageSymName = enforce_outermost_mercury_qualifier(SymName), - mangle_sym_name_for_java(PackageSymName, module_qual, ".", - package_name_mangling, ModuleName), + mangle_sym_name_for_java(SymName, module_qual, "__", ModuleName), io.write_string(ModuleName, !IO), io.write_string(".", !IO), output_data_name(DataName, !IO). diff --git a/compiler/module_cmds.m b/compiler/module_cmds.m index d124e0d2b..17adb9798 100644 --- a/compiler/module_cmds.m +++ b/compiler/module_cmds.m @@ -683,7 +683,7 @@ create_java_shell_script(MainModuleName, Succeeded, !IO) :- ClassPath = string.join_list(PathSeparator, Java_Incl_Dirs), globals.io_lookup_string_option(java_interpreter, Java, !IO), - ClassName = sym_name_to_string(java_module_name(MainModuleName)), + mangle_sym_name_for_java(MainModuleName, module_qual, ".", ClassName), % Remove symlink in the way, if any. io.remove_file(FileName, _, !IO), @@ -697,7 +697,7 @@ create_java_shell_script(MainModuleName, Succeeded, !IO) :- "CLASSPATH=", ClassPath, "\n", "export CLASSPATH\n", "JAVA=${JAVA:-", Java, "}\n", - "exec $JAVA ", ClassName, " \"$@\"\n" + "exec $JAVA jmercury.", ClassName, " \"$@\"\n" ], !IO), io.close_output(ShellScript, !IO), io.call_system("chmod a+x " ++ FileName, ChmodResult, !IO), @@ -737,7 +737,7 @@ list_class_files_for_jar(MainClassFiles, ClassSubDir, ListClassFiles, !IO) :- NestedClassPrefixes), NestedClassPrefixesSet = set.from_list(NestedClassPrefixes), - SearchDir = ClassSubDir / "mercury", + SearchDir = ClassSubDir / "jmercury", FollowSymLinks = yes, dir.recursive_foldl2( accumulate_nested_class_files(NestedClassPrefixesSet), diff --git a/compiler/rtti.m b/compiler/rtti.m index 1a0a9803f..b2ac2c406 100644 --- a/compiler/rtti.m +++ b/compiler/rtti.m @@ -1875,7 +1875,7 @@ ctor_rtti_name_java_type(RttiName, JavaTypeName, IsArray) :- % so there's no need for the "Ptr" suffixes. string.remove_suffix(GenTypeName0, "Ptr", GenTypeName1) -> - JavaTypeName = "mercury.runtime." ++ GenTypeName1 + JavaTypeName = "jmercury.runtime." ++ GenTypeName1 ; % In C, we do some nasty hacks to represent type class % constraints of different arities as different structures @@ -1884,7 +1884,7 @@ ctor_rtti_name_java_type(RttiName, JavaTypeName, IsArray) :- % (with an extra level of indirection for the array). string.prefix(GenTypeName0, "TypeClassConstraint_") -> - JavaTypeName = "mercury.runtime.TypeClassConstraint" + JavaTypeName = "jmercury.runtime.TypeClassConstraint" ; % In C, we do some nasty hacks to represent type infos % different arities as different structures @@ -1897,9 +1897,9 @@ ctor_rtti_name_java_type(RttiName, JavaTypeName, IsArray) :- ; string.prefix(GenTypeName0, "VA_TypeInfo_Struct") ) -> - JavaTypeName = "mercury.runtime.TypeInfo_Struct" + JavaTypeName = "jmercury.runtime.TypeInfo_Struct" ; - JavaTypeName = "mercury.runtime." ++ GenTypeName0 + JavaTypeName = "jmercury.runtime." ++ GenTypeName0 ). tc_rtti_name_java_type(TCRttiName, JavaTypeName, IsArray) :- @@ -1925,11 +1925,11 @@ tc_rtti_name_java_type(TCRttiName, JavaTypeName, IsArray) :- % (with an extra level of indirection for the array). string.prefix(GenTypeName, "TypeClassConstraint_") -> - JavaTypeName = "mercury.runtime.TypeClassConstraint" + JavaTypeName = "jmercury.runtime.TypeClassConstraint" ; % The rest are all defined in Mercury's Java runtime % (java/runtime/*.java). - JavaTypeName = "mercury.runtime." ++ GenTypeName + JavaTypeName = "jmercury.runtime." ++ GenTypeName ). % ctor_rtti_name_type(RttiName, Type, IsArray) @@ -2149,7 +2149,7 @@ tabling_id_c_type(Id, JavaTypeName, IsArray) :- tabling_id_java_type(Id, JavaTypeName, IsArray) :- % Since tabling is not yet implemented for Java, this is only provisional. tabling_id_base_type(Id, CTypeName, IsArray), - JavaTypeName = "mercury.runtime." ++ CTypeName. + JavaTypeName = "jmercury.runtime." ++ CTypeName. :- pred tabling_id_base_type(proc_tabling_struct_id::in, string::out, is_array::out) is det. diff --git a/java/runtime/Commit.java b/java/runtime/Commit.java index 8ad6490d7..a5f875ba2 100644 --- a/java/runtime/Commit.java +++ b/java/runtime/Commit.java @@ -6,7 +6,7 @@ // This is a throwable class used for the Java implementation of commits. // -package mercury.runtime; +package jmercury.runtime; public class Commit extends java.lang.Error { diff --git a/java/runtime/Constants.java.in b/java/runtime/Constants.java.in index 64ef9628a..2731d32c2 100644 --- a/java/runtime/Constants.java.in +++ b/java/runtime/Constants.java.in @@ -8,7 +8,7 @@ // At the moment it just stores the library version. // -package mercury.runtime; +package jmercury.runtime; public class Constants { public static final java.lang.String MR_VERSION = "@VERSION@"; diff --git a/java/runtime/DuExistInfo.java b/java/runtime/DuExistInfo.java index ba5e4d2ac..0c70de58e 100644 --- a/java/runtime/DuExistInfo.java +++ b/java/runtime/DuExistInfo.java @@ -4,24 +4,23 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; public class DuExistInfo { public int exist_typeinfos_plain; public int exist_typeinfos_in_tci; public int exist_tcis; - public /* final */ mercury.runtime.DuExistLocn[] exist_typeinfo_locns; - public /* final */ mercury.runtime.TypeClassConstraint[] - exist_constraints; + public /* final */ DuExistLocn[] exist_typeinfo_locns; + public /* final */ TypeClassConstraint[] exist_constraints; public DuExistInfo() { } public void init(int typeinfos_plain, int typeinfos_in_tci, int tcis, - mercury.runtime.DuExistLocn[] typeinfo_locns, - mercury.runtime.TypeClassConstraint constraints[]) + DuExistLocn[] typeinfo_locns, + TypeClassConstraint constraints[]) { exist_typeinfos_plain = typeinfos_plain; exist_typeinfos_in_tci = typeinfos_in_tci; diff --git a/java/runtime/DuExistLocn.java b/java/runtime/DuExistLocn.java index 3640ba05e..3611f3c15 100644 --- a/java/runtime/DuExistLocn.java +++ b/java/runtime/DuExistLocn.java @@ -4,7 +4,7 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; // Corresponds to MR_DuExistLocn in runtime/mercury_type_info.h diff --git a/java/runtime/DuFunctorDesc.java b/java/runtime/DuFunctorDesc.java index e8a2e4723..3483500aa 100644 --- a/java/runtime/DuFunctorDesc.java +++ b/java/runtime/DuFunctorDesc.java @@ -4,22 +4,22 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; public class DuFunctorDesc { public java.lang.String du_functor_name; public int du_functor_orig_arity; public int du_functor_arg_type_contains_var; - public mercury.runtime.Sectag_Locn du_functor_sectag_locn; + public Sectag_Locn du_functor_sectag_locn; public int du_functor_primary; public int du_functor_secondary; public int du_functor_ordinal; // XXX PseudoTypeInfo's have not been implemented properly // yet, so this may not be correct. - public /*final*/ mercury.runtime.PseudoTypeInfo[] du_functor_arg_types; + public /*final*/ PseudoTypeInfo[] du_functor_arg_types; public /*final*/ java.lang.String[] du_functor_arg_names; - public /*final*/ mercury.runtime.DuExistInfo du_functor_exist_info; + public /*final*/ DuExistInfo du_functor_exist_info; public DuFunctorDesc() { @@ -37,15 +37,12 @@ public class DuFunctorDesc { du_functor_orig_arity = orig_arity; du_functor_ordinal = ordinal; du_functor_arg_type_contains_var = arg_type_contains_var; - du_functor_sectag_locn = - new mercury.runtime.Sectag_Locn(sectag_locn); + du_functor_sectag_locn = new Sectag_Locn(sectag_locn); du_functor_primary = primary; du_functor_secondary = secondary; du_functor_ordinal = ordinal; - du_functor_arg_types = (mercury.runtime.PseudoTypeInfo []) - arg_types; + du_functor_arg_types = (PseudoTypeInfo []) arg_types; du_functor_arg_names = (java.lang.String []) arg_names; - du_functor_exist_info = - (mercury.runtime.DuExistInfo) exist_info; + du_functor_exist_info = (DuExistInfo) exist_info; } } diff --git a/java/runtime/DuPtagLayout.java b/java/runtime/DuPtagLayout.java index cf569fa60..583f095fb 100644 --- a/java/runtime/DuPtagLayout.java +++ b/java/runtime/DuPtagLayout.java @@ -4,16 +4,15 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; public class DuPtagLayout { public int sectag_sharers; - public mercury.runtime.Sectag_Locn sectag_locn; - public /* final */ mercury.runtime.DuFunctorDesc[] sectag_alternatives; + public Sectag_Locn sectag_locn; + public /* final */ DuFunctorDesc[] sectag_alternatives; - public DuPtagLayout(int sharers, mercury.runtime.Sectag_Locn locn, - mercury.runtime.DuFunctorDesc[] alts) + public DuPtagLayout(int sharers, Sectag_Locn locn, DuFunctorDesc[] alts) { sectag_sharers = sharers; sectag_locn = locn; @@ -22,7 +21,7 @@ public class DuPtagLayout { public DuPtagLayout(int sharers, int locn, DuFunctorDesc[] alts) { sectag_sharers = sharers; - sectag_locn = new mercury.runtime.Sectag_Locn(locn); + sectag_locn = new Sectag_Locn(locn); sectag_alternatives = alts; } } diff --git a/java/runtime/EnumFunctorDesc.java b/java/runtime/EnumFunctorDesc.java index 576622608..a2468fa79 100644 --- a/java/runtime/EnumFunctorDesc.java +++ b/java/runtime/EnumFunctorDesc.java @@ -4,7 +4,7 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; public class EnumFunctorDesc { diff --git a/java/runtime/Exception.java b/java/runtime/Exception.java index 52d3084e6..51943d47d 100644 --- a/java/runtime/Exception.java +++ b/java/runtime/Exception.java @@ -4,7 +4,7 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; public class Exception extends java.lang.Error { // Should be mercury.univ.Univ_0 but we don't want to depend on the diff --git a/java/runtime/ForeignEnumFunctorDesc.java b/java/runtime/ForeignEnumFunctorDesc.java index cddd51b1f..1f18eb7a5 100644 --- a/java/runtime/ForeignEnumFunctorDesc.java +++ b/java/runtime/ForeignEnumFunctorDesc.java @@ -4,7 +4,7 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; public class ForeignEnumFunctorDesc { diff --git a/java/runtime/JavaInternal.java b/java/runtime/JavaInternal.java index 0b638af67..9c4aa1e15 100644 --- a/java/runtime/JavaInternal.java +++ b/java/runtime/JavaInternal.java @@ -14,7 +14,7 @@ // level class. // -package mercury.runtime; +package jmercury.runtime; public class JavaInternal { public static java.lang.String progname; diff --git a/java/runtime/MaybeResAddrFunctorDesc.java b/java/runtime/MaybeResAddrFunctorDesc.java index a0a154731..098fba53a 100644 --- a/java/runtime/MaybeResAddrFunctorDesc.java +++ b/java/runtime/MaybeResAddrFunctorDesc.java @@ -4,7 +4,7 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; public class MaybeResAddrFunctorDesc { public java.lang.String maybe_res_name; diff --git a/java/runtime/MaybeResFunctorDesc.java b/java/runtime/MaybeResFunctorDesc.java index 76531f5ca..db56facf3 100644 --- a/java/runtime/MaybeResFunctorDesc.java +++ b/java/runtime/MaybeResFunctorDesc.java @@ -4,7 +4,7 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; public class MaybeResFunctorDesc { public DuFunctorDesc maybe_res_du; diff --git a/java/runtime/MercuryType.java b/java/runtime/MercuryType.java index 3d0923721..f000c0039 100644 --- a/java/runtime/MercuryType.java +++ b/java/runtime/MercuryType.java @@ -7,7 +7,7 @@ // generated by the Java back-end to implement method pointers in Java. // -package mercury.runtime; +package jmercury.runtime; public interface MercuryType { } diff --git a/java/runtime/MethodPtr.java b/java/runtime/MethodPtr.java index 4c86458f2..c2e5e00e8 100644 --- a/java/runtime/MethodPtr.java +++ b/java/runtime/MethodPtr.java @@ -7,7 +7,7 @@ // generated by the Java back-end to implement method pointers in Java. // -package mercury.runtime; +package jmercury.runtime; public interface MethodPtr { public abstract java.lang.Object call___0_0(java.lang.Object[] args); diff --git a/java/runtime/Mmakefile b/java/runtime/Mmakefile index e73592d84..541ea739c 100644 --- a/java/runtime/Mmakefile +++ b/java/runtime/Mmakefile @@ -3,7 +3,8 @@ # This file may only be copied under the terms of the GNU Library General # Public License - see the file COPYING.LIB in the Mercury distribution. # -# This Makefile compiles the shared object for use with mercury.runtime.Native +# This Makefile compiles the shared object for use with +# jmercury.runtime.Native # MERCURY_DIR = ../.. diff --git a/java/runtime/Native.java.in b/java/runtime/Native.java.in index fdff9604f..5b0726d3e 100644 --- a/java/runtime/Native.java.in +++ b/java/runtime/Native.java.in @@ -12,7 +12,7 @@ // At the moment the only services provided are those relating to timing. // -package mercury.runtime; +package jmercury.runtime; public class Native { /* @@ -86,8 +86,7 @@ public class Native { SHARED_OBJ); if (match.exists() == false) { dir = new java.io.File(dir, - mercury.runtime.Constants. - MR_FULLARCH); + Constants.MR_FULLARCH); match = new java.io.File(dir, SHARED_OBJ); } diff --git a/java/runtime/NotagFunctorDesc.java b/java/runtime/NotagFunctorDesc.java index 8883f5634..dc43aca2e 100644 --- a/java/runtime/NotagFunctorDesc.java +++ b/java/runtime/NotagFunctorDesc.java @@ -4,16 +4,16 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; public class NotagFunctorDesc { public java.lang.String no_tag_functor_name; - public mercury.runtime.PseudoTypeInfo no_tag_functor_arg_type; + public PseudoTypeInfo no_tag_functor_arg_type; public java.lang.String no_tag_functor_arg_name; public NotagFunctorDesc(java.lang.String functor_name, - mercury.runtime.PseudoTypeInfo functor_arg_type, + PseudoTypeInfo functor_arg_type, java.lang.Object functor_arg_name) { no_tag_functor_name = functor_name; diff --git a/java/runtime/PredFunc.java b/java/runtime/PredFunc.java index f36f106c0..5868d83c9 100644 --- a/java/runtime/PredFunc.java +++ b/java/runtime/PredFunc.java @@ -4,7 +4,7 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; public class PredFunc { diff --git a/java/runtime/PseudoTypeInfo.java b/java/runtime/PseudoTypeInfo.java index 7c3a85416..89b807a67 100644 --- a/java/runtime/PseudoTypeInfo.java +++ b/java/runtime/PseudoTypeInfo.java @@ -4,7 +4,7 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; // A PseudoTypeInfo represents a possibly non-ground type. // There are three possible cases: diff --git a/java/runtime/ReservedAddrFunctorDesc.java b/java/runtime/ReservedAddrFunctorDesc.java index 47770a5f8..3baa45240 100644 --- a/java/runtime/ReservedAddrFunctorDesc.java +++ b/java/runtime/ReservedAddrFunctorDesc.java @@ -7,7 +7,7 @@ // This corresponds to the C type MR_ReservedAddrFunctorDesc // in runtime/mercury_type_info.h. -package mercury.runtime; +package jmercury.runtime; public class ReservedAddrFunctorDesc { public java.lang.String ra_functor_name; diff --git a/java/runtime/Sectag_Locn.java b/java/runtime/Sectag_Locn.java index d2c542423..d56e3c3a1 100644 --- a/java/runtime/Sectag_Locn.java +++ b/java/runtime/Sectag_Locn.java @@ -4,7 +4,7 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; public class Sectag_Locn { diff --git a/java/runtime/TypeClassConstraint.java b/java/runtime/TypeClassConstraint.java index 473e43afc..cc4279b42 100644 --- a/java/runtime/TypeClassConstraint.java +++ b/java/runtime/TypeClassConstraint.java @@ -4,7 +4,7 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; // This corresponds to the C type MR_TypeClassConstraint // in runtime/mercury_type_info.h. @@ -18,7 +18,7 @@ public class TypeClassConstraint { } public void init(TypeClassDeclStruct type_class, - // XXX Object[] should be mercury.runtime.PseudoTypeInfo[], + // XXX Object[] should be PseudoTypeInfo[], // but mlds_to_java.m generates Object[] since // init_array/1 doesn't give type info Object[] ptis) diff --git a/java/runtime/TypeClassDeclStruct.java b/java/runtime/TypeClassDeclStruct.java index cba08da74..ce07e955f 100644 --- a/java/runtime/TypeClassDeclStruct.java +++ b/java/runtime/TypeClassDeclStruct.java @@ -4,7 +4,7 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; // This corresponds to the C typedef "MR_TypeClassDeclStruct" // in runtime/mercury_types.h, i.e. the C struct diff --git a/java/runtime/TypeClassId.java b/java/runtime/TypeClassId.java index 032141eca..0f35f7a19 100644 --- a/java/runtime/TypeClassId.java +++ b/java/runtime/TypeClassId.java @@ -4,7 +4,7 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; // This corresponds to the C type MR_TypeClassId // in runtime/mercury_typeclass_info.h. diff --git a/java/runtime/TypeClassMethod.java b/java/runtime/TypeClassMethod.java index 8c40e3da3..379fe972f 100644 --- a/java/runtime/TypeClassMethod.java +++ b/java/runtime/TypeClassMethod.java @@ -4,7 +4,7 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; // This corresponds to the C type MR_TypeClassMethod // in runtime/mercury_typeclass_info.h. diff --git a/java/runtime/TypeCtorInfo_Struct.java b/java/runtime/TypeCtorInfo_Struct.java index 704d874a7..91abf443b 100644 --- a/java/runtime/TypeCtorInfo_Struct.java +++ b/java/runtime/TypeCtorInfo_Struct.java @@ -4,26 +4,26 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; // This corresponds to the C type "struct MR_TypeCtorInfo_Struct" // in runtime/mercury_type_info.h. public class TypeCtorInfo_Struct extends PseudoTypeInfo { - public int arity; - public int type_ctor_version; - public int type_ctor_num_ptags; // if DU - public mercury.runtime.TypeCtorRep type_ctor_rep; - public mercury.runtime.MethodPtr unify_pred; - public mercury.runtime.MethodPtr compare_pred; - public java.lang.String type_ctor_module_name; - public java.lang.String type_ctor_name; - public mercury.runtime.TypeFunctors type_functors; - public mercury.runtime.TypeLayout type_layout; - public int type_ctor_num_functors; - public /* short */ int type_ctor_flags; - public int[] type_functor_number_map; + public int arity; + public int type_ctor_version; + public int type_ctor_num_ptags; // if DU + public TypeCtorRep type_ctor_rep; + public MethodPtr unify_pred; + public MethodPtr compare_pred; + public java.lang.String type_ctor_module_name; + public java.lang.String type_ctor_name; + public TypeFunctors type_functors; + public TypeLayout type_layout; + public int type_ctor_num_functors; + public /* short */ int type_ctor_flags; + public int[] type_functor_number_map; public TypeCtorInfo_Struct() { @@ -33,9 +33,9 @@ public class TypeCtorInfo_Struct extends PseudoTypeInfo { int type_arity, int version, int num_ptags, int rep, Object unify_proc, Object compare_proc, String module, String name, - // mercury.runtime.TypeFunctors + // TypeFunctors java.lang.Object name_ordered_functor_descs, - // mercury.runtime.TypeLayout + // TypeLayout java.lang.Object value_ordered_functor_descs, int num_functors, int flags, int[] functor_number_map) @@ -44,14 +44,12 @@ public class TypeCtorInfo_Struct extends PseudoTypeInfo { type_ctor_version = version; type_ctor_num_ptags = num_ptags; type_ctor_rep = new TypeCtorRep(rep); - unify_pred = (mercury.runtime.MethodPtr) unify_proc; - compare_pred = (mercury.runtime.MethodPtr) compare_proc; + unify_pred = (MethodPtr) unify_proc; + compare_pred = (MethodPtr) compare_proc; type_ctor_module_name = module; type_ctor_name = name; - type_functors = (mercury.runtime.TypeFunctors) - name_ordered_functor_descs; - type_layout = (mercury.runtime.TypeLayout) - value_ordered_functor_descs; + type_functors = (TypeFunctors) name_ordered_functor_descs; + type_layout = (TypeLayout) value_ordered_functor_descs; type_ctor_flags = flags; type_functor_number_map = functor_number_map; } diff --git a/java/runtime/TypeCtorRep.java b/java/runtime/TypeCtorRep.java index ec825152e..71e47efae 100644 --- a/java/runtime/TypeCtorRep.java +++ b/java/runtime/TypeCtorRep.java @@ -4,7 +4,7 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; public class TypeCtorRep { diff --git a/java/runtime/TypeFunctors.java b/java/runtime/TypeFunctors.java index 1cec1783d..c9ea1f912 100644 --- a/java/runtime/TypeFunctors.java +++ b/java/runtime/TypeFunctors.java @@ -4,7 +4,7 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; // XXX In the C backend this was a union. // It might (eventually) be better to have derived classes @@ -16,17 +16,17 @@ package mercury.runtime; public class TypeFunctors { public java.lang.Object functors_init; // the above field should contain one of the following types: - public mercury.runtime.DuFunctorDesc[] functors_du() { - return (mercury.runtime.DuFunctorDesc[]) functors_init; + public DuFunctorDesc[] functors_du() { + return (DuFunctorDesc[]) functors_init; } - public mercury.runtime.EnumFunctorDesc[] functors_enum() { - return (mercury.runtime.EnumFunctorDesc[]) functors_init; + public EnumFunctorDesc[] functors_enum() { + return (EnumFunctorDesc[]) functors_init; } - public mercury.runtime.ForeignEnumFunctorDesc[] functors_foreign_enum() { - return (mercury.runtime.ForeignEnumFunctorDesc[]) functors_init; + public ForeignEnumFunctorDesc[] functors_foreign_enum() { + return (ForeignEnumFunctorDesc[]) functors_init; } - public mercury.runtime.NotagFunctorDesc functors_notag() { - return (mercury.runtime.NotagFunctorDesc) functors_init; + public NotagFunctorDesc functors_notag() { + return (NotagFunctorDesc) functors_init; } public TypeFunctors(java.lang.Object init) { functors_init = init; diff --git a/java/runtime/TypeInfo_Struct.java b/java/runtime/TypeInfo_Struct.java index ed5d2155b..107d59e8f 100644 --- a/java/runtime/TypeInfo_Struct.java +++ b/java/runtime/TypeInfo_Struct.java @@ -4,7 +4,7 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; public class TypeInfo_Struct extends PseudoTypeInfo { diff --git a/java/runtime/TypeLayout.java b/java/runtime/TypeLayout.java index bd2162fb5..cf64392c7 100644 --- a/java/runtime/TypeLayout.java +++ b/java/runtime/TypeLayout.java @@ -4,7 +4,7 @@ // Public License - see the file COPYING.LIB in the Mercury distribution. // -package mercury.runtime; +package jmercury.runtime; public class TypeLayout { // This should hold a value of one of the types @@ -16,8 +16,8 @@ public class TypeLayout { // typedef MR_DuPtagLayout *MR_DuTypeLayout; // so here we just use DuPtagLayout[] // - public mercury.runtime.DuPtagLayout[] layout_du() { - return (mercury.runtime.DuPtagLayout[]) layout_init; + public DuPtagLayout[] layout_du() { + return (DuPtagLayout[]) layout_init; } // @@ -25,8 +25,8 @@ public class TypeLayout { // typedef MR_EnumFunctorDesc **EnumTypeLayout; // so here we just use EnumFunctorDesc[][] // - public mercury.runtime.EnumFunctorDesc[] layout_enum() { - return (mercury.runtime.EnumFunctorDesc[]) layout_init; + public EnumFunctorDesc[] layout_enum() { + return (EnumFunctorDesc[]) layout_init; } // @@ -34,16 +34,16 @@ public class TypeLayout { // typedef MR_NotagFunctorDesc *MR_NotagTypeLayout; // so here we just us NotagFunctorDesc[] // - public mercury.runtime.NotagFunctorDesc[] layout_notag() { - return (mercury.runtime.NotagFunctorDesc[]) layout_init; + public NotagFunctorDesc[] layout_notag() { + return (NotagFunctorDesc[]) layout_init; } // // In runtime/mercury_type_info.h: // typedef MR_PseudoTypeInfo MR_EquivType; // so here we just use MR_PseudoTypeInfo // - public mercury.runtime.PseudoTypeInfo layout_equiv() { - return (mercury.runtime.PseudoTypeInfo) layout_init; + public PseudoTypeInfo layout_equiv() { + return (PseudoTypeInfo) layout_init; } public TypeLayout(java.lang.Object init) { diff --git a/java/runtime/UnreachableDefault.java b/java/runtime/UnreachableDefault.java index eef709f10..dc4c510f3 100644 --- a/java/runtime/UnreachableDefault.java +++ b/java/runtime/UnreachableDefault.java @@ -7,7 +7,7 @@ // statement is reached. // -package mercury.runtime; +package jmercury.runtime; public class UnreachableDefault extends java.lang.RuntimeException { diff --git a/library/Mmakefile b/library/Mmakefile index 45130d3c6..15d5c8326 100644 --- a/library/Mmakefile +++ b/library/Mmakefile @@ -243,10 +243,9 @@ javas: $(STD_LIB_NAME).javas endif # The compiler names Java files differently to the original source files to -# avoid keywords, and will place them in subdirectories to reflect package -# names. Instead of replicating that logic here we just use a wildcard to -# find the file names. -JAVAS = $(wildcard mercury/*.java mercury/*_/*.java) +# avoid keywords. Instead of replicating that logic here we just use a +# wildcard to find the file names. +JAVAS = $(wildcard jmercury/*.java) # We need to invoke javac on all of the classes at the same time, # rather than compiling them separately. This is needed because @@ -261,8 +260,8 @@ classes: javas java_symlinks # the sources. .PHONY: java_symlinks java_symlinks: - [ -d mercury ] || mkdir mercury - [ -d mercury/runtime ] || ln -s ../../java/runtime mercury/runtime + [ -d jmercury ] || mkdir jmercury + [ -d jmercury/runtime ] || ln -s ../../java/runtime jmercury/runtime # Once all of the library classes have been compiled, we put them in a single # jar file. At this point we also add the runtime classes to a jar file. @@ -279,18 +278,14 @@ JARS = $(STD_LIB_NAME).jar $(RT_LIB_NAME).jar # any architecture-specific objects. .PHONY: jars jars: classes - echo mercury/*.class > $(STD_LIB_NAME).classes - echo mercury/bit_buffer_/*.class >> $(STD_LIB_NAME).classes - echo mercury/stream_/*.class >> $(STD_LIB_NAME).classes - echo mercury/string_/*.class >> $(STD_LIB_NAME).classes - echo mercury/thread_/*.class >> $(STD_LIB_NAME).classes + echo jmercury/*.class > $(STD_LIB_NAME).classes $(JAR) $(JAR_CREATE_FLAGS) $(STD_LIB_NAME).jar @$(STD_LIB_NAME).classes $(JAR) i $(STD_LIB_NAME).jar $(RM) $(STD_LIB_NAME).classes - $(JAR) $(JAR_CREATE_FLAGS) $(RT_LIB_NAME).jar mercury/runtime/*.class + $(JAR) $(JAR_CREATE_FLAGS) $(RT_LIB_NAME).jar jmercury/runtime/*.class $(JAR) i $(RT_LIB_NAME).jar - -+cd mercury/runtime && mmake $(NATIVE_SO) - -cp mercury/runtime/$(NATIVE_SO) . + -+cd jmercury/runtime && mmake $(NATIVE_SO) + -cp jmercury/runtime/$(NATIVE_SO) . # This shared object is needed to run some of the standard library methods. NATIVE_SO = Native.$(EXT_FOR_SHARED_LIB) @@ -352,10 +347,15 @@ CSHARP_DLLS = $(CSHARP_MODULES:%=%__csharp_code.dll) $(CSHARP_DLLS) : $(RUNTIME_DLLS) endif + #-----------------------------------------------------------------------------# + +ifneq ($(MMAKE_USE_MMC_MAKE),yes) ifeq ("$(findstring java,$(GRADE))","java") lib_std: jars endif +endif + #-----------------------------------------------------------------------------# # # Some extra rules that we need for the C and asm back-ends diff --git a/library/array.m b/library/array.m index 5541cbbed..f5f90e6b3 100644 --- a/library/array.m +++ b/library/array.m @@ -650,7 +650,7 @@ ML_new_array(int Size, Object Item) java.lang.Class itemClass = Item.getClass(); boolean found = false; for (java.lang.Class iface : itemClass.getInterfaces()) { - if (iface == mercury.runtime.MercuryType.class) { + if (iface == jmercury.runtime.MercuryType.class) { found = true; break; } diff --git a/library/backjump.m b/library/backjump.m index 44b3a2706..f5b1cf75b 100644 --- a/library/backjump.m +++ b/library/backjump.m @@ -428,7 +428,7 @@ mercury_sys_init_backjumps_write_out_proc_statics(FILE *deep_fp, :- pragma foreign_code("Java", " public static void - builtin_choice_id_1_p_0(mercury.runtime.MethodPtr cont, + builtin_choice_id_1_p_0(jmercury.runtime.MethodPtr cont, /* env_ptr */ java.lang.Object cont_env_ptr) { throw new java.lang.Error(""builtin_choice_id/1 not implemented""); diff --git a/library/benchmarking.m b/library/benchmarking.m index 79bf46b83..ac9b7fd8e 100644 --- a/library/benchmarking.m +++ b/library/benchmarking.m @@ -688,8 +688,8 @@ private static int time_at_start = 0; private static int time_at_last_stat = 0; static { - if (mercury.runtime.Native.isAvailable()) { - time_at_start = mercury.runtime.Native.get_user_cpu_milliseconds(); + if (jmercury.runtime.Native.isAvailable()) { + time_at_start = jmercury.runtime.Native.get_user_cpu_milliseconds(); time_at_last_stat = time_at_start; } } @@ -872,8 +872,8 @@ repeat(N) :- get_user_cpu_milliseconds(Time::out), [will_not_call_mercury], " - if (mercury.runtime.Native.isAvailable()) { - Time = mercury.runtime.Native.get_user_cpu_milliseconds(); + if (jmercury.runtime.Native.isAvailable()) { + Time = jmercury.runtime.Native.get_user_cpu_milliseconds(); } else { throw new java.lang.RuntimeException( ""get_user_cpu_milliseconds is not implemented in pure Java."" + @@ -960,7 +960,7 @@ repeat(N) :- } } "). -:- pragma foreign_type(java, int_reference, "mercury.benchmarking.IntRef"). +:- pragma foreign_type(java, int_reference, "benchmarking.IntRef"). % Create a new int_reference given a term for it to reference. :- impure pred new_int_reference(int::in, int_reference::out) is det. @@ -979,7 +979,7 @@ repeat(N) :- new_int_reference(X::in, Ref::out), [will_not_call_mercury], " - Ref = new mercury.benchmarking.IntRef(X); + Ref = new benchmarking.IntRef(X); "). :- impure pred incr_ref(int_reference::in) is det. diff --git a/library/bitmap.m b/library/bitmap.m index 9e03bd3c6..a5bc77555 100644 --- a/library/bitmap.m +++ b/library/bitmap.m @@ -1552,7 +1552,7 @@ public class MercuryBitmap { :- pragma foreign_type("C", bitmap, "MR_BitmapPtr", [can_pass_as_mercury_type]) where equality is bitmap_equal, comparison is bitmap_compare. -:- pragma foreign_type("Java", bitmap, "mercury.bitmap.MercuryBitmap") +:- pragma foreign_type("Java", bitmap, "bitmap.MercuryBitmap") where equality is bitmap_equal, comparison is bitmap_compare. :- pragma foreign_type("IL", bitmap, "class [mercury]mercury.bitmap__csharp_code.mercury_code.MercuryBitmap") @@ -1832,7 +1832,7 @@ _ ^ unsafe_byte(_) = _ :- private_builtin.sorry("bitmap.unsafe_byte"). allocate_bitmap(N::in) = (BM::bitmap_uo), [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail], " - BM = new mercury.bitmap.MercuryBitmap(N); + BM = new bitmap.MercuryBitmap(N); "). :- pragma foreign_proc("C#", diff --git a/library/builtin.m b/library/builtin.m index 4bde842c6..22136ee6b 100644 --- a/library/builtin.m +++ b/library/builtin.m @@ -821,7 +821,7 @@ special__Compare____tuple_0_0(ref object[] result, // We'll only copy objects of Mercury-defined types. We could copy // more but that's what we do for C backends and it's enough. - if (!(original instanceof MercuryType)) { + if (!(original instanceof jmercury.runtime.MercuryType)) { return original; } @@ -1029,42 +1029,42 @@ namespace mercury.builtin { // public static boolean - unify_2_p_0 (mercury.runtime.TypeInfo_Struct ti, + unify_2_p_0 (jmercury.runtime.TypeInfo_Struct ti, java.lang.Object x, java.lang.Object y) { - return mercury.rtti_implementation.generic_unify_2_p_0(ti, x, y); + return jmercury.rtti_implementation.generic_unify_2_p_0(ti, x, y); } public static Comparison_result_0 - compare_3_p_0 (mercury.runtime.TypeInfo_Struct ti, + compare_3_p_0 (jmercury.runtime.TypeInfo_Struct ti, java.lang.Object x, java.lang.Object y) { - return mercury.rtti_implementation.generic_compare_3_p_0(ti, x, y); + return jmercury.rtti_implementation.generic_compare_3_p_0(ti, x, y); } public static Comparison_result_0 - compare_3_p_1 (mercury.runtime.TypeInfo_Struct ti, + compare_3_p_1 (jmercury.runtime.TypeInfo_Struct ti, java.lang.Object x, java.lang.Object y) { return compare_3_p_0(ti, x, y); } public static Comparison_result_0 - compare_3_p_2 (mercury.runtime.TypeInfo_Struct ti, + compare_3_p_2 (jmercury.runtime.TypeInfo_Struct ti, java.lang.Object x, java.lang.Object y) { return compare_3_p_0(ti, x, y); } public static Comparison_result_0 - compare_3_p_3 (mercury.runtime.TypeInfo_Struct ti, + compare_3_p_3 (jmercury.runtime.TypeInfo_Struct ti, java.lang.Object x, java.lang.Object y) { return compare_3_p_0(ti, x, y); } public static Comparison_result_0 - compare_representation_3_p_0 (mercury.runtime.TypeInfo_Struct ti, + compare_representation_3_p_0 (jmercury.runtime.TypeInfo_Struct ti, java.lang.Object x, java.lang.Object y) { // stub only @@ -1099,7 +1099,7 @@ namespace mercury.builtin { } public static boolean - __Unify____void_0_0(mercury.builtin.Void_0 x, mercury.builtin.Void_0 y) + __Unify____void_0_0(builtin.Void_0 x, builtin.Void_0 y) { // there should never be any values of type void/0 throw new java.lang.Error (""unify/2 called for void type""); @@ -1133,7 +1133,7 @@ namespace mercury.builtin { } public static Comparison_result_0 - __Compare____void_0_0(mercury.builtin.Void_0 x, mercury.builtin.Void_0 y) + __Compare____void_0_0(builtin.Void_0 x, builtin.Void_0 y) { // there should never be any values of type void/0 throw new java.lang.Error (""compare/3 called for void type""); diff --git a/library/exception.m b/library/exception.m index a6372e15e..7543a09e9 100644 --- a/library/exception.m +++ b/library/exception.m @@ -1645,7 +1645,7 @@ call_handler(Handler, Exception, Result) :- Handler(Exception, Result). throw_impl(T::in), [will_not_call_mercury, promise_pure], " - throw new mercury.runtime.Exception(T); + throw new jmercury.runtime.Exception(T); "). :- pragma foreign_proc("Java", @@ -1653,13 +1653,15 @@ call_handler(Handler, Exception, Result) :- Handler(Exception, Result). [will_not_call_mercury, promise_pure], " try { - T = mercury.exception.ML_call_goal_det( - (TypeInfo_Struct) TypeInfo_for_T, (Object[]) Pred); + T = exception.ML_call_goal_det( + (jmercury.runtime.TypeInfo_Struct) TypeInfo_for_T, + (Object[]) Pred); } - catch (mercury.runtime.Exception ex) { - T = mercury.exception.ML_call_handler_det( - (TypeInfo_Struct) TypeInfo_for_T, (Object[]) Handler, - (mercury.univ.Univ_0) ex.exception); + catch (jmercury.runtime.Exception ex) { + T = exception.ML_call_handler_det( + (jmercury.runtime.TypeInfo_Struct) TypeInfo_for_T, + (Object[]) Handler, + (univ.Univ_0) ex.exception); } "). :- pragma foreign_proc("Java", @@ -1667,13 +1669,15 @@ call_handler(Handler, Exception, Result) :- Handler(Exception, Result). [will_not_call_mercury, promise_pure], " try { - T = mercury.exception.ML_call_goal_semidet( - (TypeInfo_Struct) TypeInfo_for_T, (Object[]) Pred); + T = exception.ML_call_goal_semidet( + (jmercury.runtime.TypeInfo_Struct) TypeInfo_for_T, + (Object[]) Pred); } - catch (mercury.runtime.Exception ex) { - T = mercury.exception.ML_call_handler_det( - (TypeInfo_Struct) TypeInfo_for_T, (Object[]) Handler, - (mercury.univ.Univ_0) ex.exception); + catch (jmercury.runtime.Exception ex) { + T = exception.ML_call_handler_det( + (jmercury.runtime.TypeInfo_Struct) TypeInfo_for_T, + (Object[]) Handler, + (univ.Univ_0) ex.exception); } "). :- pragma foreign_proc("Java", @@ -1681,13 +1685,15 @@ call_handler(Handler, Exception, Result) :- Handler(Exception, Result). [will_not_call_mercury, promise_pure], " try { - T = mercury.exception.ML_call_goal_det( - (TypeInfo_Struct) TypeInfo_for_T, (Object[]) Pred); + T = exception.ML_call_goal_det( + (jmercury.runtime.TypeInfo_Struct) TypeInfo_for_T, + (Object[]) Pred); } - catch (mercury.runtime.Exception ex) { - T = mercury.exception.ML_call_handler_det( - (TypeInfo_Struct) TypeInfo_for_T, (Object[]) Handler, - (mercury.univ.Univ_0) ex.exception); + catch (jmercury.runtime.Exception ex) { + T = exception.ML_call_handler_det( + (jmercury.runtime.TypeInfo_Struct) TypeInfo_for_T, + (Object[]) Handler, + (univ.Univ_0) ex.exception); } "). :- pragma foreign_proc("Java", @@ -1712,13 +1718,13 @@ call_handler(Handler, Exception, Result) :- Handler(Exception, Result). Object[] Handler = (Object[]) Handler0; try { - mercury.runtime.MethodPtr pred = (mercury.runtime.MethodPtr) Pred[1]; + jmercury.runtime.MethodPtr pred = (jmercury.runtime.MethodPtr) Pred[1]; pred.call___0_0(new java.lang.Object[] { Pred, cont, cont_env_ptr }); } - catch (mercury.runtime.Exception ex) { - Object T = mercury.exception.ML_call_handler_det( - (TypeInfo_Struct) TypeInfo_for_T, Handler, - (mercury.univ.Univ_0) ex.exception); + catch (jmercury.runtime.Exception ex) { + Object T = exception.ML_call_handler_det( + (jmercury.runtime.TypeInfo_Struct) TypeInfo_for_T, Handler, + (univ.Univ_0) ex.exception); cont.call___0_0(new java.lang.Object[] { T, cont_env_ptr }); } "). @@ -1730,13 +1736,13 @@ call_handler(Handler, Exception, Result) :- Handler(Exception, Result). Object[] Handler = (Object[]) Handler0; try { - mercury.runtime.MethodPtr pred = (mercury.runtime.MethodPtr) Pred[1]; + jmercury.runtime.MethodPtr pred = (jmercury.runtime.MethodPtr) Pred[1]; pred.call___0_0(new java.lang.Object[] { Pred, cont, cont_env_ptr }); } - catch (mercury.runtime.Exception ex) { - Object T = mercury.exception.ML_call_handler_det( - (TypeInfo_Struct) TypeInfo_for_T, Handler, - (mercury.univ.Univ_0) ex.exception); + catch (jmercury.runtime.Exception ex) { + Object T = exception.ML_call_handler_det( + (jmercury.runtime.TypeInfo_Struct) TypeInfo_for_T, Handler, + (univ.Univ_0) ex.exception); cont.call___0_0(new java.lang.Object[] { T, cont_env_ptr }); } "). diff --git a/library/io.m b/library/io.m index ffcf12dd6..93e59bca9 100644 --- a/library/io.m +++ b/library/io.m @@ -1792,9 +1792,9 @@ :- pragma foreign_code("Java", " static java.lang.Object ML_io_stream_db = - new mercury.tree234.Tree234_2.Empty_0(); + new tree234.Tree234_2.Empty_0(); static java.lang.Object ML_io_user_globals = - new mercury.tree234.Tree234_2.Empty_0(); + new tree234.Tree234_2.Empty_0(); "). :- type io.stream_putback == map(io.stream_id, list(char)). @@ -1811,7 +1811,7 @@ [can_pass_as_mercury_type]). :- pragma foreign_type("il", io.stream, "class [mercury]mercury.io__csharp_code.MR_MercuryFileStruct"). -:- pragma foreign_type("Java", io.stream, "mercury.io.MR_MercuryFileStruct"). +:- pragma foreign_type("Java", io.stream, "io.MR_MercuryFileStruct"). :- pragma foreign_type("Erlang", io.stream, ""). % A unique identifier for an I/O stream. @@ -2883,7 +2883,7 @@ io.file_modification_time(File, Result, !IO) :- Msg = ""lastModified() failed: "" + e.getMessage(); Status = 0; } - Time = mercury.time.ML_construct_time_t(date); + Time = time.ML_construct_time_t(date); "). :- pragma foreign_proc("Erlang", @@ -3135,11 +3135,11 @@ file_type_implemented :- // directories, and for everything else it just returns unknown. if (file.isFile()) { - Result = new mercury.io.Res_1.Ok_1(ML_file_type_regular()); + Result = new io.Res_1.Ok_1(ML_file_type_regular()); } else if (file.isDirectory()) { - Result = new mercury.io.Res_1.Ok_1(ML_file_type_directory()); + Result = new io.Res_1.Ok_1(ML_file_type_directory()); } else { - Result = new mercury.io.Res_1.Ok_1(ML_file_type_unknown()); + Result = new io.Res_1.Ok_1(ML_file_type_unknown()); } "). @@ -3339,11 +3339,11 @@ io.check_file_accessibility(FileName, AccessTypes, Result, !IO) :- " java.lang.String permissions = null; - if (ML_access_types_includes_read((mercury.list.List_1) AccessTypes)) { + if (ML_access_types_includes_read((list.List_1) AccessTypes)) { permissions = ""read""; } - if (ML_access_types_includes_write((mercury.list.List_1) AccessTypes)) { + if (ML_access_types_includes_write((list.List_1) AccessTypes)) { if (permissions == null) { permissions = ""write""; } else { @@ -3351,7 +3351,7 @@ io.check_file_accessibility(FileName, AccessTypes, Result, !IO) :- } } - if (ML_access_types_includes_execute((mercury.list.List_1) AccessTypes)) + if (ML_access_types_includes_execute((list.List_1) AccessTypes)) { if (permissions == null) { permissions = ""execute""; @@ -9675,21 +9675,21 @@ io.handle_system_command_exit_code(Status0::in) = (Status::out) :- io.progname(_Default::in, PrognameOut::out, _IO0::di, _IO::uo), [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe], " - PrognameOut = mercury.runtime.JavaInternal.progname; + PrognameOut = jmercury.runtime.JavaInternal.progname; "). :- pragma foreign_proc("Java", io.get_exit_status(ExitStatus::out, _IO0::di, _IO::uo), [will_not_call_mercury, promise_pure, tabled_for_io], " - ExitStatus = mercury.runtime.JavaInternal.exit_status; + ExitStatus = jmercury.runtime.JavaInternal.exit_status; "). :- pragma foreign_proc("Java", io.set_exit_status(ExitStatus::in, _IO0::di, _IO::uo), [will_not_call_mercury, promise_pure, tabled_for_io], " - mercury.runtime.JavaInternal.exit_status = ExitStatus; + jmercury.runtime.JavaInternal.exit_status = ExitStatus; "). :- pragma foreign_proc("Erlang", @@ -9747,7 +9747,7 @@ command_line_argument(_, "") :- command_line_argument(ArgNum::in, Arg::out), [will_not_call_mercury, promise_pure, thread_safe], " - String[] arg_vector = mercury.runtime.JavaInternal.args; + String[] arg_vector = jmercury.runtime.JavaInternal.args; if (ArgNum < arg_vector.length && ArgNum >= 0) { Arg = arg_vector[ArgNum]; diff --git a/library/library.m b/library/library.m index 813d8a67a..33f790d9d 100644 --- a/library/library.m +++ b/library/library.m @@ -198,8 +198,8 @@ library.version(Version::out), [will_not_call_mercury, promise_pure], " - Version = mercury.runtime.Constants.MR_VERSION + "" configured for "" - + mercury.runtime.Constants.MR_FULLARCH; + Version = jmercury.runtime.Constants.MR_VERSION + "" configured for "" + + jmercury.runtime.Constants.MR_FULLARCH; "). :- pragma foreign_decl("Erlang", local, " diff --git a/library/mutvar.m b/library/mutvar.m index 46abf56aa..a70360b1d 100644 --- a/library/mutvar.m +++ b/library/mutvar.m @@ -152,13 +152,13 @@ new_mutvar(X, Ref) :- } "). -:- pragma foreign_type("Java", mutvar(T), "mercury.mutvar.Mutvar"). +:- pragma foreign_type("Java", mutvar(T), "mutvar.Mutvar"). :- pragma foreign_proc("Java", new_mutvar0(Ref::uo), [will_not_call_mercury, thread_safe], " - Ref = new mercury.mutvar.Mutvar(); + Ref = new mutvar.Mutvar(); "). :- pragma foreign_proc("Java", diff --git a/library/private_builtin.m b/library/private_builtin.m index 9d0f65d06..58de473fc 100644 --- a/library/private_builtin.m +++ b/library/private_builtin.m @@ -446,7 +446,7 @@ public static object[] MR_typeclass_info_arg_typeclass_info( :- pragma foreign_code("Java", " -public static TypeInfo_Struct +public static jmercury.runtime.TypeInfo_Struct MR_typeclass_info_param_type_info(/* typeclass_info */ Object[] tcinfo, int index) { @@ -455,13 +455,14 @@ MR_typeclass_info_param_type_info(/* typeclass_info */ Object[] tcinfo, base_tcinfo = (Object[]) tcinfo[0]; t1 = ((Integer) base_tcinfo[0]).intValue() + index; - return (TypeInfo_Struct) tcinfo[t1]; + return (jmercury.runtime.TypeInfo_Struct) tcinfo[t1]; } -public static TypeInfo_Struct MR_typeclass_info_instance_tvar_type_info( +public static jmercury.runtime.TypeInfo_Struct +MR_typeclass_info_instance_tvar_type_info( /* typeclass_info */ Object[] tcinfo, int index) { - return (TypeInfo_Struct) tcinfo[index]; + return (jmercury.runtime.TypeInfo_Struct) tcinfo[index]; } public static /* typeclass_info */ Object[] MR_typeclass_info_superclass_info( @@ -475,7 +476,8 @@ public static /* typeclass_info */ Object[] MR_typeclass_info_superclass_info( return (/* typeclass_info */ Object[]) tcinfo[t1]; } -public static /* typeclass_info */ Object[] MR_typeclass_info_arg_typeclass_info( +public static /* typeclass_info */ Object[] +MR_typeclass_info_arg_typeclass_info( /* typeclass_info */ Object[] tcinfo, int index) { return (/* typeclass_info */ Object[]) tcinfo[index]; @@ -1675,9 +1677,8 @@ no_clauses(PredName) :- // public static boolean - __Unify____ref_1_0(mercury.runtime.TypeInfo_Struct ti, - mercury.private_builtin.Ref_1 x, - mercury.private_builtin.Ref_1 y) + __Unify____ref_1_0(jmercury.runtime.TypeInfo_Struct ti, + private_builtin.Ref_1 x, private_builtin.Ref_1 y) { // stub only throw new java.lang.Error @@ -1685,8 +1686,8 @@ no_clauses(PredName) :- } public static boolean - __Unify____heap_pointer_0_0 (mercury.private_builtin.Heap_pointer_0 x, - mercury.private_builtin.Heap_pointer_0 y) + __Unify____heap_pointer_0_0 (private_builtin.Heap_pointer_0 x, + private_builtin.Heap_pointer_0 y) { // stub only throw new java.lang.Error(""unify/2 for type heap_pointer/0""); @@ -1694,8 +1695,8 @@ no_clauses(PredName) :- public static boolean __Unify____type_ctor_info_0_0( - mercury.runtime.TypeCtorInfo_Struct x, - mercury.runtime.TypeCtorInfo_Struct y) + jmercury.runtime.TypeCtorInfo_Struct x, + jmercury.runtime.TypeCtorInfo_Struct y) { // stub only throw new java.lang.Error @@ -1703,9 +1704,9 @@ no_clauses(PredName) :- } public static boolean - __Unify____type_ctor_info_1_0(mercury.runtime.TypeInfo_Struct ti, - mercury.runtime.TypeCtorInfo_Struct x, - mercury.runtime.TypeCtorInfo_Struct y) + __Unify____type_ctor_info_1_0(jmercury.runtime.TypeInfo_Struct ti, + jmercury.runtime.TypeCtorInfo_Struct x, + jmercury.runtime.TypeCtorInfo_Struct y) { // stub only throw new java.lang.Error @@ -1714,8 +1715,8 @@ no_clauses(PredName) :- public static boolean __Unify____type_info_0_0( - mercury.runtime.TypeInfo_Struct x, - mercury.runtime.TypeInfo_Struct y) + jmercury.runtime.TypeInfo_Struct x, + jmercury.runtime.TypeInfo_Struct y) { // stub only throw new java.lang.Error @@ -1723,9 +1724,9 @@ no_clauses(PredName) :- } public static boolean - __Unify____type_info_1_0(mercury.runtime.TypeInfo_Struct ti, - mercury.runtime.TypeInfo_Struct x, - mercury.runtime.TypeInfo_Struct y) + __Unify____type_info_1_0(jmercury.runtime.TypeInfo_Struct ti, + jmercury.runtime.TypeInfo_Struct x, + jmercury.runtime.TypeInfo_Struct y) { // stub only throw new java.lang.Error @@ -1741,7 +1742,7 @@ no_clauses(PredName) :- } public static boolean - __Unify____base_typeclass_info_1_0(mercury.runtime.TypeInfo_Struct ti, + __Unify____base_typeclass_info_1_0(jmercury.runtime.TypeInfo_Struct ti, java.lang.Object[] x, java.lang.Object[] y) { // stub only @@ -1757,7 +1758,7 @@ no_clauses(PredName) :- } public static boolean - __Unify____typeclass_info_1_0(mercury.runtime.TypeInfo_Struct ti, + __Unify____typeclass_info_1_0(jmercury.runtime.TypeInfo_Struct ti, java.lang.Object[] x, java.lang.Object[] y) { // stub only @@ -1765,65 +1766,65 @@ no_clauses(PredName) :- (""unify/2 for type typeclass_info/1""); } - public static mercury.builtin.Comparison_result_0 - __Compare____ref_1_0(mercury.runtime.TypeInfo_Struct ti, - mercury.private_builtin.Ref_1 x, - mercury.private_builtin.Ref_1 y) + public static builtin.Comparison_result_0 + __Compare____ref_1_0(jmercury.runtime.TypeInfo_Struct ti, + private_builtin.Ref_1 x, private_builtin.Ref_1 y) { // stub only throw new java.lang.Error (""called compare/3 for type private_builtin.ref""); } - public static mercury.builtin.Comparison_result_0 - __Compare____heap_pointer_0_0 (mercury.private_builtin.Heap_pointer_0 x, - mercury.private_builtin.Heap_pointer_0 y) + public static builtin.Comparison_result_0 + __Compare____heap_pointer_0_0 ( + private_builtin.Heap_pointer_0 x, + private_builtin.Heap_pointer_0 y) { // stub only throw new java.lang.Error(""compare/2 for type heap_pointer/0""); } - public static mercury.builtin.Comparison_result_0 + public static builtin.Comparison_result_0 __Compare____type_ctor_info_0_0( - mercury.runtime.TypeCtorInfo_Struct x, - mercury.runtime.TypeCtorInfo_Struct y) + jmercury.runtime.TypeCtorInfo_Struct x, + jmercury.runtime.TypeCtorInfo_Struct y) { // stub only throw new java.lang.Error (""compare/2 for type type_ctor_info/1""); } - public static mercury.builtin.Comparison_result_0 - __Compare____type_ctor_info_1_0(mercury.runtime.TypeInfo_Struct ti, - mercury.runtime.TypeCtorInfo_Struct x, - mercury.runtime.TypeCtorInfo_Struct y) + public static builtin.Comparison_result_0 + __Compare____type_ctor_info_1_0(jmercury.runtime.TypeInfo_Struct ti, + jmercury.runtime.TypeCtorInfo_Struct x, + jmercury.runtime.TypeCtorInfo_Struct y) { // stub only throw new java.lang.Error (""compare/2 for type type_ctor_info/1""); } - public static mercury.builtin.Comparison_result_0 + public static builtin.Comparison_result_0 __Compare____type_info_0_0( - mercury.runtime.TypeInfo_Struct x, - mercury.runtime.TypeInfo_Struct y) + jmercury.runtime.TypeInfo_Struct x, + jmercury.runtime.TypeInfo_Struct y) { // stub only throw new java.lang.Error (""compare/2 for type type_info/0""); } - public static mercury.builtin.Comparison_result_0 - __Compare____type_info_1_0(mercury.runtime.TypeInfo_Struct ti, - mercury.runtime.TypeInfo_Struct x, - mercury.runtime.TypeInfo_Struct y) + public static builtin.Comparison_result_0 + __Compare____type_info_1_0(jmercury.runtime.TypeInfo_Struct ti, + jmercury.runtime.TypeInfo_Struct x, + jmercury.runtime.TypeInfo_Struct y) { // stub only throw new java.lang.Error (""compare/2 for type type_info/0""); } - public static mercury.builtin.Comparison_result_0 + public static builtin.Comparison_result_0 __Compare____base_typeclass_info_0_0( java.lang.Object[] x, java.lang.Object[] y) { @@ -1831,15 +1832,15 @@ no_clauses(PredName) :- throw new java.lang.Error(""compare/2 for type typeclass_info/1""); } - public static mercury.builtin.Comparison_result_0 - __Compare____base_typeclass_info_1_0(mercury.runtime.TypeInfo_Struct ti, + public static builtin.Comparison_result_0 + __Compare____base_typeclass_info_1_0(jmercury.runtime.TypeInfo_Struct ti, java.lang.Object[] x, java.lang.Object[] y) { // stub only throw new java.lang.Error(""compare/2 for type typeclass_info/1""); } - public static mercury.builtin.Comparison_result_0 + public static builtin.Comparison_result_0 __Compare____typeclass_info_0_0(java.lang.Object[] x, java.lang.Object[] y) { // stub only @@ -1847,8 +1848,8 @@ no_clauses(PredName) :- (""compare/2 for type typeclass_info/0""); } - public static mercury.builtin.Comparison_result_0 - __Compare____typeclass_info_1_0(mercury.runtime.TypeInfo_Struct ti, + public static builtin.Comparison_result_0 + __Compare____typeclass_info_1_0(jmercury.runtime.TypeInfo_Struct ti, java.lang.Object[] x, java.lang.Object[] y) { // stub only diff --git a/library/rtti_implementation.m b/library/rtti_implementation.m index ddcee89f7..826eae0c1 100644 --- a/library/rtti_implementation.m +++ b/library/rtti_implementation.m @@ -162,21 +162,20 @@ :- type type_ctor_info ---> type_ctor_info(c_pointer). :- pragma foreign_type("Java", type_ctor_info, - "mercury.runtime.TypeCtorInfo_Struct"). + "jmercury.runtime.TypeCtorInfo_Struct"). :- type type_info ---> type_info(c_pointer). -:- pragma foreign_type("Java", type_info, - "mercury.runtime.TypeInfo_Struct"). +:- pragma foreign_type("Java", type_info, "jmercury.runtime.TypeInfo_Struct"). :- type type_layout ---> type_layout(c_pointer). -:- pragma foreign_type("Java", type_layout, "mercury.runtime.TypeLayout"). +:- pragma foreign_type("Java", type_layout, "jmercury.runtime.TypeLayout"). :- type pseudo_type_info ---> pseudo_type_info(int). % This should be a dummy type. The non-dummy definition is a workaround % for a bug in the Erlang backend that generates invalid code for the % dummy type. :- pragma foreign_type("Java", pseudo_type_info, - "mercury.runtime.PseudoTypeInfo"). + "jmercury.runtime.PseudoTypeInfo"). :- type typeclass_info ---> typeclass_info(c_pointer). :- pragma foreign_type("Java", typeclass_info, "java.lang.Object[]"). @@ -421,7 +420,7 @@ get_functor_notag(TypeCtorRep, TypeCtorInfo, FunctorNumber, FunctorName, Arity, [will_not_call_mercury, promise_pure, thread_safe], " // XXX why is the cast needed here? - TypeInfo = (mercury.runtime.TypeInfo_Struct) TypeInfo_for_T; + TypeInfo = (jmercury.runtime.TypeInfo_Struct) TypeInfo_for_T; "). :- pragma foreign_proc("C#", @@ -638,7 +637,7 @@ compare_tuple_pos(Loc, TupleArity, TypeInfo, Result, TermA, TermB) :- ---> unify_or_compare_pred. :- pragma foreign_type("Java", unify_or_compare_pred, - "mercury.runtime.MethodPtr"). + "jmercury.runtime.MethodPtr"). :- pred semidet_call_3(P::in, T::in, U::in) is semidet. semidet_call_3(_::in, _::in, _::in) :- @@ -795,7 +794,7 @@ result_call_9(_::in, (=)::out, _::in, _::in, _::in, _::in, _::in, semidet_call_3(Pred::in, X::in, Y::in), [will_not_call_mercury, promise_pure, thread_safe], " - MethodPtr P = (MethodPtr) Pred; + jmercury.runtime.MethodPtr P = (jmercury.runtime.MethodPtr) Pred; Object res = P.call___0_0(new Object[] { X, Y }); succeeded = ((Boolean) res).booleanValue(); "). @@ -803,7 +802,7 @@ result_call_9(_::in, (=)::out, _::in, _::in, _::in, _::in, _::in, semidet_call_4(Pred::in, A::in, X::in, Y::in), [will_not_call_mercury, promise_pure, thread_safe], " - MethodPtr P = (MethodPtr) Pred; + jmercury.runtime.MethodPtr P = (jmercury.runtime.MethodPtr) Pred; Object res = P.call___0_0(new Object[] { A, X, Y }); succeeded = ((Boolean) res).booleanValue(); "). @@ -811,7 +810,7 @@ result_call_9(_::in, (=)::out, _::in, _::in, _::in, _::in, _::in, semidet_call_5(Pred::in, A::in, B::in, X::in, Y::in), [will_not_call_mercury, promise_pure, thread_safe], " - MethodPtr P = (MethodPtr) Pred; + jmercury.runtime.MethodPtr P = (jmercury.runtime.MethodPtr) Pred; Object res = P.call___0_0(new Object[] { A, B, X, Y }); succeeded = ((Boolean) res).booleanValue(); "). @@ -819,7 +818,7 @@ result_call_9(_::in, (=)::out, _::in, _::in, _::in, _::in, _::in, semidet_call_6(Pred::in, A::in, B::in, C::in, X::in, Y::in), [will_not_call_mercury, promise_pure, thread_safe], " - MethodPtr P = (MethodPtr) Pred; + jmercury.runtime.MethodPtr P = (jmercury.runtime.MethodPtr) Pred; Object res = P.call___0_0(new Object[] { A, B, C, X, Y }); succeeded = ((Boolean) res).booleanValue(); "). @@ -827,7 +826,7 @@ result_call_9(_::in, (=)::out, _::in, _::in, _::in, _::in, _::in, semidet_call_7(Pred::in, A::in, B::in, C::in, D::in, X::in, Y::in), [will_not_call_mercury, promise_pure, thread_safe], " - MethodPtr P = (MethodPtr) Pred; + jmercury.runtime.MethodPtr P = (jmercury.runtime.MethodPtr) Pred; Object res = P.call___0_0(new Object[] { A, B, C, D, X, Y }); succeeded = ((Boolean) res).booleanValue(); "). @@ -835,7 +834,7 @@ result_call_9(_::in, (=)::out, _::in, _::in, _::in, _::in, _::in, semidet_call_8(Pred::in, A::in, B::in, C::in, D::in, E::in, X::in, Y::in), [will_not_call_mercury, promise_pure, thread_safe], " - MethodPtr P = (MethodPtr) Pred; + jmercury.runtime.MethodPtr P = (jmercury.runtime.MethodPtr) Pred; Object res = P.call___0_0(new Object[] { A, B, C, D, E, X, Y }); succeeded = ((Boolean) res).booleanValue(); "). @@ -844,7 +843,7 @@ result_call_9(_::in, (=)::out, _::in, _::in, _::in, _::in, _::in, result_call_4(Pred::in, Res::out, X::in, Y::in), [will_not_call_mercury, promise_pure, thread_safe], " - MethodPtr P = (MethodPtr) Pred; + jmercury.runtime.MethodPtr P = (jmercury.runtime.MethodPtr) Pred; Res = P.call___0_0(new Object[] { X, Y }); "). @@ -852,28 +851,28 @@ result_call_9(_::in, (=)::out, _::in, _::in, _::in, _::in, _::in, result_call_5(Pred::in, Res::out, A::in, X::in, Y::in), [will_not_call_mercury, promise_pure, thread_safe], " - MethodPtr P = (MethodPtr) Pred; + jmercury.runtime.MethodPtr P = (jmercury.runtime.MethodPtr) Pred; Res = P.call___0_0(new Object[] { A, X, Y }); "). :- pragma foreign_proc("Java", result_call_6(Pred::in, Res::out, A::in, B::in, X::in, Y::in), [will_not_call_mercury, promise_pure, thread_safe], " - MethodPtr P = (MethodPtr) Pred; + jmercury.runtime.MethodPtr P = (jmercury.runtime.MethodPtr) Pred; Res = P.call___0_0(new Object[] { A, B, X, Y }); "). :- pragma foreign_proc("Java", result_call_7(Pred::in, Res::out, A::in, B::in, C::in, X::in, Y::in), [will_not_call_mercury, promise_pure, thread_safe], " - MethodPtr P = (MethodPtr) Pred; + jmercury.runtime.MethodPtr P = (jmercury.runtime.MethodPtr) Pred; Res = P.call___0_0(new Object[] { A, B, C, X, Y }); "). :- pragma foreign_proc("Java", result_call_8(Pred::in, Res::out, A::in, B::in, C::in, D::in, X::in, Y::in), [will_not_call_mercury, promise_pure, thread_safe], " - MethodPtr P = (MethodPtr) Pred; + jmercury.runtime.MethodPtr P = (jmercury.runtime.MethodPtr) Pred; Res = P.call___0_0(new Object[] { A, B, C, D, X, Y }); "). :- pragma foreign_proc("Java", @@ -881,7 +880,7 @@ result_call_9(_::in, (=)::out, _::in, _::in, _::in, _::in, _::in, X::in, Y::in), [will_not_call_mercury, promise_pure, thread_safe], " - MethodPtr P = (MethodPtr) Pred; + jmercury.runtime.MethodPtr P = (jmercury.runtime.MethodPtr) Pred; Res = P.call___0_0(new Object[] { A, B, C, D, E, X, Y }); "). @@ -1665,10 +1664,10 @@ type_info_from_pseudo_type_info(PseudoTypeInfo) = TypeInfo :- type_info_from_pseudo_type_info(PseudoTypeInfo::in) = (TypeInfo::out), [will_not_call_mercury, promise_pure, thread_safe], " - if (PseudoTypeInfo instanceof TypeCtorInfo_Struct) { - TypeInfo = new TypeInfo_Struct((TypeCtorInfo_Struct) PseudoTypeInfo); + if (PseudoTypeInfo instanceof jmercury.runtime.TypeCtorInfo_Struct) { + TypeInfo = new jmercury.runtime.TypeInfo_Struct((jmercury.runtime.TypeCtorInfo_Struct) PseudoTypeInfo); } else { - TypeInfo = (TypeInfo_Struct) PseudoTypeInfo; + TypeInfo = (jmercury.runtime.TypeInfo_Struct) PseudoTypeInfo; } "). @@ -2029,26 +2028,26 @@ get_remote_secondary_tag(_::in) = (0::out) :- ; stag_remote ; stag_variable. -% :- pragma foreign_type("Java", sectag_locn, "mercury.runtime.Sectag_Locn"). +% :- pragma foreign_type("Java", sectag_locn, "jmercury.runtime.Sectag_Locn"). :- type du_sectag_alternatives ---> du_sectag_alternatives(c_pointer). :- pragma foreign_type("Java", du_sectag_alternatives, - "mercury.runtime.DuFunctorDesc[]"). + "jmercury.runtime.DuFunctorDesc[]"). :- type ptag_entry ---> ptag_entry(c_pointer). -:- pragma foreign_type("Java", ptag_entry, "mercury.runtime.DuPtagLayout"). +:- pragma foreign_type("Java", ptag_entry, "jmercury.runtime.DuPtagLayout"). :- type arg_types ---> arg_types(c_pointer). -:- pragma foreign_type("Java", arg_types, "mercury.runtime.PseudoTypeInfo[]"). +:- pragma foreign_type("Java", arg_types, "jmercury.runtime.PseudoTypeInfo[]"). :- type arg_names ---> arg_names(c_pointer). :- pragma foreign_type("Java", arg_names, "java.lang.String[]"). :- type exist_info ---> exist_info(c_pointer). -:- pragma foreign_type("Java", exist_info, "mercury.runtime.DuExistInfo"). +:- pragma foreign_type("Java", exist_info, "jmercury.runtime.DuExistInfo"). :- type typeinfo_locn ---> typeinfo_locn(c_pointer). -:- pragma foreign_type("Java", typeinfo_locn, "mercury.runtime.DuExistLocn"). +:- pragma foreign_type("Java", typeinfo_locn, "jmercury.runtime.DuExistLocn"). :- func ptag_index(int, type_layout) = ptag_entry. @@ -2089,10 +2088,9 @@ sectag_locn(_) = _ :- sectag_locn(PTagEntry::in) = (SectagLocn::out), [will_not_call_mercury, promise_pure, thread_safe], " - mercury.runtime.Sectag_Locn SL_struct = PTagEntry.sectag_locn; + jmercury.runtime.Sectag_Locn SL_struct = PTagEntry.sectag_locn; - SectagLocn = new mercury.rtti_implementation.Sectag_locn_0( - SL_struct.value); + SectagLocn = new rtti_implementation.Sectag_locn_0(SL_struct.value); "). :- func du_sectag_alternatives(int, ptag_entry) = du_functor_desc. @@ -2238,13 +2236,13 @@ get_type_info_from_term(_, _) = _ :- [will_not_call_mercury, promise_pure, thread_safe], " if (Term instanceof Object[]) { - TypeInfo = (TypeInfo_Struct) ((Object[]) Term)[Index]; + TypeInfo = (jmercury.runtime.TypeInfo_Struct) ((Object[]) Term)[Index]; } else { try { // The F field variables are numbered from 1. int i = 1 + Index; Field f = Term.getClass().getDeclaredField(""F"" + i); - TypeInfo = (TypeInfo_Struct) f.get(Term); + TypeInfo = (jmercury.runtime.TypeInfo_Struct) f.get(Term); } catch (IllegalAccessException e) { throw new Error(e); } catch (NoSuchFieldException e) { @@ -2296,7 +2294,7 @@ var_arity_type_info_index(TypeInfo, Index) = % The generic definition of var_arity_type_info_index assumes that % variable arity type_infos store the arity in the first word but that's - % not true for the TypeInfo_Struct in Java. + % not true for the jmercury.runtime.TypeInfo_Struct in Java. % % Keep this in sync with the Java version of type_info_index. % @@ -2309,7 +2307,8 @@ var_arity_type_info_index(TypeInfo, Index) = // Variable numbers count from one. assert VarNum != 0; - TypeInfoAtIndex = (TypeInfo_Struct) TypeInfo.args[VarNum - 1]; + TypeInfoAtIndex = + (jmercury.runtime.TypeInfo_Struct) TypeInfo.args[VarNum - 1]; "). :- func type_info_index(type_info, int) = type_info. @@ -2336,7 +2335,8 @@ type_info_index(TypeInfo, _) = TypeInfo :- // Variable numbers count from one. assert VarNum != 0; - TypeInfoAtIndex = (TypeInfo_Struct) TypeInfo.args[VarNum - 1]; + TypeInfoAtIndex = + (jmercury.runtime.TypeInfo_Struct) TypeInfo.args[VarNum - 1]; "). :- pred set_type_info_index(int::in, int::in, type_info::in, @@ -2634,23 +2634,23 @@ type_ctor_num_functors(_) = _ :- :- type type_functors ---> type_functors(c_pointer). :- pragma foreign_type("Java", type_functors, - "mercury.runtime.TypeFunctors"). + "jmercury.runtime.TypeFunctors"). :- type du_functor_desc ---> du_functor_desc(c_pointer). :- pragma foreign_type("Java", du_functor_desc, - "mercury.runtime.DuFunctorDesc"). + "jmercury.runtime.DuFunctorDesc"). :- type enum_functor_desc ---> enum_functor_desc(c_pointer). :- pragma foreign_type("Java", enum_functor_desc, - "mercury.runtime.EnumFunctorDesc"). + "jmercury.runtime.EnumFunctorDesc"). :- type foreign_enum_functor_desc ---> foreign_enum_functor_desc(c_pointer). :- pragma foreign_type("Java", foreign_enum_functor_desc, - "mercury.runtime.ForeignEnumFunctorDesc"). + "jmercury.runtime.ForeignEnumFunctorDesc"). :- type notag_functor_desc ---> notag_functor_desc(c_pointer). :- pragma foreign_type("Java", notag_functor_desc, - "mercury.runtime.NotagFunctorDesc"). + "jmercury.runtime.NotagFunctorDesc"). :- inst du == bound(tcr_du ; tcr_du_usereq ; tcr_reserved_addr ; tcr_reserved_addr_usereq). diff --git a/library/store.m b/library/store.m index 6723b2d79..ecd3ea375 100644 --- a/library/store.m +++ b/library/store.m @@ -342,13 +342,13 @@ store.new(S) :- S = S0; "). -:- pragma foreign_type(java, generic_mutvar(T, S), "mercury.mutvar.Mutvar"). +:- pragma foreign_type(java, generic_mutvar(T, S), "mutvar.Mutvar"). :- pragma foreign_proc("Java", new_mutvar(Val::in, Mutvar::out, _S0::di, _S::uo), [will_not_call_mercury, promise_pure], " - Mutvar = new mercury.mutvar.Mutvar(Val); + Mutvar = new mutvar.Mutvar(Val); "). :- pragma foreign_proc("Java", @@ -416,7 +416,7 @@ copy_mutvar(Mutvar, Copy, !S) :- unsafe_new_uninitialized_mutvar(Mutvar::out, _S0::di, _S::uo), [will_not_call_mercury, promise_pure], " - Mutvar = new mercury.mutvar.Mutvar(); + Mutvar = new mutvar.Mutvar(); "). store.new_cyclic_mutvar(Func, MutVar, !Store) :- @@ -426,7 +426,7 @@ store.new_cyclic_mutvar(Func, MutVar, !Store) :- %-----------------------------------------------------------------------------% -:- pragma foreign_type(java, generic_ref(T, S), "mercury.store.Ref"). +:- pragma foreign_type(java, generic_ref(T, S), "store.Ref"). :- pragma foreign_code("Java", " public static class Ref { @@ -521,7 +521,7 @@ store.new_cyclic_mutvar(Func, MutVar, !Store) :- new_ref(Val::di, Ref::out, _S0::di, _S::uo), [will_not_call_mercury, promise_pure], " - Ref = new mercury.store.Ref(Val); + Ref = new store.Ref(Val); "). :- pragma foreign_proc("Erlang", @@ -621,7 +621,7 @@ ref_functor(Ref, Functor, Arity, !Store) :- ** This will require RTTI. */ - ArgRef = new mercury.store.Ref(Ref.getValue(), ArgNum); + ArgRef = new store.Ref(Ref.getValue(), ArgNum); "). :- pragma foreign_proc("C", @@ -680,7 +680,7 @@ ref_functor(Ref, Functor, Arity, !Store) :- ** This will require RTTI. */ - ArgRef = new mercury.store.Ref(Val, ArgNum); + ArgRef = new store.Ref(Val, ArgNum); "). :- pragma foreign_proc("C", @@ -745,7 +745,7 @@ ref_functor(Ref, Functor, Arity, !Store) :- unsafe_arg_ref(Ref::in, Arg::in, ArgRef::out, _S0::di, _S::uo), [will_not_call_mercury, promise_pure], " - ArgRef = new mercury.store.Ref(Ref.getValue(), Arg); + ArgRef = new store.Ref(Ref.getValue(), Arg); "). :- pragma foreign_proc("C", @@ -764,5 +764,5 @@ ref_functor(Ref, Functor, Arity, !Store) :- unsafe_new_arg_ref(Val::di, Arg::in, ArgRef::out, _S0::di, _S::uo), [will_not_call_mercury, promise_pure], " - ArgRef = new mercury.store.Ref(Val, Arg); + ArgRef = new store.Ref(Val, Arg); "). diff --git a/library/string.m b/library/string.m index 09481d9ee..e99610028 100644 --- a/library/string.m +++ b/library/string.m @@ -1425,9 +1425,8 @@ string.from_char_list(Chars::in, Str::uo) :- does_not_affect_liveness], " java.lang.StringBuilder sb = new StringBuilder(); - while (CharList instanceof mercury.list.List_1.F_cons_2) { - mercury.list.List_1.F_cons_2 cons = - (mercury.list.List_1.F_cons_2) CharList; + while (CharList instanceof list.List_1.F_cons_2) { + list.List_1.F_cons_2 cons = (list.List_1.F_cons_2) CharList; char c = ((java.lang.Character) cons.F1).charValue(); sb.append(c); CharList = cons.F2; @@ -1655,9 +1654,8 @@ string.append_list(Lists, string.append_list(Lists)). does_not_affect_liveness], " java.lang.StringBuilder sb = new java.lang.StringBuilder(); - while (Strs instanceof mercury.list.List_1.F_cons_2) { - mercury.list.List_1.F_cons_2 cons = - (mercury.list.List_1.F_cons_2) Strs; + while (Strs instanceof list.List_1.F_cons_2) { + list.List_1.F_cons_2 cons = (list.List_1.F_cons_2) Strs; java.lang.String s = (java.lang.String) cons.F1; sb.append(s); Strs = cons.F2; diff --git a/library/time.m b/library/time.m index a3ba3e8fc..008d03417 100644 --- a/library/time.m +++ b/library/time.m @@ -279,8 +279,8 @@ time.clock(Result, !IO) :- time.c_clock(Ret::out, _IO0::di, _IO::uo), [will_not_call_mercury, promise_pure, tabled_for_io], " - if (mercury.runtime.Native.isAvailable()) { - Ret = mercury.runtime.Native.clock(); + if (jmercury.runtime.Native.isAvailable()) { + Ret = jmercury.runtime.Native.clock(); } else { throw new java.lang.RuntimeException( ""time.clock is not implemented "" + @@ -310,8 +310,8 @@ time.clock(Result, !IO) :- time.clocks_per_sec = (Ret::out), [will_not_call_mercury, promise_pure, thread_safe], " - if (mercury.runtime.Native.isAvailable()) { - Ret = mercury.runtime.Native.clocks_per_sec(); + if (jmercury.runtime.Native.isAvailable()) { + Ret = jmercury.runtime.Native.clocks_per_sec(); } else { throw new java.lang.RuntimeException( ""time.clocks_per_sec is not implemented "" + @@ -392,8 +392,8 @@ time.times(Tms, Result, !IO) :- _IO0::di, _IO::uo), [will_not_call_mercury, promise_pure, tabled_for_io], " - if (mercury.runtime.Native.isAvailable()) { - int[] times = mercury.runtime.Native.times(); + if (jmercury.runtime.Native.isAvailable()) { + int[] times = jmercury.runtime.Native.times(); if (times != null) { Ret = times[0]; Ut = times[1]; @@ -448,8 +448,8 @@ time.c_clk_tck = -1. % default is to throw an exception. time.c_clk_tck = (Ret::out), [will_not_call_mercury, promise_pure, thread_safe], " - if (mercury.runtime.Native.isAvailable()) { - Ret = mercury.runtime.Native.clk_tck(); + if (jmercury.runtime.Native.isAvailable()) { + Ret = jmercury.runtime.Native.clk_tck(); } else { throw new java.lang.RuntimeException( ""time.clk_tck is not implemented "" + diff --git a/library/type_desc.m b/library/type_desc.m index 3ef1f8f14..307634bff 100644 --- a/library/type_desc.m +++ b/library/type_desc.m @@ -264,7 +264,7 @@ type_desc_to_type_info(TypeDesc, TypeInfo) :- type_desc_to_type_info(TypeDesc::in, TypeInfo::out), [will_not_call_mercury, promise_pure, thread_safe], " - TypeInfo = ((mercury.type_desc.Type_desc_0) TypeDesc).struct; + TypeInfo = ((type_desc.Type_desc_0) TypeDesc).struct; "). type_info_to_type_desc(TypeInfo, TypeDesc) :- @@ -278,7 +278,7 @@ type_info_to_type_desc(TypeInfo, TypeDesc) :- type_info_to_type_desc(TypeInfo::in, TypeDesc::out), [will_not_call_mercury, promise_pure, thread_safe], " - TypeDesc = new mercury.type_desc.Type_desc_0(TypeInfo); + TypeDesc = new type_desc.Type_desc_0(TypeInfo); "). type_info_list_to_type_desc_list(TypeInfoList, TypeDescList) :- @@ -299,7 +299,7 @@ type_ctor_desc_to_type_ctor_info(TypeCtorDesc, TypeCtorInfo) :- type_ctor_desc_to_type_ctor_info(TypeCtorDesc::in, TypeCtorInfo::out), [will_not_call_mercury, promise_pure, thread_safe], " - TypeCtorInfo = ((mercury.type_desc.Type_ctor_desc_0) TypeCtorDesc).struct; + TypeCtorInfo = ((type_desc.Type_ctor_desc_0) TypeCtorDesc).struct; "). type_ctor_info_to_type_ctor_desc(TypeCtorInfo, TypeCtorDesc) :- @@ -313,7 +313,7 @@ type_ctor_info_to_type_ctor_desc(TypeCtorInfo, TypeCtorDesc) :- type_ctor_info_to_type_ctor_desc(TypeCtorInfo::in, TypeCtorDesc::out), [will_not_call_mercury, promise_pure, thread_safe], " - TypeCtorDesc = new mercury.type_desc.Type_ctor_desc_0(TypeCtorInfo); + TypeCtorDesc = new type_desc.Type_ctor_desc_0(TypeCtorInfo); "). :- pred type_info_desc_same_representation is semidet. @@ -570,8 +570,8 @@ ground_pseudo_type_desc_to_type_desc_det(PseudoTypeDesc) = TypeDesc :- type_of(_Value::unused) = (TypeInfo::out), [will_not_call_mercury, thread_safe, promise_pure], " - TypeInfo = new mercury.type_desc.Type_desc_0( - (mercury.runtime.TypeInfo_Struct) TypeInfo_for_T); + TypeInfo = new type_desc.Type_desc_0( + (jmercury.runtime.TypeInfo_Struct) TypeInfo_for_T); "). :- pragma foreign_proc("Erlang", @@ -599,7 +599,7 @@ ground_pseudo_type_desc_to_type_desc_det(PseudoTypeDesc) = TypeDesc :- has_type(_Arg::unused, TypeInfo::in), [will_not_call_mercury, thread_safe, promise_pure], " - TypeInfo_for_T = ((mercury.type_desc.Type_desc_0) TypeInfo).struct; + TypeInfo_for_T = ((type_desc.Type_desc_0) TypeInfo).struct; "). :- pragma foreign_proc("Erlang", @@ -781,20 +781,20 @@ type_ctor(TypeDesc) = TypeCtorDesc :- [may_call_mercury, thread_safe, promise_pure, terminates], " java.lang.Object [] result = - mercury.rtti_implementation.type_ctor_and_args_3_p_0( - ((mercury.type_desc.Type_desc_0) TypeDesc).struct); + rtti_implementation.type_ctor_and_args_3_p_0( + ((type_desc.Type_desc_0) TypeDesc).struct); - TypeCtorDesc = new Type_ctor_desc_0((TypeCtorInfo_Struct) result[0]); + TypeCtorDesc = new Type_ctor_desc_0( + (jmercury.runtime.TypeCtorInfo_Struct) result[0]); ArgTypes = result[1]; - // Convert list from TypeInfo_Struct to type_desc_0 - mercury.list.List_1 type_list = (mercury.list.List_1) ArgTypes; + // Convert list from jmercury.runtime.TypeInfo_Struct to type_desc_0 + list.List_1 type_list = (list.List_1) ArgTypes; while (type_list.data_tag == 1) { - ((mercury.list.List_1.F_cons_2) type_list).F1 = - new mercury.type_desc.Type_desc_0( - (TypeInfo_Struct) ((mercury.list.List_1.F_cons_2) type_list).F1); - type_list = (mercury.list.List_1) - ((mercury.list.List_1.F_cons_2) type_list).F2; + ((list.List_1.F_cons_2) type_list).F1 = + new type_desc.Type_desc_0((jmercury.runtime.TypeInfo_Struct) + ((list.List_1.F_cons_2) type_list).F1); + type_list = (list.List_1) ((list.List_1.F_cons_2) type_list).F2; } "). @@ -948,7 +948,7 @@ make_type(_TypeCtorDesc::out, _ArgTypes::out) = (_TypeDesc::in) :- TypeCtorName::out, TypeCtorArity::out), [will_not_call_mercury, thread_safe, promise_pure], " - Object[] result = mercury.rtti_implementation. + Object[] result = rtti_implementation. type_ctor_name_and_arity_4_p_0( ((Type_ctor_desc_0) TypeCtorDesc).struct); @@ -992,50 +992,48 @@ get_type_info_for_type_info = TypeDesc :- :- pragma foreign_code("Java", " public static class Type_desc_0 { - public mercury.runtime.TypeInfo_Struct struct; + public jmercury.runtime.TypeInfo_Struct struct; - public Type_desc_0(mercury.runtime.TypeInfo_Struct init) { + public Type_desc_0(jmercury.runtime.TypeInfo_Struct init) { struct = init; } } public static class Type_ctor_desc_0 { - public mercury.runtime.TypeCtorInfo_Struct struct; + public jmercury.runtime.TypeCtorInfo_Struct struct; - public Type_ctor_desc_0( - mercury.runtime.TypeCtorInfo_Struct init) + public Type_ctor_desc_0(jmercury.runtime.TypeCtorInfo_Struct init) { struct = init; } } public static boolean - __Unify____type_desc_0_0(mercury.type_desc.Type_desc_0 x, - mercury.type_desc.Type_desc_0 y) + __Unify____type_desc_0_0(type_desc.Type_desc_0 x, type_desc.Type_desc_0 y) { return x.struct.unify(y.struct); } public static boolean - __Unify____type_ctor_desc_0_0(mercury.type_desc.Type_ctor_desc_0 x, - mercury.type_desc.Type_ctor_desc_0 y) + __Unify____type_ctor_desc_0_0(type_desc.Type_ctor_desc_0 x, + type_desc.Type_ctor_desc_0 y) { // stub only throw new java.lang.Error (""unify/2 for type_ctor_desc type not implemented""); } - public static mercury.builtin.Comparison_result_0 - __Compare____type_desc_0_0(mercury.type_desc.Type_desc_0 x, - mercury.type_desc.Type_desc_0 y) + public static builtin.Comparison_result_0 + __Compare____type_desc_0_0(type_desc.Type_desc_0 x, + type_desc.Type_desc_0 y) { // stub only throw new java.lang.Error (""compare/3 for type_desc type implemented""); } - public static mercury.builtin.Comparison_result_0 - __Compare____type_ctor_desc_0_0(mercury.type_desc.Type_ctor_desc_0 x, - mercury.type_desc.Type_ctor_desc_0 y) + public static builtin.Comparison_result_0 + __Compare____type_ctor_desc_0_0(type_desc.Type_ctor_desc_0 x, + type_desc.Type_ctor_desc_0 y) { // stub only throw new java.lang.Error @@ -1047,19 +1045,17 @@ get_type_info_for_type_info = TypeDesc :- } public static boolean - __Unify____pseudo_type_desc_0_0( - mercury.type_desc.Pseudo_type_desc_0 x, - mercury.type_desc.Pseudo_type_desc_0 y) + __Unify____pseudo_type_desc_0_0(type_desc.Pseudo_type_desc_0 x, + type_desc.Pseudo_type_desc_0 y) { // stub only throw new java.lang.Error( ""__Unify____type_ctor_desc_0_0 not implemented""); } - public static mercury.builtin.Comparison_result_0 - __Compare____pseudo_type_desc_0_0( - mercury.type_desc.Pseudo_type_desc_0 x, - mercury.type_desc.Pseudo_type_desc_0 y) + public static builtin.Comparison_result_0 + __Compare____pseudo_type_desc_0_0(type_desc.Pseudo_type_desc_0 x, + type_desc.Pseudo_type_desc_0 y) { // stub only throw new java.lang.Error(