[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[open-cobol-list] Update From AT&T
From: |
Robert Sherry |
Subject: |
[open-cobol-list] Update From AT&T |
Date: |
Fri Jun 17 13:20:17 2005 |
We started using OpenCobol over two years ago for several large projects
containing millions of lines of Cobol that had been compiled on MVS with the
IBM Cobol compiler.
During that time we made a number of changes to the compiler to fix bugs,
for MVS conformance, to add extensions, and to improve performance. We
contributed earlier changes for performance improvements more than a year
ago and they have been integrated into the current compiler release.
At this time we would like to contribute a large number of fixes, additions,
and performance improvements. We hope that as many as possible will be
merged into the official compiler stream. We have put #if _ATT_ ...
#endif around most of our changes. In certain cases, it was not practical to
place #if _ATT_ around our changes. These can be removed as the code is
merged into the official compiler source.
Our current compiler maintainer is Bob Sherry and he will add these changes
to CVS unless there are objections.
Here is a summary of the changes we are submitting.
1. Performance improvements in libcob/numeric.c:
a. Performance measurements showed that about 8% of the run time
was spent with cob_get_sign() and cob_put_sign(). We reduced
the number of calls to cob_put_sign through the use of macros.
As a result, changes were made to the file common.h and
the routine cob_real_put_sign.
b. When cob_numeric_cmp() is called with string type arguments,
in many cases, the comparison can be made without conversion
to numerical values. We have added code for this optimization.
c. We rewrote decimal_get_packed() and cob_decimal_set_packed()
using table lookups for much faster performance. These
routines are defined in numeric.c
d. We added a cob_add_int_to_packed() which is an order of
magnitude faster than having to do the conversions.
2. Bug fixes:
a. RELATIVE_SIZE(f) and RELATIVE_SEEK(f, i) macros changed to
work with 64 bit file sizes in libcob/fileio.c. For
RELATIVE_SIZE we added a cast to the type off_t. Observe that
RELATIVE_SIZE calls fseek. In that call to fseek we added a
cast to off_t in the second argument to the function.
b. relative_write(), relative_rewrite(), relative_read_next()
We modified these routines to work with 64 bit files. Again the
issue Was the type of the second argument to fseek. These
routines can be found in libcob/fileio.c
c. We changed the output format of the headers in fileio.c to
big endian rather then in machine dependent format. The Pentium
is a little endian machine. This was done in the file fileio.c
d. Changes related to redefines:
if f1 and f2 are two fields such that one is a COMP field
and the other is a POINTER, the COMP field is changed to
COMP-5 because pointers use native representation.
This is done in the routine validate_field_1.
3. Changes to match IBM MVS compiler behavior:
a. cob_relax_redefine_value option added to field.c to cause
redefines with value to be treated as a warning.
b. cob_relax_hierachy_levels option added to allow non-group
levels with different values as if they had the same value.
This change was made in fields.c and config.def.
c. In the previous version, RECORDING MODE IS V was being ignored.
It now sets the minimum record size to 1 so that it uses
variable length records.
d. We modified redefines to search for the most recent sister
field with the given name rather than the first field that
has that name. This is in field.c.
4. Language Extensions:
a. Partial support for intrinsic functions.
Intrinsic functions in COBOL use the reserved word FUNCTION.
The intrinsic functions ABS, CURRENT-DATE, ORD-MAX, ORD-MIN,
MAX, MIN, and MOD are supported but currently arguments need
to be fields, not expressions.
To support intrinsic functions in the compiler, we did the
following:
1. Added the files intrinsics.h and intrinsics.c
2. In tree.h, we added a definition for the structure
cb_intrinsic_call and two macros.
3. We modified cobc.c removing the static modifier from the
routine make_tree.
4. The new files stdcoblib.h and stdcoblib.c have been added
to the runtime library to implement the functions.
To test functions, we added the file func.at to the directory
mvs.dir. We updated the file mvs.at to include the file func.at.
b. Reserved words can be disabled in config file.
Under MVS, CYCLE is not a reserved word. We changed the
routine cb_init_reserved() in the file reserved.c. To
allow such changes to be compiler specific, we added
"not-reserved" to the file ibm.conf. We also added the string
"att?" as a prefix to some keywords in the configuration file.
We modified config.c to ignore unsupported "prefix?*" config
options. This allowed us to test _ATT_==1 and _ATT_==0 versions
of the compiler using a single set of config files. We expect
these to be removed for any changes that are merged in to the
official compiler.
5. Compiler features:
a. New tracing facility.
The flag -parser-debug was added to the compiler. This causes
the variable yydebug to be set to 1 which results in the parser
showing all its shifting and reducing action. This can be
valuable aid in debugging the compiler but it is not useful for
debugging COBOL programs.
b. Tree dump facility.
For debugging purposes we added the files dump.c and dump.h.
The file dump.c contains routines for printing out the
intermediate representation of the code. The format is
suitable for display with GraphViz (using the cob2dot shell
script, included with our additions.) GraphViz software can
be downloaded from http://www.graphviz.org. The dump.h header
is included by cobc.c and tree.c
c. cb_name() extensions.
The routine cb_name() was incomplete and we completed it.
We moved it from tree.c and moved it to a new file name.c.
d. Runtime verification of compile options during module
initialization.
If module 1 and module 2 were compiled with different versions
of the OpenCobol compiler and then linked together, the
executable
might not run properly. Therefore, we now insert run time checks
for this condition. We added the following fields to the
cob_module structure:
unsigned char major
unsigned char minor
unsigned char build
unsigned char patch
which are checked against the values from the calling module.
The runtime module checks also check config file
incompatibilities
between compiled modules.
e. We modified the startup to support passing arguments and
performing initialization at startup. The compiler option
-fmain can take the name of a function to call at startup.
We use this to establish a db2 connection to handle Cobol
with embedded SQL.
6. Miscellaneous Changes:
a. In fileio.c the line:
#if HAVE_DB
Was changed to:
#if HAVE_DBOPEN.
This was done due to the fact that some systems have the file
db.h but do not support the function db_open.
b. cob_init - We also added another parameter to cob_init. This
parameter is called flags and is of type unsigned long. flags
contain compile-time config flags that must be the same for all
compilation units; the flags are checked at the same time the
compiler major/minor numbers are checked.
c. In the routine file_open, we removed the local variable fp,
which was of type FILE *. This was done to stream line the
code. We changed the output format of the headers in fileio.c
to be the standard big endian rather then in machine dependent
format. The Pentium is a little endian machine.
7. Build Changes:
a. We have added an nmake Makefile that can be used to build and
package the compiler using the AST Toolkit which can be
downloaded from http://www.research.att.com/sw/download.
b. The file config.iffe is included. When building with nmake,
this file is used by the iffe command to generate the config
header file.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [open-cobol-list] Update From AT&T,
Robert Sherry <=