Commit d2f16dfb authored by Botond Baranyi's avatar Botond Baranyi
Browse files

Improved performance of checking coding attributes (bug 532066)



Change-Id: I4068064d3f81521238023b85119aac78648999ef
Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent 3b679d18
......@@ -64,6 +64,7 @@ extern Ttcn::ExtensionAttributes * parse_extattributes(
namespace Common {
map<Type*, void> Type::RecursionTracker::types;
dynamic_array<Type*> Type::coding_attrib_check_stack;
using Ttcn::MultiWithAttrib;
using Ttcn::SingleWithAttrib;
......@@ -593,6 +594,7 @@ namespace Common {
raw_checked = false;
xer_checked = false;
variants_checked = false;
coding_attribs_checked = false;
raw_length_calculated = false;
has_opentypes = false;
opentype_outermost = false;
......
......@@ -344,6 +344,8 @@ namespace Common {
bool raw_checked;
bool xer_checked;
bool variants_checked;
bool coding_attribs_checked;
static dynamic_array<Type*> coding_attrib_check_stack;
bool raw_length_calculated;
bool has_opentypes;
bool opentype_outermost;
......
......@@ -229,9 +229,11 @@ void Type::chk()
void Type::chk_coding_attribs()
{
if (!legacy_codec_handling && !variants_checked) {
if (coding_attribs_checked || (!legacy_codec_handling && !variants_checked)) {
return;
}
coding_attribs_checked = true;
coding_attrib_check_stack.add(this);
if (typetype == T_SEQ_T || typetype == T_SET_T || typetype == T_CHOICE_T) {
// If this record/set/union type has no attributes but one of its fields does,
// create an empty attribute structure.
......@@ -268,6 +270,7 @@ void Type::chk_coding_attribs()
if (!legacy_codec_handling) {
if (RecursionTracker::is_happening(this)) {
coding_attrib_check_stack.remove(coding_attrib_check_stack.size() - 1);
return;
}
......@@ -302,6 +305,7 @@ void Type::chk_coding_attribs()
}
}
}
coding_attrib_check_stack.remove(coding_attrib_check_stack.size() - 1);
}
void Type::parse_attributes()
......@@ -2622,6 +2626,11 @@ void Type::chk_xer() { // XERSTUFF semantic check
t1->chk();
if (!legacy_codec_handling && !t1->xer_checked) {
xer_checked = false;
// the attribute-checking flags for the types currently running this
// check must all be reset, so this type can be checked again
for (size_t i = 0; i < coding_attrib_check_stack.size(); ++i) {
coding_attrib_check_stack[i]->coding_attribs_checked = false;
}
return;
}
// Merge XER attributes from the referenced type.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment