[m-rev.] diff: java mutables don't require synchronisation
Julien Fischer
juliensf at csse.unimelb.edu.au
Fri May 7 21:51:00 AEST 2010
On Fri, 7 May 2010, Peter Wang wrote:
> Branches: main, 10.04
>
> Reads/writes of 32-bit variables in Java are are atomic and do not require
> further synchronisation. Don't generate `synchronized' statements in Java
> mutable accessors.
>
> compiler/make_hlds_passes.m:
> compiler/prog_mutable.m:
> As above.
This change broke the nightly builds -- I've committed the patch below
that fixes this.
Julien.
--------
Branches: main, 10.04
Fix a problem that broke the nightly builds.
compiler/make_hlds_passes.m:
Avoid singleton variables.
Index: make_hlds_passes.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make_hlds_passes.m,v
retrieving revision 1.98
diff -u -r1.98 make_hlds_passes.m
--- make_hlds_passes.m 7 May 2010 03:46:24 -0000 1.98
+++ make_hlds_passes.m 7 May 2010 11:42:58 -0000
@@ -1678,8 +1678,8 @@
% Add foreign_code item that defines the global variable used to
% implement the mutable.
IsThreadLocal = mutable_var_thread_local(MutAttrs),
- add_java_mutable_defn(TargetMutableName, Type, IsConstant,
- IsThreadLocal, Context, !ModuleInfo, !QualInfo, !Specs),
+ add_java_mutable_defn(TargetMutableName, Type, IsThreadLocal,
+ Context, !ModuleInfo, !QualInfo, !Specs),
% Add all the predicates related to mutables.
add_java_mutable_preds(ItemMutable, TargetMutableName,
@@ -2309,24 +2309,23 @@
% Add foreign_code item that defines the global variable used to hold the
% mutable.
%
-:- pred add_java_mutable_defn(string::in, mer_type::in, bool::in,
+:- pred add_java_mutable_defn(string::in, mer_type::in,
mutable_thread_local::in, prog_context::in,
module_info::in, module_info::out, qual_info::in, qual_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-add_java_mutable_defn(TargetMutableName, Type, IsConstant, IsThreadLocal,
- Context, !ModuleInfo, !QualInfo, !Specs) :-
+add_java_mutable_defn(TargetMutableName, Type, IsThreadLocal, Context,
+ !ModuleInfo, !QualInfo, !Specs) :-
get_java_mutable_global_foreign_defn(!.ModuleInfo, Type,
- TargetMutableName, IsConstant, IsThreadLocal, Context, ForeignDefn),
+ TargetMutableName, IsThreadLocal, Context, ForeignDefn),
ItemStatus0 = item_status(status_local, may_be_unqualified),
add_item_decl_pass_2(ForeignDefn, ItemStatus0, _, !ModuleInfo, !Specs).
:- pred get_java_mutable_global_foreign_defn(module_info::in, mer_type::in,
- string::in, bool::in, mutable_thread_local::in, prog_context::in,
- item::out) is det.
+ string::in, mutable_thread_local::in, prog_context::in, item::out) is det.
get_java_mutable_global_foreign_defn(_ModuleInfo, _Type, TargetMutableName,
- IsConstant, IsThreadLocal, Context, DefnItem) :-
+ IsThreadLocal, Context, DefnItem) :-
(
IsThreadLocal = mutable_not_thread_local,
% Synchronization is only required for double and long values, which
@@ -2415,7 +2414,6 @@
set_purity(purity_semipure, Attrs, GetAttrs0),
set_thread_safe(proc_thread_safe, GetAttrs0, GetAttrs),
varset.new_named_var(varset.init, "X", X, ProgVarSet),
- MutableMutexVarName = mutable_mutex_var_name(TargetMutableName),
(
IsThreadLocal = mutable_not_thread_local,
GetCode = "\tX = " ++ TargetMutableName ++ ";\n"
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list