Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic Statemate (steve huntington)
Decrease font size
Increase font size
Topic Title: MircoC 3.0 optimzation option
Topic Summary:
Created On: 5-Aug-2004 17:31
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 5-Aug-2004 17:31
User is offline View Users Profile Print this message


智仁 θ…ι‡Ž

Posts: 33
Joined: 5-Aug-2004

Hello,

I have concerns about the code efficiency of MicroC, so I am interested in MicroC optimization option.
But, some optimization affect sequence of generated C statements, which results that C is different from what user expects from model.

If optimaization makes generated C statement sequence different from the sequence without optimization, let's call it "not safe."

Otherwise, let's call it "safe."

I believe, "Not safe" optimization is:
"Clutch Entrance To State Hierarchy"
and other optimizations are "Safe."

Old RiMC 2.0 training presentaion mentioned about
"Clutch.." option that:
###
Without optimization, the following sequence would have been
performed:

Consider action Ai on transition Ti, entering reaction E1 for state Si
Then:
A0, E1, A1, E11, A2, E111

After $B!H(Jclutching$B!I(J the sequence will be:
A0, A1, A2, E1, E11, E111
###
And as far as I tried with RiMC 3.0, it still holds with 3.0. This is
the reason I think "Clutch..." is "Not safe."

But "RiMC Programming Style Guide" mentions about "Merge State
Sequences With No Guard on Transitions"
option that:

###
Note:
This optimization, when used with the optimizations inline
entering/exiting reactions (see page 72) and clutch of state hierarchy
(see page 78) might result in an action sequence that is not identical
to the action sequence performed without those optimizations. Make
sure the difference is acceptable.
###

It means combination of "Merge..." + "Inline entering.."
or "Merge..." + "Clutch..." can be "Not safe."
But, I could not find : for what kind of model structure this happens.

Would you please let me know ?

I would like to know:
1. What are "Safe" optimizations and what are "Not Safe"

2. With what kind of model structure "Not Safe"
optimization generate different sequence than original.


Thanks
Report this to a Moderator Report this to a Moderator
 5-Aug-2004 17:32
User is offline View Users Profile Print this message


Raz Yerushalmi

Posts: 19
Joined: 21-Jul-2004

Hello

This is very much a non-trivial subject.

Always "Safe":
(1) Reuse Timout Variable
(2) Inline Default Test
(3) Inline "Need Another Step"
(5) Merge State Sequences with no Gurad on Transition
This optimization (5) is always safe, sometime
it is not possible to do, so the optimizer will ignore the
request.


Sometimes "Not Safe":
(4) Clutch Entrance to State Hierarchy
(6) Inline Entering/Exiting Reaction

Regarding those "Not Safe":
The difference might raise when having entering and/or exiting reactions

When the states involved (include up to the transition LCA) does not have entering nor exiting reactions, there will be no difference in the behaviour.

The description in "RiMC Programming Style Guide" about "Merge State Sequences With No Guard on Transitions" is wrong - it should regard ONLY clutch and entering/exiting reactions, not at all merge states. So the title is wrong.

I have attached here example. Please look at it, and show it to those interested in the differences, as the benefits from using the optimizations are significant, could be more than 35% of the compiled code size!! so they worth the time to study the meaning of them.

In the "m1_all_opt.c" all optimizations are allowed, where in "m1.c" (4), (5), (6) are dissabled.
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic Statemate forum.
There are currently 1 users logged in.
The most users ever online was 12 on 4-Mar-2008 at 15:31.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.