Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a294378
Fix const_struct lookup crash under accurate GC.
sebgod Apr 25, 2026
71f8140
Fix two compile-to-C bugs in the hlc.agc grade.
sebgod Apr 26, 2026
48e4b28
Fix two more compile-to-C bugs in the hlc.agc grade.
sebgod Apr 26, 2026
7283f5c
Propagate ml_gen_info updates from arg gc_statement generation.
sebgod Apr 26, 2026
309b404
Use async-signal-safe stderr writes in the LLDS GC scheduler.
sebgod Apr 26, 2026
fd8fbff
Eliminate right-spine recursion in MR_deep_copy / MR_agc_deep_copy.
sebgod Apr 26, 2026
095a6b7
Fix forwarding-pointer bitmap shift width on 64-bit AGC.
sebgod Apr 26, 2026
e768663
Pre-extend the AGC to-space before each Cheney copy.
sebgod Apr 26, 2026
23cf9fc
Bump the default initial heap size from 64 KB to 8 MB.
sebgod Apr 26, 2026
f7dfd1b
Enable LCMC under accurate GC in MLDS grades.
sebgod Apr 26, 2026
762ea69
Import libs.globals into ml_unify_gen_construct.
sebgod Apr 26, 2026
46acfb9
Give store_at_field_offset_impure a stub Mercury body for bootstrapping.
sebgod Apr 26, 2026
afbb7e0
Tighten the store_at_field_offset_impure stub body and reorder it.
sebgod Apr 26, 2026
ee238ed
Allow definition of builtins for private_builtin under stage-1.
sebgod Apr 26, 2026
479f2bb
Use pragma external_pred for store_at_field_offset_impure.
sebgod Apr 26, 2026
1bdc432
Move pragma external_pred into the implementation section.
sebgod Apr 26, 2026
0eadc13
Drop the bootstrap stubs around store_at_field_offset_impure.
sebgod Apr 26, 2026
999d5eb
Keep MR_zone_min word-aligned across cache colouring and zone extension.
sebgod Apr 27, 2026
fbc9abe
Mark store_at_field_offset_impure as a no-typeinfo builtin.
sebgod Apr 27, 2026
1132590
Box field_assign value rval to handle MR_Float fields.
sebgod Apr 27, 2026
a5fd97f
Allocate the full zone footprint in MR_extend_zone.
sebgod Apr 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions compiler/add_pred.m
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,10 @@
goal_info_set_nonlocals(NonLocals, GoalInfo0, GoalInfo1),
( if
ModuleName = mercury_private_builtin_module,
% This predicate is incompatible with some backends.
Name = "store_at_ref_impure",
% These predicates are incompatible with some backends.
( Name = "store_at_ref_impure"
; Name = "store_at_field_offset_impure"
),
require_complete_switch [CompilationTarget]
(
( CompilationTarget = target_java
Expand Down
12 changes: 12 additions & 0 deletions compiler/builtin_ops.m
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@
:- type simple_code(T)
---> assign(T, simple_assigned_expr(T))
; ref_assign(T, T)
; field_assign(T, T, T)
% field_assign(Cell, Offset, Value).
% Write Value into the heap cell pointed to by Cell, at the
% word offset given by Offset. The primary tag of Cell is
% stripped at the lowering site. Used by the LCMC pass under
% accurate GC, where capturing the address of a field would
% create an interior pointer that the collector cannot
% relocate.
; test(simple_test_expr(T))
; noop(list(T)).

Expand Down Expand Up @@ -412,6 +420,10 @@
PredName = "store_at_ref_impure",
ProcNum = 0, Args = [X, Y],
Code = ref_assign(X, Y)
;
PredName = "store_at_field_offset_impure",
ProcNum = 0, Args = [Cell, Offset, Value],
Code = field_assign(Cell, Offset, Value)
;
PredName = "unsafe_type_cast", ProcNum = 0, Args = [X, Y],
% Note that the code we generate for unsafe_type_cast
Expand Down
12 changes: 12 additions & 0 deletions compiler/call_gen.m
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,15 @@
StoreInstr = llds_instr(assign(mem_ref(AddrRval), ValueRval), ""),
StoreCode = singleton(StoreInstr),
Code = AddrVarCode ++ ValueVarCode ++ StoreCode
;
SimpleCode = field_assign(CellVar, OffsetVar, ValueVar),
produce_variable(CellVar, CellVarCode, CellRval, !CLD),
produce_variable(OffsetVar, OffsetVarCode, OffsetRval, !CLD),
produce_variable(ValueVar, ValueVarCode, ValueRval, !CLD),
FieldLval = field(no, CellRval, OffsetRval),
StoreInstr = llds_instr(assign(FieldLval, ValueRval), ""),
StoreCode = singleton(StoreInstr),
Code = CellVarCode ++ OffsetVarCode ++ ValueVarCode ++ StoreCode
;
SimpleCode = test(_),
unexpected($pred, "malformed model_det builtin predicate")
Expand All @@ -737,6 +746,9 @@
;
SimpleCode = ref_assign(_, _),
unexpected($pred, "malformed model_semi builtin predicate")
;
SimpleCode = field_assign(_, _, _),
unexpected($pred, "malformed model_semi builtin predicate")
;
SimpleCode = noop(_),
unexpected($pred, "malformed model_semi builtin predicate")
Expand Down
20 changes: 15 additions & 5 deletions compiler/handle_options.m
Original file line number Diff line number Diff line change
Expand Up @@ -691,15 +691,25 @@
OT_OptUnusedArgsIntermod = do_not_opt_unused_args_intermod
),

% XXX With accurate gc, we need to disable optimize-constructor-last-call
% as currently the collector (and tracing code generator) knows neither
% about the pre-constructed data structures nor the references into them
% that this optimisation uses.
% LCMC under accurate GC needs the cell-and-offset capture that
% lco.m's lci_use_field_path branch implements: the original LLD
% store_at_ref_type pointer is an interior pointer into a heap cell
% and the AGC collector cannot relocate it when the cell is
% evacuated. The high-level-data path passes the parent cell as a
% partial-inst term, so it is already safe under AGC. The low-level
% MLDS path uses the new store_at_field_offset_impure builtin to
% keep the cell pointer GC-traceable while still landing the field
% write at the right offset. The LLDS back-end has not yet been
% wired up to either alternative, so accurate GC + LLDS still
% disables LCMC entirely.
globals.lookup_bool_option(!.Globals, highlevel_code, OT_HighLevelCode),
( if
AllowSrcChangesDebug = allow_src_changes,
ProfileDeep = bool.no,
AllowOptLCMCTermSize = bool.yes,
GC_Method \= gc_accurate
( GC_Method \= gc_accurate
; OT_HighLevelCode = yes
)
then
OT_OptLCMC = OT_OptLCMC0
else
Expand Down
4 changes: 3 additions & 1 deletion compiler/hlds_pred.m
Original file line number Diff line number Diff line change
Expand Up @@ -3577,7 +3577,9 @@
(
OptTuple ^ ot_inline_builtins = inline_builtins
;
PredName = "store_at_ref_impure",
( PredName = "store_at_ref_impure"
; PredName = "store_at_field_offset_impure"
),
ModuleName = mercury_private_builtin_module
)
;
Expand Down
1 change: 1 addition & 0 deletions compiler/introduced_call_table.m
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@
mict_private_builtin("restore_hp", 1).
mict_private_builtin("sorry", 1).
mict_private_builtin("store_at_ref_impure", 2).
mict_private_builtin("store_at_field_offset_impure", 3).
mict_private_builtin("store_ticket", 1).
mict_private_builtin("superclass_from_typeclass_info", 3).
mict_private_builtin("trace_evaluate_runtime_condition", 0).
Expand Down
Loading