RE: [sv-ec] [SystemVerilog Errata 00000025] Pass by reference behavior of dynamically allocated objects

From: Rich, Dave <Dave_Rich@mentorg.com>
Date: Mon Nov 08 2004 - 00:22:37 PST

Neil,

 

I think this proposal needs further clarification. The intent of a
dynamic array was to allocate contiguous chunks of memory for the entire
array, so you could only grow the array if there was adjacent space.
Therefore any new[] operation could potentially relocate the array. .
For queues, pushes and pops should not disturb the existing references.

 

I also think this functionality should be entirely contained in section
10.4.2, rather than split it up into a number of sections.

 

My suggestions are below.

 

Dave

 

 

-----Original Message-----
From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of Neil
Korpusik
Sent: Saturday, November 06, 2004 8:27 PM
To: Dave Rich
Cc: sv-ec@eda.org
Subject: Re: [sv-ec] [SystemVerilog Errata 00000025] Pass by reference
behavior of dynamically allocated objects

 

A proposal for errata 25 was added to the database. A copy of the
proposal

is shown below.

 

Neil

 

Section 4.6.1 new[]

 

ADD

 

When new is called to re-size an existing dynamic array, elements are
added or removed. When the size is increased, additional array elements
are added. When the size is decreased, existing array elements are
removed. Elements that have been removed from a dynamic array may still
be in use by tasks or functions that were called with pass by reference
for those elements (See Section 10.4.2). Existing elements of a dynamic
array continue to be part of a dynamic array after it has been re-sized
unless the new size of the dynamic array requires them to be removed.

 

Section 10.4.2 Pass by reference

 

ADD (after the paragraph that starts with - "When the argument is passed
by

reference, both the caller and the subroutine share the same
representation...")

 

Elements of dynamic arrays, queues and associative arrays that are
passed by reference may get removed or reallocated from the array before
the called function or task completes. The specific array element passed
by reference will shall continue to exist within the scope of the called
tasks or functions until it they completes. Changes made to the values
of array elements by the called task or function will shall not be
reflected in the array if the element was removed from the array before
the changes were made visible outside the scope of those tasks or
functions. These references shall be called outdated references.

 

The following operations on a variable sized array shall cause existing
references to elements of that array to become outdated references:

 

* A dynamic array is reallocated with an implicit or explict
new[].

* A dynamic array is deleted with the delete() method

* The element of an associative array being referenced is
deleted with the delete() method.

* A queue is assigned with an array aggregate expression that
does not explicitly contain the element being referenced.

* The element of queue being referenced is deleted by a queue
method

 

 

 
Received on Mon Nov 8 00:22:54 2004

This archive was generated by hypermail 2.1.8 : Mon Nov 08 2004 - 00:23:22 PST