Modify the assembly language for the method Main.big_endian
to test whether the machine you run SPIM on is big-endian or
little-endian:
class Main : IO is
big_endian() : Boolean := begin
let test : Boolean := true; in
if test then true else false fi
end
end;
Main() begin
if big_endian() then
out_string("big endian\\n")
else
out_string("little endian\\n")
fi
end;
end;
(Of course this implementation always prints big endian;
that's why you have to modify the assembly file!)
You will need to use the lb instruction to load a byte from
a specific address to test endian-ness. Please
Main.big_endian,
Consider the following class (in primes.cl)
class Sieve : IO is prime : Integer; next : Sieve; ... end;
Integer object take
(including the eye-catcher)?
Sieve object take?
Include all its attributes and also including all the words making up
the integer object it refers to,
but not including the words for the next Sieve object.
How much space would a Sieve object
take if this method was used?
primes.cl using the -g option.
What happens different when you run it?
Explain!