Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
<== Date ==> <== Thread ==>

Subject: Re: CALC expression
From: Tim Mooney <mooney@aps.anl.gov>
To: Andrew Johnson <anj@aps.anl.gov>
Cc: tech-talk@aps.anl.gov
Date: Wed, 29 Sep 2010 14:41:48 -0500
Andrew Johnson wrote:
Hi Tim,

On Wednesday 29 September 2010 00:47:16 Tim Mooney wrote:
  
  I like the idea of increasing the size of the CALC field.  I'd suggest
80.
    

Thanks for that suggestion

  
The RPCL field is private, so it might be left at its current size for
most expressions, and reallocated for the occasional long _expression_.
    

That would not be acceptable; the RPCL field is a fixed length char array, so 
we can't change its size for individual record instances.  I don't want anyone 
being able to crash my IOC by writing long versions of the _expression_ 1?1:1?
1:1?1:1?1:1 into the CALC field (1?1:1 expands to 31 bytes in postfix, and 
each additional 1?1: adds another 21 bytes â there's a macro in postfix.h that 
calculates the RPCL size needed from the CALC size).

We *could* make RPCL into a char* pointer and allocate it dynamically 
according to the particular _expression_, but that means making code changes to 
the record and also opens up the possibility of free memory fragmentation on 
vxWorks IOCs (none of the other standard record types allocate memory after 
initialization to avoid that).  I think it's too late to make those kind of 
changes at this point.

  
This is what I meant by "reallocate". I was imagining allocating the current RPCL
size at record init (unless a calc _expression_ already existed at that time that required
more space), and from then on checking to ensure that RPCL is large enough when
a new calc _expression_ is written. Reallocating every time doesn't seem necessary;
I'd reallocate only if RPCL must increase.

I think fragmentation would not be a problem with an implementation like this, unless
folks are just *hammering* on calc expressions with, say, stringout records. As far as
I know, I'm the only one who's at all likely to do something as whacked out as that.

In any case, I would not have any problem with putting this off until after the upcoming
release. I don't detect an urgency great enough to merit changing the implementation twice.
Alternatively we could add integer literal support to the code in libCom/calc, 
which would reduce the incremental expansion factor from 21/4 to 10/3 or 
better, but again that would be making code changes uncomfortably late in the 
development cycle for 3.14.12.

  
I would not worry /too/ much about wasted space.  After all, every record
has a 41-character DESC field, most of them are permanently empty, and I
don't recall hearing complaints about that.
    

Making CALC 80 translates to RPCL being 419 bytes instead of its current 209 
bytes.  Lewis' suggestion of 64 bytes translates to RPCL being 335 bytes.

  
When I said "I would not worry /too/ much...", I was of course assuming my context ,
which would not add 250 bytes to all calc records, but instead would add 40 to most
of them, and 250 only to some (probably only a few).
Do any small-IOC guys want to weigh in on these suggestions?

- Andrew
  


-- 
Tim Mooney (mooney@aps.anl.gov) (630)252-5417
Software Services Group (www.aps.anl.gov)
Advanced Photon Source, Argonne National Lab

Replies:
Re: CALC expression Eric Norum
References:
CALC expression Andrew Wagner
Re: CALC expression Andrew Johnson
Re: CALC expression Tim Mooney
Re: CALC expression Andrew Johnson

Navigate by Date:
Prev: Re: CALC expression Andrew Johnson
Next: Re: CALC expression Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
Navigate by Thread:
Prev: Re: CALC expression Pam Gurd
Next: Re: CALC expression Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
ANJ, 29 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·