[m-dev.] diff: code_info speedup
Zoltan Somogyi
zs at cs.mu.OZ.AU
Tue Jan 2 17:23:10 AEDT 2001
compiler/code_info.m:
Divide the code_info data structure into three components, the static
part (which is read-only after initialization), the location-dependent
part and the persistent part. There are no changes in algorithms or
in the semantics of the data, just its form.
This gives a speedup of around 2%.
Zoltan.
cvs diff: Diffing .
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.260
diff -u -b -r1.260 code_info.m
--- compiler/code_info.m 2000/12/06 06:04:55 1.260
+++ compiler/code_info.m 2001/01/01 09:47:20
@@ -240,7 +240,13 @@
:- type code_info --->
code_info(
- % STATIC fields
+ code_info_static :: code_info_static,
+ code_info_loc_dep :: code_info_loc_dep,
+ code_info_persistent :: code_info_persistent
+ ).
+
+:- type code_info_static --->
+ code_info_static(
globals :: globals,
% For the code generation options.
module_info :: module_info,
@@ -259,13 +265,15 @@
% for storing variables.
% (Some extra stack slots are used
% for saving and restoring registers.)
- maybe_trace_info :: maybe(trace_info),
+ maybe_trace_info :: maybe(trace_info)
% Information about which stack slots
% the call sequence number and depth
% are stored in, provided tracing is
% switched on.
+ ).
- % LOCATION DEPENDENT fields
+:- type code_info_loc_dep --->
+ code_info_loc_dep(
forward_live_vars :: set(prog_var),
% Variables that are forward live
% after this goal.
@@ -286,10 +294,12 @@
% is one of the persistent fields below. Any
% keys in that map which are not in this set
% are free for reuse.
- fail_info :: fail_info,
+ fail_info :: fail_info
% Information about how to manage failures.
+ ).
- % PERSISTENT fields
+:- type code_info_persistent --->
+ code_info_persistent(
label_num_src :: counter,
% Counter for the local labels used
% by this procedure.
@@ -396,6 +406,7 @@
trace__reserved_slots(ModuleInfo, ProcInfo, Globals, FixedSlots, _),
int__max(VarSlotMax, FixedSlots, SlotMax),
CodeInfo0 = code_info(
+ code_info_static(
Globals,
ModuleInfo,
PredId,
@@ -403,15 +414,18 @@
ProcInfo,
VarSet,
SlotMax,
- no,
-
+ no
+ ),
+ code_info_loc_dep(
Liveness,
InstMap,
Zombies,
VarLocnsInfo,
TempsInUse,
- DummyFailInfo, % code_info__init_fail_info
+ DummyFailInfo % code_info__init_fail_info
% will override this dummy value
+ ),
+ code_info_persistent(
counter__init(1),
CellCounter,
SaveSuccip,
@@ -421,6 +435,7 @@
[],
-1,
no
+ )
),
code_info__init_maybe_trace_info(TraceLevel, Globals, ProcInfo,
ModuleInfo, TraceSlotInfo, CodeInfo0, CodeInfo1),
@@ -443,48 +458,63 @@
%---------------------------------------------------------------------------%
-code_info__get_globals(CI^globals, CI, CI).
-code_info__get_module_info(CI^module_info, CI, CI).
-code_info__get_pred_id(CI^pred_id, CI, CI).
-code_info__get_proc_id(CI^proc_id, CI, CI).
-code_info__get_proc_info(CI^proc_info, CI, CI).
-code_info__get_varset(CI^varset, CI, CI).
-code_info__get_var_slot_count(CI^var_slot_count, CI, CI).
-code_info__get_maybe_trace_info(CI^maybe_trace_info, CI, CI).
-code_info__get_forward_live_vars(CI^forward_live_vars, CI, CI).
-code_info__get_instmap(CI^instmap, CI, CI).
-code_info__get_zombies(CI^zombies, CI, CI).
-code_info__get_var_locns_info(CI^var_locns_info, CI, CI).
-code_info__get_temps_in_use(CI^temps_in_use, CI, CI).
-code_info__get_fail_info(CI^fail_info, CI, CI).
-code_info__get_label_counter(CI^label_num_src, CI, CI).
-code_info__get_cell_counter(CI^cell_num_src, CI, CI).
-code_info__get_succip_used(CI^store_succip, CI, CI).
-code_info__get_layout_info(CI^label_info, CI, CI).
-code_info__get_max_temp_slot_count(CI^stackslot_max, CI, CI).
-code_info__get_temp_content_map(CI^temp_contents, CI, CI).
-code_info__get_non_common_static_data(CI^comp_gen_c_data, CI, CI).
-code_info__get_max_reg_in_use_at_trace(CI^max_reg_used, CI, CI).
-code_info__get_created_temp_frame(CI^created_temp_frame, CI, CI).
+code_info__get_globals(CI^code_info_static^globals, CI, CI).
+code_info__get_module_info(CI^code_info_static^module_info, CI, CI).
+code_info__get_pred_id(CI^code_info_static^pred_id, CI, CI).
+code_info__get_proc_id(CI^code_info_static^proc_id, CI, CI).
+code_info__get_proc_info(CI^code_info_static^proc_info, CI, CI).
+code_info__get_varset(CI^code_info_static^varset, CI, CI).
+code_info__get_var_slot_count(CI^code_info_static^var_slot_count, CI, CI).
+code_info__get_maybe_trace_info(CI^code_info_static^maybe_trace_info, CI, CI).
+code_info__get_forward_live_vars(CI^code_info_loc_dep^forward_live_vars,
+ CI, CI).
+code_info__get_instmap(CI^code_info_loc_dep^instmap, CI, CI).
+code_info__get_zombies(CI^code_info_loc_dep^zombies, CI, CI).
+code_info__get_var_locns_info(CI^code_info_loc_dep^var_locns_info, CI, CI).
+code_info__get_temps_in_use(CI^code_info_loc_dep^temps_in_use, CI, CI).
+code_info__get_fail_info(CI^code_info_loc_dep^fail_info, CI, CI).
+code_info__get_label_counter(CI^code_info_persistent^label_num_src, CI, CI).
+code_info__get_cell_counter(CI^code_info_persistent^cell_num_src, CI, CI).
+code_info__get_succip_used(CI^code_info_persistent^store_succip, CI, CI).
+code_info__get_layout_info(CI^code_info_persistent^label_info, CI, CI).
+code_info__get_max_temp_slot_count(CI^code_info_persistent^stackslot_max,
+ CI, CI).
+code_info__get_temp_content_map(CI^code_info_persistent^temp_contents, CI, CI).
+code_info__get_non_common_static_data(CI^code_info_persistent^comp_gen_c_data,
+ CI, CI).
+code_info__get_max_reg_in_use_at_trace(CI^code_info_persistent^max_reg_used,
+ CI, CI).
+code_info__get_created_temp_frame(CI^code_info_persistent^created_temp_frame,
+ CI, CI).
%---------------------------------------------------------------------------%
-code_info__set_maybe_trace_info(TI, CI, CI^maybe_trace_info := TI).
-code_info__set_forward_live_vars(LV, CI, CI^forward_live_vars := LV).
-code_info__set_instmap(IM, CI, CI^instmap := IM).
-code_info__set_zombies(Zs, CI, CI^zombies := Zs).
-code_info__set_var_locns_info(EI, CI, CI^var_locns_info := EI).
-code_info__set_temps_in_use(TI, CI, CI^temps_in_use := TI).
-code_info__set_fail_info(FI, CI, CI^fail_info := FI).
-code_info__set_label_counter(LC, CI, CI^label_num_src := LC).
-code_info__set_cell_counter(CC, CI, CI^cell_num_src := CC).
-code_info__set_succip_used(SU, CI, CI^store_succip := SU).
-code_info__set_layout_info(LI, CI, CI^label_info := LI).
-code_info__set_max_temp_slot_count(TM, CI, CI^stackslot_max := TM).
-code_info__set_temp_content_map(CM, CI, CI^temp_contents := CM).
-code_info__set_non_common_static_data(CG, CI, CI^comp_gen_c_data := CG).
-code_info__set_max_reg_in_use_at_trace(MR, CI, CI^max_reg_used := MR).
-code_info__set_created_temp_frame(MR, CI, CI^created_temp_frame := MR).
+code_info__set_maybe_trace_info(TI, CI,
+ CI^code_info_static^maybe_trace_info := TI).
+code_info__set_forward_live_vars(LV, CI,
+ CI^code_info_loc_dep^forward_live_vars := LV).
+code_info__set_instmap(IM, CI, CI^code_info_loc_dep^instmap := IM).
+code_info__set_zombies(Zs, CI, CI^code_info_loc_dep^zombies := Zs).
+code_info__set_var_locns_info(EI, CI,
+ CI^code_info_loc_dep^var_locns_info := EI).
+code_info__set_temps_in_use(TI, CI, CI^code_info_loc_dep^temps_in_use := TI).
+code_info__set_fail_info(FI, CI, CI^code_info_loc_dep^fail_info := FI).
+code_info__set_label_counter(LC, CI,
+ CI^code_info_persistent^label_num_src := LC).
+code_info__set_cell_counter(CC, CI,
+ CI^code_info_persistent^cell_num_src := CC).
+code_info__set_succip_used(SU, CI, CI^code_info_persistent^store_succip := SU).
+code_info__set_layout_info(LI, CI, CI^code_info_persistent^label_info := LI).
+code_info__set_max_temp_slot_count(TM, CI,
+ CI^code_info_persistent^stackslot_max := TM).
+code_info__set_temp_content_map(CM, CI,
+ CI^code_info_persistent^temp_contents := CM).
+code_info__set_non_common_static_data(CG, CI,
+ CI^code_info_persistent^comp_gen_c_data := CG).
+code_info__set_max_reg_in_use_at_trace(MR, CI,
+ CI^code_info_persistent^max_reg_used := MR).
+code_info__set_created_temp_frame(MR, CI,
+ CI^code_info_persistent^created_temp_frame := MR).
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
@@ -915,13 +945,9 @@
code_info__remember_position(position_info(C), C, C).
code_info__reset_to_position(position_info(PosCI), CurCI, NextCI) :-
- % The static fields in PosCI and CurCI should be identical.
- PosCI = code_info(_, _, _, _, _, _, _, _,
- LA, LB, LC, LD, LE, LF, _, _, _, _, _, _, _, _, _ ),
- CurCI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- _, _, _, _, _, _, PA, PB, PC, PD, PE, PF, PG, PH, PI),
- NextCI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH, PI).
+ PosCI = code_info(_, LocDep, _),
+ CurCI = code_info(Static, _, Persistent),
+ NextCI = code_info(Static, LocDep, Persistent).
code_info__reset_resume_known(BranchStart) -->
{ BranchStart = position_info(BranchStartCI) },
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing trial
cvs diff: Diffing util
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list