Gavin writes:
[...a bunch of stuff I agree with...]
> As far as I know, the only downside to OCTing a program is that the new
> program will be much larger, thus eating up lots more memory, etc. I
Keep in mind that the OCTCOMP is a compiler, and like all compilers
has bugs in it from time to time. Thus, by OCT'ing a program you run a
*very slight* risk of introducing a bug. For example, the attached
SPL source code will run differently in CM vs. the OCT, due to (1)
a bug in condition code handling which makes the Classic differ from
both CM and OCT, and (2) a bug in FOR-loop handling by the OCTCOMP (the
bug makes FOR loops much faster, at the cost of not catching sneaky code).
That said, I still strongly encourage the OCT'ing of CM code!
Stan Sieler [log in to unmask]
http://www.allegro.com/sieler.html
--------------------------------cut here-------------------------------------
begin
integer
len,
st; ! spl'type result
logical array
buf (0 : 39);
byte array
buf' (*) = buf;
equate
spltype'cisc = 0,
spltype'cm = 1,
spltype'oct = 2;
intrinsic
ascii,
print;
<<***************************************************************>>
integer procedure spl'type;
<<--------------------------------------------------------
Returns different values for different implementations:
! 0 = CISC
! 1 = CM
! 2 = OCT
--------------------------------------------------------->>
begin
integer
i;
push (status);
tos.(06:02) := 3; ! try to set condition code to CCU
tos.(02:01) := 0; ! turn off arith traps
tos.(04:02) := 0; ! turn off overflow & carry
set (status);
push (status);
if tos.(6:2) = 3 then
begin
spl'type := spltype'cisc; ! CISC
go end'proc;
end;
for i := 0 until 4 do
begin
del;
tos := 1;
end;
if i >= 4 then
spl'type := spltype'oct ! OCT
else
spl'type := spltype'cm; ! CM
end'proc:
end <<spl'type proc>>;
<<***************************************************************>>
len := move buf' := "This program is running on a ";
st := spl'type;
if st = spltype'cisc then
len := len + move buf' (len) := "Classic HP3000 (CISC)"
else if st = spltype'cm then
len := len + move buf' (len) := "PA-RISC HP3000 in CM"
else if st = spltype'oct then
len := len + move buf' (len) := "PA-RISC HP3000 in OCT'd CM"
else
begin
len := len + move buf' (len) := "unknown HP3000 (st = ";
len := len + ascii (st, 10, buf' (len));
len := len + move buf' (len) := ")";
end;
print (buf, -len, 0);
end.
|