Code coverage for profil_slot.li
///////////////////////////////////////////////////////////////////////////////
// Lisaac Compiler //
// //
// LSIIT - ULP - CNRS - INRIA - FRANCE //
// //
// This program is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
// //
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
+ name := PROFIL_SLOT;
- copyright := "2003-2007 Benoit Sonntag";
- author := "Sonntag Benoit (bsonntag@loria.fr)";
- comment := "Method with costumization";
Section Inherit
+ parent_profil:Expanded PROFIL;
Section Public
- position:POSITION <- slot.position;
- slot:SLOT <- slot_code;
- is_interrupt:BOOLEAN <- slot_code.id_section.is_interrupt;
- is_external:BOOLEAN <- slot_code.id_section.is_external;
+ slot_code:SLOT_CODE;
+ is_context_sensitive:BOOLEAN;
// BSBS: Le bloc passé en argument peux ne pas etre context sensitive
// Et puis, cet stat peu changer dans le temps...
- set_context_sensitive <-
(
is_context_sensitive := TRUE;
);
//
// Creation.
//
- make s:SLOT_CODE
with (typ_self:TYPE_FULL,call_lst:FAST_ARRAY(EXPR))
verify is_first:BOOLEAN :FAST_ARRAY(WRITE) <-
[
-? {typ_self != NULL};
]
( + loc:LOCAL;
+ typ:TYPE_FULL;
+ item_lst:FAST_ARRAY(ITM_ARGUMENT);
+ result:FAST_ARRAY(WRITE);
+ tm:ITM_TYPE_MULTI;
+ ts:ITM_TYPE_MONO;
(is_graph).if {
set_call := HASHED_DICTIONARY(INTEGER,PROFIL).create;
set_back := HASHED_SET(PROFIL).create;
};
(s.id_section.is_external).if {
name := s.name;
} else {
name := ALIAS_STR.get_intern (s.name);
};
slot_code := s;
type_self := typ_self;
PROFIL_LIST.add Self;
//
list_current := LIST.create (s.position);
profil_current := profil_slot := Self;
//
(debug_level_option != 0).if {
// Debug mode : Add context local.
context := TYPE_CONTEXT.default.new_local (s.position)
name (ALIAS_STR.variable_context) style '+';
context.set_ensure_count 1;
list_current.add_last (PUSH.create (slot_code.position) context context first TRUE);
};
//
code := list_current;
//
// Arguments.
arg_type_tmp := call_lst;
item_lst := s.argument_list;
argument_list := FAST_ARRAY(LOCAL).create_with_capacity (s.argument_count);
(item_lst.lower).to (item_lst.upper) do { j:INTEGER;
item_lst.item j.to_run_in argument_list for Self;
};
((s.id_section.is_external) {argument_list.count > 1}).if {
(argument_list.lower+1).to (argument_list.upper) do { j:INTEGER;
loc := argument_list.item j;
loc.set_ensure_count 1;
loc.write (loc.position) value (
EXTERNAL_C.create (loc.position) text "/* External slot */"
access NULL persistant FALSE type (loc.type)
);
};
};
// Results
tm ?= s.result_type;
(tm != NULL).if {
result_list.make_with_capacity (tm.count);
(tm.lower).to (tm.upper) do { k:INTEGER;
typ := tm.item k.to_run_for Self;
loc := typ.get (s.position) result (k+1);
result_list.add_last loc;
};
} else {
ts ?= s.result_type;
(ts != ITM_TYPE_SIMPLE.type_void).if {
typ := ts.to_run_for Self;
result_list.add_last (typ.get (s.position) result 0);
(is_external).if {
result_list.last.set_ensure_count 1;
};
};
};
//
(call_lst != NULL).if {
result := write_argument call_lst;
};
//
slot_code.create_code is_first;
//
result
);
//
// Execute.
//
- remove_inline <-
(
parent_profil.remove_inline;
slot_code.remove_profil Self;
);
- remove <-
(
parent_profil.remove;
slot_code.remove_profil Self;
);
//
// Genere.
//
- is_static:BOOLEAN <- (! slot.id_section.is_interrupt) {! slot.id_section.is_external};