Activation Record Diagram
In MIND Research s pioneering style, the web-delivered ST Math: Integrated Instructional System, marks a new category of comprehensive, integrated teaching and.
UML SysML Toolset. Design object oriented software with Unified Modeling Language UML, an industry standard for specifying, visualizing and documenting the.
UML sequence diagrams model the flow of logic within your system in a visual manner, enabling you both to document and.
CIS300 Spring 2005
The activation-record stack
Almost every programming language that contains procedures or methods in its vocabulary is implemented with a stack structure, and this is also the case with Java.
The earlier lecture on execution semantics showed how objects are constructed within a process s storage partition. But the presentation in that lecture simplified the semantics of method call --- the lecture showed the code of an invoked method copied into the object that was the target of the invocation. In reality, no code is copied into objects; instead, an activation record is constructed and pushed onto the process s activation record stack.
First, recall that a program s storage partition looks like this:
The storage used for data will be used to build a stack at the left end, and objects will be constructed at the right end. When a program s main method is started, the partition looks like this:
A record for main is pushed onto the activation record stack; the record holds cells for main s local variables and the return address to which the JVM should jump when main finishes. Say that main calls a method, p. Then, an activation record holding p s local variables and return address is pushed onto the stack:
If p calls q, the same happens:
The pictures show us that
the activation-record stack remembers the history of incompleted method calls, and
the topmost activation record holds the data values for the currently executing method.
When q finishes, its activation record is popped, and the configuation reverts to
Now, p can finish its execution from the point where it paused to invoke q. When p finishes, its record is popped, and main can finish.
Now we study an example to see how this concept applies to methods associated with objects.
An example
Here is a small Java application:
public class Controller public static void main int x 2; Model m new Model ; m.set x 1 ; System.out.println m.get ; public class Model private int val; public Model val 0; public void set int w Model x new Model ; val w; public int get return val;
When the Java compiler checks these two classes and translates them into. class files, it makes some small but crucial changes; the changes are marked by //.:
public class Controller public static void main int x 2; Model m new Model ; m.set x 1 ; System.out.println m.get ; return; //. public class Model private int val; public Model this.val 0; //. return this; //. public void set int w Model x new Model ; this.val w; //. return; //. public int get return this.val; //.
First, every method is ended with an explicit return statement, which clarifies when control leaves the method and returns to the method s caller. Second, within each class, references to the class s fields attributes are prefixed by this. When we study the example s execution semantics, we will see that this is an extra local variable that helps associate method code with the object that the method manipulates.
In the previous lecture, we learned that the Java compiler next reformats the code into posfix notation and then into byte code. Because byte code is difficult for humans to read, we will not use the byte-code versions of the two example classes in the example that follows.
When the program is started java Controller, the JVM and java.lang are loaded into the partition. Then, Controller.class and Model.class are loaded, and the controller s main method is started: an activation record for main is pushed onto the activation-record stack:
As noted earlier, main s record holds cells for its two local variables, x and m, as well as the return address of where execution should continue when main finishes and returns.
The first instruction that executes, at address 102, saves 2 in x s cell:
The next instruction, at address 103, constructs a new Model object. Several steps must be performed:
A Model object is constructed in heap storage, and a cell for its private variable, val, is allocated therein.
The object s constructor method is immediately executed.
The address of the newly constructed object is returned as the result of executing the constructor method.
The picture below shows Step 1: The object is constructed, a cell is allocated for its variable, val, and its constructor method is started. The instruction counter in the JVM is reset to 202, the first instruction in the constructor method.
The constructor method s activation record is pushed onto the stack. It holds cells for the method s local variables in this case, none, and it holds the return address back to main s code. It holds an additional cell, this, which holds the address of the newly constructed object.
The picture shows that no code is copied into the Model object --- the code stays where it is, and the instruction counter holds the code s address.
Now, we learn why the Java compiler reformatted the assignment, val 0, into this.val 0. The value of variable, this, is found within the topmost record of the activation-record stack --- the value is 500. Hence, it is the val variable within the object at address 500 that must be assigned zero:
The this variable removes the need to copy method code into objects.
Now, it is time to return from the constructor method. The return this instruction causes the value in the return-address cell to be copied into the instruction counter and also the value in this s cell to be returned to its destination in main. In reality, the value of this is copied into a register in the CPU and later it is copied into main s variable m.
The activation record for the constructor method is erased.
Now, the assignment to m is completed:
Next, it is time to execute the method invocation, m.set x 1. The evaluation of the invocation proceeds from left to right:
determine the target object s m s address. Here, it is 500.
determine the value of the argument actual parameter. Here, it is 3.
start the invoked method.
Steps 1 and 2 are shown below:
And here is the start of Step 3 --- an activation record for method set is pushed, where its this variable is initialized to 500. Notice that its argument is saved in the variable for formal parameter, w. And, the return address is saved. The instruction counter is reset to the first instruction within the invoked method:
The next instruction constructs a second Model object, and the steps seen a moment ago are repeated. We see a new object constructed and fresh activation record pushed for Model s constructor method:
The constructor executes as seen before, using the same instructions as before, but since this s cell holds 600, the new object is correctly initialized. The constructor returns its address to its caller, and its activation record disappears:
Because the execution has returned to the code for set, and because the topmost activation record holds the variables for set, variable x is correctly assigned:
and the correct val field is reset:
Now, set is finished, and execution returns to main:
Notice that the object at address 600 still rests in storage, even though it is impossible for the application to reference it; the object is garbage, and at a later point in the execution, the garbage collector program within the JVM will examine all of storage and erase all such unreachable objects. In contrast, languages like C and C lack garbage collectors, and the programmer must insert code to explictly erase unneeded objects.
The next instruction, System.out.println m.get, triggers an invocation of get whose this cell holds 500. Once get returns 3, the println method is invoked. This finishes the application s execution.
The temporary-value stack
The previous example emphasized how the activation-record stack remembers the local variables and return address for each method that is invoked. But within a method, there might be instructions that compute arithmetic expressions. We saw in the earlier lecture that arithmetic expressions are computed with the assistance of a stack; the stack that holds arithmetic values is called the temporary-value stack.
Although it was not drawn in the above diagrams, each activation record holds its own temporary-value stack for computing arithmetic. If we examine the precise structure of a method s activation record, we would find this:
The temporary-value stack literally grows out of the right end of the activation record; this lets the temporary-value stack grow as needed to evaluate complicated arithmetic expressions. When a function is invoked in the middle of evaluating a complex arithmetic expression, the activation record for the invoked function is constructed just as if it is resting on the top of the temporary value stack. This makes it easy to return from the invoked function and finish evaluating the expression.
Download
UML SysML Toolset
Design object oriented software with Unified Modeling Language UML, an industry standard for specifying, visualizing and documenting the various aspects of software system.
UML and SysML Modeling
Favorite Feature Supported from Modeler Edition
Use case diagram
Capture functional requirements with UML use case diagram. Each use case in a use case diagram represents a high level system function that yields a measurable result of values. UML Actors are connected with use cases to represent the roles that interact with the functions.
Model business actor and use case
Model people or external system with business actor. Model business functions with business use case.
Elaborate use case with sequence diagram
Add sub sequence diagram s to use case to represent the interaction between actor and use case.
Resource Catalog
Draw use case diagram with simple drag and drop. Simply drag to create a new shape in the UML tool. No dummy actions.
Ensure the correct use of notations
Resource Catalog displays elements and connectors valid for particular shape only, avoiding modeling mistakes.
Design with abstraction, using sub diagram
Maintain unlimited levels of abstraction layers whereby different perspectives of system and different amounts of details are exposed to developers.
Enhancement
Supported highlighting preferred diagram type in New Diagram window when create sub-diagram
When you create a sub-diagram, in the New Diagram window, the diagram types that suit the chosen element will be listed on the top of the window for ease of selection.
Quick navigation between parent and sub diagram
Dive into the sub diagram through the tiny resource icon that appear at bottom right of shape. Go back to the parent via the quick link.
Class diagram
Describes structure of system by showing its classes, their attributes and operations in a UML class diagram. UML class diagram is a blueprint of the classes code level required to build a software system. Programmers implement a software system with the help of both the class diagram and the class specification.
Supported connecting dependency to class member
The end of a dependency connector can be attached to an attribute and operation for more sophisticated connectivity.
Inline class member editing
Directly rename attributes and operations in class shape. Type and return type are automatically mapped with the associated class.
Pinnable connector end
Pin the end of a connector for more specific pointing purpose. For example, point to an attribute in class.
Edit multiple association properties at a time
Specify all association properties in diagram without going through deep dialog boxes.
Optionally hide class member
Show only the attributes and operations that are relevant to specific context. Hide away those irrelevance members.
Display classes as robustness analysis icons
, and classes can be optionally shown as robustness analysis icons.
Wrap long class members
Keep your classes look compact by showing long attributes and operations in multiple lines.
Sort class members
Order attributes and operations by name, by visibility private/public/protected or by stereotype.
Add attribute with getter and setter
Automatically generate getter and setter when adding new attribute.
Manual class member re-ordering with drag and drop
The UML tool supports drag-and-drop attributes and/or operations for re-ordering.
Move class members between classes with drag and drop
Move attributes and operations to another class by simple drag and drop.
Define states for controller class with state machine diagram
Add a sub state machine diagram to controller class for modeling its states and state change.
Visualize related classes from class members
Show in diagram the classes being chosen as type or return type of attributes and operations.
Sequence diagram
Visualize interactions between users, systems and sub-systems over time through message passing between objects or roles. If class diagram represents the skeleton of classes by showing their attributes and methods, sequence diagram complete the classes by representing the programming logic to be filled in methods body.
Drag-and-drop sequence diagram creation
The UML tool enables the creation of sequence diagram with minimal effort.
Reclaim and eliminate space with sweeper and magnet
Introduce space in diagram by sweeping shapes to a direction, or eliminate space by pulling shapes towards a direction with magnet.
Draw sequence diagram with keyboard
Put your mouse aside. Embrace your keyboard for quick sequence diagram creation.
Automatic sequence message numbering
Automatically generated and updated numbers for sequence messages. No manual editing is required.
One-click return message creation
With a click, a return message will be created for you, with proper connectivity and positioning.
Automatic activation extension
Activations will be automatically extended, following your drawing.
Identify classes and operation from sequence diagram
Make the lifelines become classifier, and make the sequence messages become behaviors i.e. operations of class.
Re-locate activation to move associated messages
Messages will always stick with activations. When you move an activation to another lifeline, the attached messages will follow.
Generate communication diagram
Save effort by generating a communication diagram that conforms to your sequence diagram.
Display lifelines as robustness analysis icons
, and lifelines can be optionally shown as robustness analysis icons.
Communication diagram
Collaboration between objects in runtime can be modeled in the UML tool, with a UML communication diagram. In a communication diagram, objects, called lifelines, are connected to represent the need of communication during the execution of an interaction. Messages can be added on top of the connectors to list the calls made from and to those lifelines.
Grouped messages
Instead of having messages loosely placed on diagram, they are grouped in a way that allows for simple re-positioning.
Auto-sized swimlane
With a swimlane that span the width of diagram, you don t need size it yourself.
Generate sequence diagram
Save effort by generating a sequence diagram that conforms to your communication diagram.
Activity diagram
Use UML activity diagram, the flowchart-based diagram to model system behavior in the UML tool. Partition actions according to the type of participant involved.
Supported inserting action shape to control flow with split resource
Insert action shape in the middle of a control flow with the new split resource. Similar feature had been supported in BPD for creating task in a sequence flow.
Create branch of actions with single mouse click
Click once to create not one shape, but a chain of action shapes in representing conditional flows.
Convert model element to a different type
Seamlessly convert a model element to another type, with properties preserved. For example, from UML action to UML activity.
Align shapes perfectly with alignment guide
When dragging shapes, alignment guide lines appear so you can position shapes in alignment with others.
State machine diagram
State machine diagram is a critical design model for event-driven systems. Well-designed state machine shows accurately the essential states of objects as well as the triggers of state change, which facilitates the development of error-free state machine.
Supported the use of constraint in defining guards for state transitions
Guards for state machine transitions are no longer simple text, but allows the selection of Constraint element that would allow the reuse of guards among transitions.
Protocol state machine specification
Model how a protocol works, with protocol state machine. Both behavioral and protocol state machines are supported in the UML tool.
Multiple connector routing styles
Increase readability of diagram with different kinds of connector routing styles curve, oblique, rectilinear, round-oblique and round-rectilinear.
Create turning points when create shape with connector
Save diagramming time by create connecting objects with multiple turning points at once.
Connector captions that follow connector s orientation
Maintain clear and highly readable diagrams by having the connectors caption follow the orientation of connectors.
Multiple alignment options for shape name
We provide 9 alignment options for you to position shape name in the desired place.
Precise shape positioning with the help of alignment guide
Create shapes that align well to existing shape with the help of the dynamic, visual guides.
Component diagram
Components diagrams are used to model the structure of systems by showing how little parts of the system gear up in forming a bigger part, or forming the entire software systems.
Resizable connector caption
Resize connector caption to fit the presentation of diagram.
Movable connector caption
Drag to move the connector caption to anywhere you like to make your UML diagram more readable.
Layout diagrams in different styles
Tidy up messy design with the built-in layout algorithms. The algorithms are fully configurable, which provides you with the best result you want.
Describe model elements by rich text
Describe model elements with formatted text bold, italic, bullet points, different font colors, font size, etc.
Describe model element by voice
Describe model element by audio recording. You can record new audio clip or link to any audio recording to any model element in your project.
Deployment diagram
Models the physical deployment of software components with UML deployment diagram. In deployment diagram, hardware components e.g., web server, mail server, application server are presented as nodes, with the software components that run inside the hardware components presented as artifacts.
User-defined notation symbol
Apply your own image file as graphical representation of any notation. You may use your own avatar to replace traditional stickman shape for UML actor, if you like.
Make shape appearance follow stereotype s definition
Specify in stereotype the background color, font color and font weight and font settings of model element, and let the model elements that extend the stereotype follow.
Supported more formatting properties in stereotype definition
More formatting properties are supported when defining stereotype. Elements that extend a formatted stereotype will share the same formatting styles.
Manage and apply styles
Define and apple style to shapes to quickly change the shape appearance without setting every background/foreground one by one.
Multi-language spell checking English, Brazilian, German, etc
The UML tool supports spell checking and suggestion for English, Brazilian, French, German and Spanish.
Package diagram
Arrange and organize model elements and diagrams for large-scale project with package diagrams helps development team to navigate and find the right model elements. Package diagram is also good in visualizing structure and dependency between sub-systems or modules.
Select contained shapes with InstantFreeze
Temporarily freeze a container shape to aid in the selection of child shapes.
Format copier
Clone format properties from one shape to another, with simple clicks.
Group diagram and shapes into package with package header
Easily add diagram along with its containing shapes into a package with the package header that appear on top of every diagram.
Name completion
Re-use a model element by providing its name when create shape. Enter part of the name and complete it by choosing from the popup list.
Configurable shape appearance
Adjust the background color, font color and font weight and font settings of shapes.
Gradient shape background
Draw vivid, attractive diagrams with shapes paint with gradient color.
Quick shape layout
Instantly align a group of shape, distribute them evenly or set them to optimal size, with the help of the resource-centric diagramming interface.
Object diagram
View a snapshot of instances of classifiers in UML class diagrams. Similar to class diagrams, object diagrams show the static design of a system from a prototypical perspective.
Keep connector route readable with line jump
Show the intersections between connectors as a visual bridge for clear visibility of connector path.
Various line jump options
Show the visual bridge that built on top of intersections between connectors in the style you like arc, gap and square.
Print with diagram properties e.g. name, description shown
Add a diagram info box to diagram. Each box presents information like diagram name and description.
Bookmark diagram and shape
Once you ve added a bookmark to a diagram or shape, you can navigate to it from anywhere in your project.
Locate shape by URL
Every model element has a unique URL. You can send the URL to your colleagues to locate the target elements easily.
Single model element, multiple views
Re-use a model element in multiple diagrams. Whenever a change is made to any instance, the rest will be updated automatically.
Composite structure diagram
Visualize the internal structure of a class or collaboration with UML composite structure diagram. Model a system from a micro point-of-view using UML composite structure diagram.
Automatic expand diagram margin
Automatic expand diagram base on the growth of design. Margin can be defined visually in the UML tool.
Split diagram into multiple inner panes
Compare different portions of big diagram is troublesome. You can split diagram for viewing different parts of diagram without scrolling back and forth.
Show tagged values in shape body
Add user-defined properties by adding tagged values to shapes. Optionally show the tagged values in shape body to read the properties in diagram.
Timing diagram
Timing diagrams model the behavior of objects throughout a given period of time. It is a commonly used UML tool for designing real-time and distributed systems.
Adjustable time unit
Drag to move a time unit back and forth. Have a timing frame updated automatically according to your change.
Configure hotkey for diagramming commands
Define your own hotkey for diagramming command. E.g. C for creating class.
Interaction overview diagram
View the sequence of interactions with UML interaction overview diagram. Interaction overview diagram helps represent complex scenario that involve multiple interactions presented as multiple UML sequence diagrams.
Show diagram thumbnail in interaction overview
View the thumbnail of interaction diagrams or sequence diagrams. View and know the control flows of interactions.
SysML requirement diagram
Requirement is what your clients want and what your team have to fulfill. It is so important that needs to be managed carefully. The SysML requirement diagram provides a visual approach in representing and managing system requirements. In a requirement diagram, requirements are shown as blocks, with connectors in between, illustrating the derivation, dependency and grouping of requirements.
User-defined requirement types
Define your own requirement types, with user-defined properties and appearance.
Export and import requirements to Excel
Produce a list of requirement to Excel for external manipulation. Import the file back for updating.
Block definition diagram
Visualize your system hierarchy. Define the system/component classifications in blocks to get a better picture of interconnections between these system components.
Specify project management properties
Set status, difficulty, priority, version, iteration, phase and discipline to each model element for project management purpose.
Open diagram in quick by its name
Search and locate diagram is critical when project grows bigger and bigger. The jump feature allows you to open a diagram by providing its name, or part of it.
Internal block diagram
Take a closer look at your system design from within. Describe the internal structure of a system in terms of its parts, ports, and connectors.
Parametric diagram
A restricted form of internal block diagram that shows only the use of constraint blocks along with the properties they constrain within a context. Parametric diagram is used to support engineering analysis, such as performance, reliability, and mass properties analysis.
Document user problem with textual analysis
Gather user s requirements as text document, and extract model elements from text. The problem statement editor provides a text editor for entering user requirements. You can extract glossary terms and model elements from text, and continue modeling with the model elements extracted.
Rich text in problem statement editor
User formatted text in describing user problems font family, font size, bulleted list, table, etc.
Keywords highlighting in problem statement
Important terms that are defined as glossary terms are highlighted in problem statement.
Identify candidate objects from problem statement
Extract actors, use cases, requirements, classes, packages, actions from words in problem statement.
Candidate pane view
Graphical representation of candidate items.
- Prof. William Burrows, Professor, University of Washington, Seattle
Model element referencing
Enhanced the way of adding references
Improved the experience of adding file, folder, diagram, model element and shape reference by reducing the steps you need to take to add those references.
Add internal references between diagrams, shapes, model elements
Make internal links between different kinds of project artifacts. Those references work both in Visual Paradigm and in any document and Web contents generated from your design.
Add external reference to business documents
Maintain reference between software design and the business documents to help find out why a design decision was made.
Mark in shape body when have reference added
Glance over a design. The tiny marker that appear in shapes body indicates that the shapes have references added.
Reference model element in description
Insert model element references to rich text description. The referenced model elements will be linked and highlighted.
The following is an outline and description of the database tables created during the standard installation of WordPress Version 3.4. Currently, the only database.
This UML sequence diagram tutorial introduces the commonly used elements of UML sequence diagrams and explains how to use them.