Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
Ocarina
Commits
c571d16f
Commit
c571d16f
authored
Jul 30, 2019
by
yoogx
Browse files
* If PolyORB_HI_Generated.Activity is empty (no port), then do
not generate it, and do not reference it. For openaadl/ocarina#221
parent
06edb00f
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/backends/po_hi_ada/ocarina-backends-po_hi_ada-activity.adb
View file @
c571d16f
...
...
@@ -781,60 +781,60 @@ package body Ocarina.Backends.PO_HI_Ada.Activity is
O
:
Node_Id
;
begin
-- Create the spec of the parameterless subprogram that
-- executes the thread job.
if
Has_Ports
(
E
)
then
-- Create the spec of the subprograms to interact with
-- thread ports.
case
P
is
when
Thread_Periodic
=>
N
:=
Message_Comment
(
"Periodic task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Visible_Part
(
Current_Package
));
case
P
is
when
Thread_Periodic
=>
N
:=
Message_Comment
(
"Periodic task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Visible_Part
(
Current_Package
));
when
Thread_Sporadic
=>
N
:=
Message_Comment
(
"Sporadic task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Visible_Part
(
Current_Package
));
when
Thread_Sporadic
=>
N
:=
Message_Comment
(
"Sporadic task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Visible_Part
(
Current_Package
));
when
Thread_Hybrid
=>
N
:=
Message_Comment
(
"Hybrid task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Visible_Part
(
Current_Package
));
when
Thread_Hybrid
=>
N
:=
Message_Comment
(
"Hybrid task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Visible_Part
(
Current_Package
));
when
Thread_Aperiodic
=>
N
:=
Message_Comment
(
"Aperiodic task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Visible_Part
(
Current_Package
));
when
Thread_Aperiodic
=>
N
:=
Message_Comment
(
"Aperiodic task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Visible_Part
(
Current_Package
));
when
Thread_Background
=>
N
:=
Message_Comment
(
"Background task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Visible_Part
(
Current_Package
));
when
Thread_Background
=>
N
:=
Message_Comment
(
"Background task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Visible_Part
(
Current_Package
));
when
Thread_ISR
=>
N
:=
Message_Comment
(
"ISR task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Visible_Part
(
Current_Package
));
when
Thread_ISR
=>
N
:=
Message_Comment
(
"ISR task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Visible_Part
(
Current_Package
));
when
others
=>
Display_Located_Error
(
AIN
.
Loc
(
E
),
"Unsupported dispatch protocol"
,
Fatal
=>
True
);
end
case
;
when
others
=>
Display_Located_Error
(
AIN
.
Loc
(
E
),
"Unsupported dispatch protocol"
,
Fatal
=>
True
);
end
case
;
if
Has_Ports
(
E
)
then
-- The data types and the interrogation routines
-- generated from a thread are not instance specific. We
-- generate them once per thread component. This allows
...
...
@@ -2515,106 +2515,109 @@ package body Ocarina.Backends.PO_HI_Ada.Activity is
-- Implement the routines that allow user code to
-- manipulate the thread.
Runtime_Routine_Bodies
(
E
);
end
if
;
case
P
is
when
Thread_Periodic
=>
N
:=
Message_Comment
(
"Periodic task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Statements
(
Current_Package
));
when
Thread_Sporadic
=>
N
:=
Message_Comment
(
"Sporadic task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Statements
(
Current_Package
));
when
Thread_Aperiodic
=>
N
:=
Message_Comment
(
"Aperiodic task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Statements
(
Current_Package
));
case
P
is
when
Thread_Periodic
=>
N
:=
Message_Comment
(
"Periodic task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Statements
(
Current_Package
));
when
Thread_
Background
=>
N
:=
Message_Comment
(
"Background
task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Statements
(
Current_Package
));
when
Thread_
Sporadic
=>
N
:=
Message_Comment
(
"Sporadic
task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Statements
(
Current_Package
));
when
Thread_
ISR
=>
N
:=
Message_Comment
(
"ISR
task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Statements
(
Current_Package
));
when
Thread_
Aperiodic
=>
N
:=
Message_Comment
(
"Aperiodic
task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Statements
(
Current_Package
));
when
Thread_
Hybri
d
=>
N
:=
Message_Comment
(
"Hybri
d task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Statements
(
Current_Package
));
when
Thread_
Backgroun
d
=>
N
:=
Message_Comment
(
"Backgroun
d task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Statements
(
Current_Package
));
-- Hybrid threads requires an extra driver thread to be
-- created.
when
Thread_ISR
=>
N
:=
Message_Comment
(
"ISR task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Statements
(
Current_Package
));
declare
Aggr
:
constant
List_Id
:=
New_List
(
ADN
.
K_Component_List
);
begin
Has_Hybrid_Threads
:=
True
;
when
Thread_Hybrid
=>
N
:=
Message_Comment
(
"Hybrid task : "
&
Get_Name_String
(
Display_Name
(
Identifier
(
S
))));
Append_Node_To_List
(
N
,
ADN
.
Statements
(
Current_Package
));
-- Hybrid threads requires an extra driver thread to be
-- created.
declare
Aggr
:
constant
List_Id
:=
New_List
(
ADN
.
K_Component_List
);
begin
Has_Hybrid_Threads
:=
True
;
if
Hybrid_Thread_Elements
=
No_List
then
Hybrid_Thread_Elements
:=
New_List
(
ADN
.
K_Element_List
);
end
if
;
if
Hybrid_Thread_Elements
=
No_List
then
Hybrid_Thread_Elements
:=
New_List
(
ADN
.
K_Element_List
);
end
if
;
-- Append the element association corresponding to
-- E to the hybrid task set.
-- Append the element association corresponding to
-- E to the hybrid task set.
N
:=
Extract_Enumerator
(
E
);
Append_Node_To_List
(
N
,
Aggr
);
N
:=
Extract_Enumerator
(
E
);
Append_Node_To_List
(
N
,
Aggr
);
-- We know that the last node added to the feature
-- list of E is the one appended at exapnsion time
-- and corresponding to the fake event part that
-- will receive the dispatch messages from the
-- driver.
-- We know that the last node added to the feature
-- list of E is the one appended at exapnsion time
-- and corresponding to the fake event part that
-- will receive the dispatch messages from the
-- driver.
N
:=
Extract_Enumerator
(
Last_Node
(
Features
(
E
)));
Append_Node_To_List
(
N
,
Aggr
);
N
:=
Extract_Enumerator
(
Last_Node
(
Features
(
E
))
)
;
Append_Node_To_List
(
N
,
Aggr
);
N
:=
Map_Ada_Time
(
Get_Thread_Period
(
E
));
Append_Node_To_List
(
N
,
Aggr
);
N
:=
Map_Ada_Time
(
Get_Thread_Period
(
E
)
);
Append_Node_To_List
(
N
,
Aggr
);
N
:=
RE
(
RE_System_Startup_Time
);
Append_Node_To_List
(
N
,
Aggr
);
N
:=
RE
(
RE_
System_Startup_Tim
e
);
Append_Node_To_List
(
N
,
Aggr
);
N
:=
RE
(
RE_
Tru
e
);
Append_Node_To_List
(
N
,
Aggr
);
N
:=
RE
(
RE_True
);
Append_Node_To_List
(
N
,
Aggr
);
N
:=
Make_Qualified_Expression
(
RE
(
RE_Hybrid_Task_Info
),
Make_Record_Aggregate
(
Aggr
));
N
:=
Make_Qualified_Expression
(
RE
(
RE_Hybrid_Task_Info
),
Make_Record_Aggregate
(
Aggr
));
Last_Hybrid_Thread_Index
:=
Last_Hybrid_Thread_Index
+
1
;
Last_Hybrid_Thread_Index
:=
Last_Hybrid_Thread_Index
+
1
;
N
:=
Make_Element_Association
(
Make_Literal
(
New_Integer_Value
(
Last_Hybrid_Thread_Index
,
1
,
10
)),
N
);
Append_Node_To_List
(
N
,
Hybrid_Thread_Elements
);
end
;
N
:=
Make_Element_Association
(
Make_Literal
(
New_Integer_Value
(
Last_Hybrid_Thread_Index
,
1
,
10
)),
N
);
Append_Node_To_List
(
N
,
Hybrid_Thread_Elements
);
end
;
when
others
=>
raise
Program_Error
;
end
case
;
when
others
=>
raise
Program_Error
;
end
case
;
Runtime_Routine_Bodies
(
E
);
end
if
;
if
Has_Modes
(
E
)
then
-- If the thread has operational modes, then generate the
...
...
src/backends/po_hi_ada/ocarina-backends-po_hi_ada-job.adb
View file @
c571d16f
...
...
@@ -2525,6 +2525,12 @@ package body Ocarina.Backends.PO_HI_Ada.Job is
begin
Check_Thread_Consistency
(
E
);
if
Has_Ports
(
E
)
then
Add_With_Package
(
E
=>
RU
(
Ru_PolyORB_HI_Generated_Activity
),
Used
=>
True
);
end
if
;
-- If the thread contains operational modes. we update the
-- value of the current mode depending on the received
-- events.
...
...
@@ -2968,10 +2974,6 @@ package body Ocarina.Backends.PO_HI_Ada.Job is
S
:
constant
Node_Id
:=
Parent_Subcomponent
(
E
);
N
:
Node_Id
;
begin
Add_With_Package
-- XXX
(
E
=>
RU
(
Ru_PolyORB_HI_Generated_Activity
),
Used
=>
True
);
case
P
is
when
Thread_Periodic
=>
N
:=
...
...
src/backends/po_hi_ada/ocarina-backends-po_hi_ada-main.adb
View file @
c571d16f
...
...
@@ -338,11 +338,15 @@ package body Ocarina.Backends.PO_HI_Ada.Main is
Thread_Aperiodic
|
Thread_Background
|
Thread_ISR
=>
Add_With_Package
(
E
=>
RU
(
RU_PolyORB_HI_Generated_Activity
,
False
),
Used
=>
False
,
Warnings_Off
=>
True
,
Elaborated
=>
True
);
if
Has_Ports
(
E
)
then
Add_With_Package
(
E
=>
RU
(
RU_PolyORB_HI_Generated_Activity
,
False
),
Used
=>
False
,
Warnings_Off
=>
True
,
Elaborated
=>
True
);
end
if
;
Add_With_Package
(
E
=>
RU
(
Ru_Polyorb_Hi_Generated_Job
,
False
),
Used
=>
False
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment