I'm speaking about following:
suppose we need to read a word from some memory location, but first it
needs to be computed. An abstract code could look like:
a := memory at: (b + (offset*4)).
Its a very common operation, which may occur in our code - read a slot
of object 'b' , designated by some offset.
We know, that on x86 CPUs it can be encoded into single instruction:
mov a, [b + offset*4]
But we can't support such complex instruction in low-level 'vurtual'
cpu instructions set - because different architectures may offer
different ways how to encode such operation.
A virtual cpu having most basic instructions , where we can add two
words, multiply two words or read memory from location designated by
address:
temp1 := offset*4.
temp2 := b+temp1.
a := memory at: temp2.
So, we should perform some kind of analyzis, to see , if it possible
on target architecture to encode these 3 separate instructions into
single or two native instructions.
That's where i begin questioning:
suppose i create an abstract class which represents a target
architecture. A subclasses of it defining a specific target
architecture. What interface we need in such class?
How to formalize it? Any ideas?
--
Best regards,
Igor Stasenko AKA sig.