Skip to content

Commit

Permalink
* Reflect change in PolyORB-HI/Ada API to avoid secondary stack
Browse files Browse the repository at this point in the history
        For #141
  • Loading branch information
yoogx committed Apr 10, 2018
1 parent 8e4478a commit 625036d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/backends/po_hi_ada/ocarina-backends-po_hi_ada-runtime.ads
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ package Ocarina.Backends.PO_HI_Ada.Runtime is
RE_Encapsulate, -- PolyORB_HI.Messages.Encapsulate
RE_Not_Empty, -- PolyORB_HI.Messages.Not_Empty
RE_Valid, -- PolyORB_HI.Messages.Valid
RE_Size, -- PolyORB_HI.Messages.Size
RE_Naming_Entry, -- PolyORB_HI.Transport.Naming_Entry
RE_To_HI_String, -- PolyORB_HI.Utils.To_HI_String
RE_Naming_Table_Type, -- PolyORB_HI.Utils.Naming_Table_Type
Expand Down Expand Up @@ -262,6 +263,7 @@ package Ocarina.Backends.PO_HI_Ada.Runtime is
RE_Encapsulate => RU_PolyORB_HI_Messages,
RE_Not_Empty => RU_PolyORB_HI_Messages,
RE_Valid => RU_PolyORB_HI_Messages,
RE_Size => RU_PolyORB_HI_Messages,
RE_Naming_Entry => RU_PolyORB_HI_Utils,
RE_To_HI_String => RU_PolyORB_HI_Utils,
RE_Naming_Table_Type => RU_PolyORB_HI_Utils,
Expand Down
38 changes: 29 additions & 9 deletions src/backends/po_hi_ada/ocarina-backends-po_hi_ada-transport.adb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ with Ocarina.ME_AADL;
with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nutils;
with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Backends.Ada_Values;

with Ocarina.Backends.Utils;
with Ocarina.Backends.Properties;
Expand All @@ -54,6 +55,7 @@ package body Ocarina.Backends.PO_HI_Ada.Transport is
use Ocarina.Backends.Ada_Tree.Nutils;
use Ocarina.Backends.PO_HI_Ada.Mapping;
use Ocarina.Backends.PO_HI_Ada.Runtime;
use Ocarina.Backends.Ada_Values;

package AAU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package ADN renames Ocarina.Backends.Ada_Tree.Nodes;
Expand Down Expand Up @@ -510,6 +512,8 @@ package body Ocarina.Backends.PO_HI_Ada.Transport is
Alternatives : constant List_Id := New_List (ADN.K_List_Id);
N : Node_Id;
T : Node_Id;
Msg_T : Node_Id;

begin
pragma Assert (AAU.Is_Process (E));

Expand Down Expand Up @@ -539,22 +543,38 @@ package body Ocarina.Backends.PO_HI_Ada.Transport is
N := Make_Used_Package (RU (RU_PolyORB_HI_Generated_Deployment));
Append_Node_To_List (N, Declarations);

N :=
Make_Range_Constraint
(Make_Literal (New_Integer_Value (1, 1, 10)),
Make_Subprogram_Call
(RE (RE_Size),
Make_List_Id (Make_Defining_Identifier (PN (P_Message)))));

Msg_T :=
Make_Subprogram_Call
(RE (RE_Stream_Element_Array),
Make_List_Id (N));

N :=
Make_Object_Declaration
(Defining_Identifier => Make_Defining_Identifier (PN (P_Msg)),
Constant_Present => True,
Object_Definition => RE (RE_Stream_Element_Array),
Expression =>
Make_Subprogram_Call
(RE (RE_Encapsulate),
Make_List_Id
(Make_Defining_Identifier (PN (P_Message)),
Make_Defining_Identifier (PN (P_From)),
Make_Defining_Identifier (PN (P_Entity)))));
Constant_Present => False,
Object_Definition => Msg_T);
Append_Node_To_List (N, Declarations);

-- Statements

-- Call Encapsulate

N := Make_Subprogram_Call
(RE (RE_Encapsulate),
Make_List_Id
(Make_Defining_Identifier (PN (P_Message)),
Make_Defining_Identifier (PN (P_From)),
Make_Defining_Identifier (PN (P_Entity)),
Make_Defining_Identifier (PN (P_Msg))));
Append_Node_To_List (N, Statements);

-- The if/elsif statement: for each thread of the current
-- process, we generate a case statement alternative to
-- call its specific sending routine.
Expand Down

0 comments on commit 625036d

Please sign in to comment.