Академический Документы
Профессиональный Документы
Культура Документы
1. Legacy Assembler
A legacy is something handed down or received from an
ancestor or predecessor. A legacy assembler system may
be defined as any system which:
1. is implemented in assembler, or has substantial components implemented in assembler;
2. was developed some years ago and has been handed
down to the current maintainers;
3. is nevertheless essential to the smooth running of the
organisation.
There are estimated to be over 250 million lines of IBM
370 assembler currently in operation at the major IBM
mainframe sites in Europe alone, but there is a decreasing
pool of experienced assembler programmers. As a result,
there is increasing pressure to move away from assembler,
including pressure to move less critical systems away from
the mainframe platform, so the legacy assembler problem is
likely to become increasingly severe.
There are a number of options for dealing with legacy
assembler systems:
1. Keep the current application and modify it as needed;
2. Discard the application and replace it with a purchased
vendor package;
3. Understand and document the application and then
rewrite it in a high level language (HLL);
If the application is relatively stable with few enhancement requests and bug fixes, then keeping the current application may be a viable option. If there is a shortage
of assembler expertise, then a wrap and freeze approach
may work: wrap a modern interface around the old application and work around any bugs or limitations, rather
than attempting to fix the code. Alternatively, if assembler
expertise is still readily available and enhancement requirements are moderate, then it may be possible to modernise
the application and continue to use it.
Do nothing is always an attractive option in the short
term: the short term cost of doing nothing is very low! But
in the face of a worsening skills shortage and increasing
pressure to modernise the application, or to migrate to a
more cost-effective platform, then doing nothing may not
be a viable long-term option.
to fit the business. More importantly, the differences between your application and the package used by everyone
else in the industry may be what gives you a competitive
edge: it would be foolish to throw away this advantage
unless you are forced to do so: one major package tour
operator has rejected the replace with a package option
for precisely this reason. The tour operator believed that
their hand-crafted assembler system gave them a substantial
edge in the marketplace: why give this up in order to run
the same package used by every other tour operator in the
business?
48.00
39.00
21.00
17.00
EQU *-RECSTART
3. Our Approach
Over the last 20 years the authors have developed a wide
spectrum language (WSL) and transformation theory which
has formed the basis for a successful assembler analysis
3.3.1
Preventing Loops
There are two cases where this strategy can cause looping:
both of which must be avoided:
1. A transformation could make the WSL program larger.
Later on (perhaps as a result of other transformations)
the same transformation could become applicable to
a component of the expanded program. The result is
that the program size grows indefinitely without converging to a solution;
2. A transformation could undo the effect of a previous
transformation: the program could then oscillate between two different versions, again without converging
to a solution.
Broadly speaking, our solution to both of these problems is
to only apply a transformation when it makes the program
better according to some complexity metric. If the complexity metric is integer valued and every program reduces
complexity (according to the metric), then the transformation process is guaranteed to converge.
Unfortunately, there is currently no universal integer
valued complexity metric which is monotonically reduced
under every transformation application (this is a topic for
further research). However, the vast majority of transformations do reduce the size of the program: overall, the WSL to
WSL transformation step reduces the size to between a third
to a half of the original. A few transformations do increase
the size of the program, but the result is obviously an
improvement (in the opinion of the developers anyway!)
and the migration engine is prevented from applying the
inverse of these transformations.
As a result of these precautions, the only infinite loops
we have seen have been the result of bugs in the implementation of a transformation.
3.3.2
Dataflow Analysis
A1 BAL R12,FOO
A2 ...
FOO ST R12,SAVER12
LA R12,0
...
L
R13,SAVER12
BR B13
SUBROUTINE CALL
SAVE RETURN ADDRESS
RE-USE R12
RESTORE RETURN ADDR
RETURN FROM SUBR
EQU
*
<FERMAT><SB><1><==========================>
MVI
PASOPT,CN
DEFAULT NO PASSWORD
ICM
R1,B1111,IKJPW
SOURCE FIELD
<FERMAT><EB><1><==========================>
BZ
GRESU
NOT PRESENT, CONT
189
190
190
191
191
192
RACROUTE REQUEST=EXTRACT,WORKA=(9),
X
TYPE=ENCRYPT,ENCRYPT=((6),INST),...
<FERMAT><SB><1><==========================>
LTR
R15,R15
TEST RACX
<FERMAT><EB><1><==========================>
BNZ
ENDBRAC
BAD
MVC
RXPWNEWP,PASSWORK MOVE BACK AGAIN
404
405
428
428
428
429
430
431
432
433
434
435
436
437
438
...
*
*
*
* PERFORM UPDATE ON LOCAL SYSTEM
*
LA
R4,RXPWUSER
LA
R5,8
LA
R6,0
LOOPU
EQU
*
CLI
0(R4),C
WITH ICHEINTY.
ADDR USERNAME
MAX LENGTH
COUNTER
END YET?
BE
LA
LA
BCT
EQU
STC
MVC
ENDU
YES
R4,1(R4)
UP PTR
R6,1(R6)
UP COUNTER
R5,LOOPU
LOOP IF NOT END
*
R6,NUSER
SET LENGTH OF UID
NUSER+1(8),RXPWUSER SET VALUE OF UID
439
440
441
442
ENDU
443
444
445
*
446
* UPDATE PASSWORD IF SPECIFIED
447
*
448
*
<FERMAT><SB><1><==========================> 449
CLI
PASOPT,CY
PASSWORD OPERAND
449
*
<FERMAT><EB><1><==========================> 449
BNE
RESREV
NO
450
*
451
MVC
NDATE,=XL40000000F ZEROS (PACK DEC) 452
6. Related Work
Feldman and Friedman [4] describe an automated assembler to C migration project which involved the migration of
a large database system and application generator written
in IBM 370 assembly language. They developed a literal
translator which translated each instruction separately into
C code with no optimisation. In effect, the result of the
translation was an IBM 370 simulator. When became clear
that this approach would not be sufficient, a new translator (called Bogart) was developed based on abstraction
and re-implementation. Bogart produced code which was
between half and three quarters as large and more than
twice as fast as the literal translators output. However,
the translator required extensive manual modification of the
assembler code before it could be applied. Experienced
programmers could process about 3600 lines of code per
person-month. As a result, Manual preparation of the code
has probably damaged the codes quality. Programmers
estimate that the code is less efficient after standardization,
and, naturally, new bugs were introduced. . . . two versions
now had to be debugged, tested, and maintained [4]. In
addition Readability was only a secondary goal in this
case, because the target code was not meant to be handled
by human programmers
In contrast, our goals with the FermaT migration system
are:
1. No manual modification of the assembler code required before migration;
2. Generate HLL code which is both efficient to execute and maintainable by programmers unfamiliar with
IBM 370 assembler;
3. Reduce the amount of modification of the HLL code
to the absolute minimum: our aim is always for 100%
automated migration, but there will always be a handful of constructs which appear so rarely in the code
that it is easier to fix the generated code than program
a special-purpose transformation rule.
The core transformation engine of FermaT (without the
source and target translators) is available under the GNU
GPL (General Public Licence) from the following web sites:
http://www.dur.ac.uk/dcs6mpw/fermat.html
http://www.cse.dmu.ac.uk/mward/fermat.html
7. Future work
We are currently exploring the integration of FermaT
with AnaTempura for source code analysis.
AnaTempura is a tool for the runtime verification of systems using Interval Temporal Logic (ITL) and its executable
subset Tempura. The runtime verification technique uses
assertion points to check whether a system satisfies timing,
safety or security properties expressed in ITL. The assertion
points are inserted in the source code of the system and
will generate a sequence of information (system states), like
values of variables and timestamps of value change, while
the system is running. Since an ITL property corresponds to
a set of sequences of states (intervals), runtime verification
is just checking whether the sequence generated by the
system is a member of the set of sequences corresponding
to the property we want to check.
The integration between AnaTempura and FermaT will
allow us to:
Check (both statically and dynamically) that, for example the migration process is correct with respect
to some properties that are preserved by the original
system; and
Perform various source code analysis, especially if we
perform slicing first using FermaT.
8. Conclusion
Program transformations form the basis for a practical
solution to assembler reengineering and migration projects.
Near 100% automated migration can be achieved once the
transformation engine has been properly tuned to match the
source system.
9. References