abstract methods in AbstractAssembler

Christian Thalinger christian.thalinger at oracle.com
Fri Feb 8 16:06:22 PST 2013


On Feb 8, 2013, at 3:25 PM, Thomas Wuerthinger <thomas.wuerthinger at oracle.com> wrote:

> Thanks for pointing out the missing abstractions. The assembler is currently only abstracted for general-purpose processors and is not suitable for generating GPU code.
> 
> From the methods below, we can immediately remove "bangStack(int)", it should not be in the platform-independent part.

Sounds good.  What about align and patchJumpTarget?

> 
> The other methods are currently used when emitting code for LIR blocks. So, in what way do you want to use the LIR? Will there be no control flow in the LIR and all instructions be in one LIR block?

No, there is control flow.  For example I would like to see LabelOp and JumpOp to move down into <ARCH>ControlFlow or similar.  Something like:

        @Override
        public void emitCode(TargetMethodAssembler tasm) {
            tasm.asm.jmp(destination.label());
        }

should not be in platform-independent code.

> 
> Also, do you want to reuse Buffer object in the assembler base class? Or do you need your own data structure for emitting the assembly code?

First I though I need something else like a Buffer.Text but in fact I can emit text into the existing buffers.  I'm fine there.

-- Chris

> 
> - thomas
> 
> On Feb 7, 2013, at 7:30 PM, Christian Thalinger <christian.thalinger at oracle.com> wrote:
> 
>> Currently I'm adding other architectures to Graal.  In order to ease that task I have a tool which generates the Assembler from an ISA description file.
>> 
>> Now I have problems with these methods in AbstractAssembler:
>> 
>>   public abstract void align(int modulus);
>>   public abstract void jmp(Label l);
>>   protected abstract void patchJumpTarget(int branch, int jumpTarget);
>>   public abstract void bangStack(int disp);
>> 
>> Two problems actually:
>> 
>> 1)  I could generate these methods but they are not part of an ISA;  I'd like to keep it abstracted and not add anything that doesn't belong into an assembler.
>> 
>> 2)  Not all architectures require what the methods above try to do.  This means that LabelOp, JumpOp, Label.patchInstruction and Backend.emitStackOverflowCheck need to be either moved somewhere else or need more abstraction.
>> 
>> Any ideas?
>> 
>> -- Chris
> 



More information about the graal-dev mailing list