mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
use ir::Type in Compiler::store
This commit is contained in:
parent
8af9bb8297
commit
2ed52c05a8
@ -110,7 +110,9 @@ class Compiler {
|
|||||||
virtual void checkBounds(Operand* object, unsigned lengthOffset,
|
virtual void checkBounds(Operand* object, unsigned lengthOffset,
|
||||||
Operand* index, intptr_t handler) = 0;
|
Operand* index, intptr_t handler) = 0;
|
||||||
|
|
||||||
virtual void store(unsigned srcSize, Operand* src, unsigned dstSize,
|
virtual void store(ir::Type srcType,
|
||||||
|
Operand* src,
|
||||||
|
ir::Type dstType,
|
||||||
Operand* dst) = 0;
|
Operand* dst) = 0;
|
||||||
virtual Operand* load(unsigned srcSize, unsigned srcSelectSize, Operand* src,
|
virtual Operand* load(unsigned srcSize, unsigned srcSelectSize, Operand* src,
|
||||||
unsigned dstSize) = 0;
|
unsigned dstSize) = 0;
|
||||||
|
@ -2593,11 +2593,18 @@ class MyCompiler: public Compiler {
|
|||||||
static_cast<Value*>(index), handler);
|
static_cast<Value*>(index), handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void store(unsigned srcSize, Operand* src, unsigned dstSize,
|
virtual void store(ir::Type srcType,
|
||||||
|
Operand* src,
|
||||||
|
ir::Type dstType,
|
||||||
Operand* dst)
|
Operand* dst)
|
||||||
{
|
{
|
||||||
appendMove(&c, lir::Move, srcSize, srcSize, static_cast<Value*>(src),
|
appendMove(&c,
|
||||||
dstSize, static_cast<Value*>(dst));
|
lir::Move,
|
||||||
|
srcType.size(),
|
||||||
|
srcType.size(),
|
||||||
|
static_cast<Value*>(src),
|
||||||
|
dstType.size(),
|
||||||
|
static_cast<Value*>(dst));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Operand* load(unsigned srcSize, unsigned srcSelectSize, Operand* src,
|
virtual Operand* load(unsigned srcSize, unsigned srcSelectSize, Operand* src,
|
||||||
|
@ -3205,9 +3205,9 @@ compileDirectInvoke(MyThread* t, Frame* frame, object target, bool tailCall,
|
|||||||
methodParameterFootprint(t, target));
|
methodParameterFootprint(t, target));
|
||||||
|
|
||||||
c->store(
|
c->store(
|
||||||
TargetBytesPerWord,
|
types.address,
|
||||||
frame->absoluteAddressOperand(returnAddressPromise),
|
frame->absoluteAddressOperand(returnAddressPromise),
|
||||||
TargetBytesPerWord,
|
types.address,
|
||||||
c->memory(
|
c->memory(
|
||||||
c->threadRegister(), types.address, TARGET_THREAD_TAILADDRESS));
|
c->threadRegister(), types.address, TARGET_THREAD_TAILADDRESS));
|
||||||
|
|
||||||
@ -3764,8 +3764,10 @@ intrinsic(MyThread* t, Frame* frame, object target)
|
|||||||
Compiler::Operand* value = frame->popInt();
|
Compiler::Operand* value = frame->popInt();
|
||||||
Compiler::Operand* address = popLongAddress(frame);
|
Compiler::Operand* address = popLongAddress(frame);
|
||||||
frame->popObject();
|
frame->popObject();
|
||||||
c->store(
|
c->store(types.address,
|
||||||
TargetBytesPerWord, value, 1, c->memory(address, types.i4, 0, 0, 1));
|
value,
|
||||||
|
types.i1,
|
||||||
|
c->memory(address, types.i4, 0, 0, 1));
|
||||||
return true;
|
return true;
|
||||||
} else if ((MATCH(methodName(t, target), "getShort")
|
} else if ((MATCH(methodName(t, target), "getShort")
|
||||||
and MATCH(methodSpec(t, target), "(J)S"))
|
and MATCH(methodSpec(t, target), "(J)S"))
|
||||||
@ -3785,8 +3787,10 @@ intrinsic(MyThread* t, Frame* frame, object target)
|
|||||||
Compiler::Operand* value = frame->popInt();
|
Compiler::Operand* value = frame->popInt();
|
||||||
Compiler::Operand* address = popLongAddress(frame);
|
Compiler::Operand* address = popLongAddress(frame);
|
||||||
frame->popObject();
|
frame->popObject();
|
||||||
c->store(
|
c->store(types.address,
|
||||||
TargetBytesPerWord, value, 2, c->memory(address, types.i4, 0, 0, 1));
|
value,
|
||||||
|
types.i2,
|
||||||
|
c->memory(address, types.i4, 0, 0, 1));
|
||||||
return true;
|
return true;
|
||||||
} else if ((MATCH(methodName(t, target), "getInt")
|
} else if ((MATCH(methodName(t, target), "getInt")
|
||||||
and MATCH(methodSpec(t, target), "(J)I"))
|
and MATCH(methodSpec(t, target), "(J)I"))
|
||||||
@ -3814,9 +3818,9 @@ intrinsic(MyThread* t, Frame* frame, object target)
|
|||||||
Compiler::Operand* value = frame->popInt();
|
Compiler::Operand* value = frame->popInt();
|
||||||
Compiler::Operand* address = popLongAddress(frame);
|
Compiler::Operand* address = popLongAddress(frame);
|
||||||
frame->popObject();
|
frame->popObject();
|
||||||
c->store(TargetBytesPerWord,
|
c->store(types.address,
|
||||||
value,
|
value,
|
||||||
4,
|
types.i4,
|
||||||
c->memory(
|
c->memory(
|
||||||
address,
|
address,
|
||||||
MATCH(methodName(t, target), "putInt") ? types.i4 : types.f4,
|
MATCH(methodName(t, target), "putInt") ? types.i4 : types.f4,
|
||||||
@ -3850,9 +3854,9 @@ intrinsic(MyThread* t, Frame* frame, object target)
|
|||||||
Compiler::Operand* value = frame->popLong();
|
Compiler::Operand* value = frame->popLong();
|
||||||
Compiler::Operand* address = popLongAddress(frame);
|
Compiler::Operand* address = popLongAddress(frame);
|
||||||
frame->popObject();
|
frame->popObject();
|
||||||
c->store(8,
|
c->store(types.i8,
|
||||||
value,
|
value,
|
||||||
8,
|
types.i8,
|
||||||
c->memory(address,
|
c->memory(address,
|
||||||
MATCH(methodName(t, target), "putLong") ? types.i4
|
MATCH(methodName(t, target), "putLong") ? types.i4
|
||||||
: types.f4,
|
: types.f4,
|
||||||
@ -3876,9 +3880,9 @@ intrinsic(MyThread* t, Frame* frame, object target)
|
|||||||
Compiler::Operand* value = frame->popLong();
|
Compiler::Operand* value = frame->popLong();
|
||||||
Compiler::Operand* address = popLongAddress(frame);
|
Compiler::Operand* address = popLongAddress(frame);
|
||||||
frame->popObject();
|
frame->popObject();
|
||||||
c->store(8,
|
c->store(types.i8,
|
||||||
value,
|
value,
|
||||||
TargetBytesPerWord,
|
types.address,
|
||||||
c->memory(address, types.address, 0, 0, 1));
|
c->memory(address, types.address, 0, 0, 1));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -4236,42 +4240,46 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
case fastore:
|
case fastore:
|
||||||
c->store(TargetBytesPerWord,
|
c->store(types.address,
|
||||||
value,
|
value,
|
||||||
4,
|
types.f4,
|
||||||
c->memory(array, types.f4, TargetArrayBody, index, 4));
|
c->memory(array, types.f4, TargetArrayBody, index, 4));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case iastore:
|
case iastore:
|
||||||
c->store(TargetBytesPerWord,
|
c->store(types.address,
|
||||||
value,
|
value,
|
||||||
4,
|
types.f4,
|
||||||
c->memory(array, types.i4, TargetArrayBody, index, 4));
|
c->memory(array, types.i4, TargetArrayBody, index, 4));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case bastore:
|
case bastore:
|
||||||
c->store(TargetBytesPerWord,
|
c->store(types.address,
|
||||||
value,
|
value,
|
||||||
1,
|
types.i1,
|
||||||
c->memory(array, types.i4, TargetArrayBody, index, 1));
|
c->memory(array, types.i4, TargetArrayBody, index, 1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case castore:
|
case castore:
|
||||||
case sastore:
|
case sastore:
|
||||||
c->store(TargetBytesPerWord,
|
c->store(types.address,
|
||||||
value,
|
value,
|
||||||
2,
|
types.i2,
|
||||||
c->memory(array, types.i4, TargetArrayBody, index, 2));
|
c->memory(array, types.i4, TargetArrayBody, index, 2));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case dastore:
|
case dastore:
|
||||||
c->store(
|
c->store(types.f8,
|
||||||
8, value, 8, c->memory(array, types.f4, TargetArrayBody, index, 8));
|
value,
|
||||||
|
types.f8,
|
||||||
|
c->memory(array, types.f4, TargetArrayBody, index, 8));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lastore:
|
case lastore:
|
||||||
c->store(
|
c->store(types.i8,
|
||||||
8, value, 8, c->memory(array, types.i4, TargetArrayBody, index, 8));
|
value,
|
||||||
|
types.f8,
|
||||||
|
c->memory(array, types.i4, TargetArrayBody, index, 8));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
@ -5834,9 +5842,9 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
case ByteField:
|
case ByteField:
|
||||||
case BooleanField:
|
case BooleanField:
|
||||||
c->store(
|
c->store(
|
||||||
TargetBytesPerWord,
|
types.address,
|
||||||
value,
|
value,
|
||||||
1,
|
types.i1,
|
||||||
c->memory(
|
c->memory(
|
||||||
table, types.i4, targetFieldOffset(context, field), 0, 1));
|
table, types.i4, targetFieldOffset(context, field), 0, 1));
|
||||||
break;
|
break;
|
||||||
@ -5844,45 +5852,45 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
case CharField:
|
case CharField:
|
||||||
case ShortField:
|
case ShortField:
|
||||||
c->store(
|
c->store(
|
||||||
TargetBytesPerWord,
|
types.address,
|
||||||
value,
|
value,
|
||||||
2,
|
types.i2,
|
||||||
c->memory(
|
c->memory(
|
||||||
table, types.i4, targetFieldOffset(context, field), 0, 1));
|
table, types.i4, targetFieldOffset(context, field), 0, 1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FloatField:
|
case FloatField:
|
||||||
c->store(
|
c->store(
|
||||||
TargetBytesPerWord,
|
types.address,
|
||||||
value,
|
value,
|
||||||
4,
|
types.f4,
|
||||||
c->memory(
|
c->memory(
|
||||||
table, types.f4, targetFieldOffset(context, field), 0, 1));
|
table, types.f4, targetFieldOffset(context, field), 0, 1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IntField:
|
case IntField:
|
||||||
c->store(
|
c->store(
|
||||||
TargetBytesPerWord,
|
types.address,
|
||||||
value,
|
value,
|
||||||
4,
|
types.i4,
|
||||||
c->memory(
|
c->memory(
|
||||||
table, types.i4, targetFieldOffset(context, field), 0, 1));
|
table, types.i4, targetFieldOffset(context, field), 0, 1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DoubleField:
|
case DoubleField:
|
||||||
c->store(
|
c->store(
|
||||||
8,
|
types.f8,
|
||||||
value,
|
value,
|
||||||
8,
|
types.f8,
|
||||||
c->memory(
|
c->memory(
|
||||||
table, types.f4, targetFieldOffset(context, field), 0, 1));
|
table, types.f4, targetFieldOffset(context, field), 0, 1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LongField:
|
case LongField:
|
||||||
c->store(
|
c->store(
|
||||||
8,
|
types.i8,
|
||||||
value,
|
value,
|
||||||
8,
|
types.i8,
|
||||||
c->memory(
|
c->memory(
|
||||||
table, types.i4, targetFieldOffset(context, field), 0, 1));
|
table, types.i4, targetFieldOffset(context, field), 0, 1));
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user