diff --git a/include/avian/codegen/compiler.h b/include/avian/codegen/compiler.h index 6e07a06d87..802601229d 100644 --- a/include/avian/codegen/compiler.h +++ b/include/avian/codegen/compiler.h @@ -140,7 +140,7 @@ class Compiler { ir::Value* index, intptr_t handler) = 0; - virtual ir::Value* truncateThenExtend(ir::SignExtendMode signExtend, + virtual ir::Value* truncateThenExtend(ir::ExtendMode extendMode, ir::Type extendType, ir::Type truncateType, ir::Value* src) = 0; @@ -148,7 +148,7 @@ class Compiler { virtual ir::Value* truncate(ir::Type type, ir::Value* src) = 0; virtual void store(ir::Value* src, ir::Value* dst) = 0; - virtual ir::Value* load(ir::SignExtendMode signExtend, + virtual ir::Value* load(ir::ExtendMode extendMode, ir::Value* src, ir::Type dstType) = 0; diff --git a/include/avian/codegen/ir.h b/include/avian/codegen/ir.h index d694f0c154..8d35f9fe23 100644 --- a/include/avian/codegen/ir.h +++ b/include/avian/codegen/ir.h @@ -132,9 +132,9 @@ class Type { } }; -enum SignExtendMode { SignExtend, ZeroExtend }; +enum class ExtendMode { Signed, Unsigned }; -enum CallingConvention { NativeCallingConvention, AvianCallingConvention }; +enum class CallingConvention { Native, Avian }; class Value { public: diff --git a/src/codegen/compiler.cpp b/src/codegen/compiler.cpp index cfa755dd83..36a4e5783a 100644 --- a/src/codegen/compiler.cpp +++ b/src/codegen/compiler.cpp @@ -2567,7 +2567,7 @@ class MyCompiler : public Compiler { Value* result = value(&c, resultType); appendCall(&c, static_cast(address), - ir::NativeCallingConvention, + ir::CallingConvention::Native, flags, traceHandler, result, @@ -2586,7 +2586,7 @@ class MyCompiler : public Compiler { Stack* b UNUSED = c.stack; appendCall(&c, static_cast(address), - ir::AvianCallingConvention, + ir::CallingConvention::Avian, flags, traceHandler, result, @@ -2741,14 +2741,14 @@ class MyCompiler : public Compiler { return dst; } - virtual ir::Value* truncateThenExtend(ir::SignExtendMode signExtend, + virtual ir::Value* truncateThenExtend(ir::ExtendMode extendMode, ir::Type extendType, ir::Type truncateType, ir::Value* src) { Value* dst = value(&c, extendType); appendMove(&c, - signExtend == ir::SignExtend ? lir::Move : lir::MoveZ, + extendMode == ir::ExtendMode::Signed ? lir::Move : lir::MoveZ, TargetBytesPerWord, truncateType.size(c.targetInfo), static_cast(src), @@ -2772,7 +2772,7 @@ class MyCompiler : public Compiler { static_cast(dst)); } - virtual ir::Value* load(ir::SignExtendMode signExtend, + virtual ir::Value* load(ir::ExtendMode extendMode, ir::Value* src, ir::Type dstType) { @@ -2780,7 +2780,7 @@ class MyCompiler : public Compiler { Value* dst = value(&c, dstType); appendMove(&c, - signExtend == ir::SignExtend ? lir::Move : lir::MoveZ, + extendMode == ir::ExtendMode::Signed ? lir::Move : lir::MoveZ, src->type.size(c.targetInfo), src->type.size(c.targetInfo), static_cast(src), diff --git a/src/codegen/compiler/event.cpp b/src/codegen/compiler/event.cpp index f59f5d124e..7bb0257f3f 100644 --- a/src/codegen/compiler/event.cpp +++ b/src/codegen/compiler/event.cpp @@ -368,13 +368,13 @@ class CallEvent : public Event { popIndex(0), stackArgumentIndex(0), flags(flags), - stackArgumentFootprint(callingConvention == ir::AvianCallingConvention + stackArgumentFootprint(callingConvention == ir::CallingConvention::Avian ? arguments.count : 0) { uint32_t registerMask = c->regFile->generalRegisters.mask; - if (callingConvention == ir::NativeCallingConvention) { + if (callingConvention == ir::CallingConvention::Native) { assertT(c, (flags & Compiler::TailJump) == 0); assertT(c, stackArgumentFootprint == 0); @@ -450,7 +450,7 @@ class CallEvent : public Event { Stack* stack = stackBefore; - if (callingConvention == ir::AvianCallingConvention) { + if (callingConvention == ir::CallingConvention::Avian) { for (size_t i = 0; i < arguments.count; i++) { stack = stack->next; } @@ -1257,7 +1257,7 @@ void appendCombine(Context* c, appendCall(c, value(c, ir::Type::addr(), constantSite(c, handler)), - ir::NativeCallingConvention, + ir::CallingConvention::Native, 0, 0, resultValue, @@ -1413,7 +1413,7 @@ void appendTranslate(Context* c, op, firstValue->type.size(c->targetInfo), resultValue->type.size(c->targetInfo)))), - ir::NativeCallingConvention, + ir::CallingConvention::Native, 0, 0, resultValue, @@ -1849,7 +1849,7 @@ void appendBranch(Context* c, Value* result = value(c, ir::Type::addr()); appendCall(c, value(c, ir::Type::addr(), constantSite(c, handler)), - ir::NativeCallingConvention, + ir::CallingConvention::Native, 0, 0, result, diff --git a/src/compile.cpp b/src/compile.cpp index 1426d2a8c9..65a1417a72 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -3575,7 +3575,7 @@ ir::Value* popLongAddress(Frame* frame) { return TargetBytesPerWord == 8 ? frame->popLarge(ir::Type::i8()) - : frame->c->load(ir::SignExtend, + : frame->c->load(ir::ExtendMode::Signed, frame->popLarge(ir::Type::i8()), ir::Type::iptr()); } @@ -3616,7 +3616,7 @@ bool intrinsic(MyThread* t UNUSED, Frame* frame, GcMethod* target) ir::Value* address = popLongAddress(frame); frame->pop(ir::Type::object()); frame->push(ir::Type::i4(), - c->load(ir::SignExtend, + c->load(ir::ExtendMode::Signed, c->memory(address, ir::Type::i1()), ir::Type::i4())); return true; @@ -3634,7 +3634,7 @@ bool intrinsic(MyThread* t UNUSED, Frame* frame, GcMethod* target) ir::Value* address = popLongAddress(frame); frame->pop(ir::Type::object()); frame->push(ir::Type::i4(), - c->load(ir::SignExtend, + c->load(ir::ExtendMode::Signed, c->memory(address, ir::Type::i2()), ir::Type::i4())); return true; @@ -3656,7 +3656,7 @@ bool intrinsic(MyThread* t UNUSED, Frame* frame, GcMethod* target) ir::Type type = MATCH(target->name(), "getInt") ? ir::Type::i4() : ir::Type::f4(); frame->push(type, - c->load(ir::SignExtend, c->memory(address, type), type)); + c->load(ir::ExtendMode::Signed, c->memory(address, type), type)); return true; } else if ((MATCH(target->name(), "putInt") and MATCH(target->spec(), "(JI)V")) @@ -3678,7 +3678,7 @@ bool intrinsic(MyThread* t UNUSED, Frame* frame, GcMethod* target) ir::Type type = MATCH(target->name(), "getLong") ? ir::Type::i8() : ir::Type::f8(); frame->pushLarge(type, - c->load(ir::SignExtend, c->memory(address, type), type)); + c->load(ir::ExtendMode::Signed, c->memory(address, type), type)); return true; } else if ((MATCH(target->name(), "putLong") and MATCH(target->spec(), "(JJ)V")) @@ -3696,7 +3696,7 @@ bool intrinsic(MyThread* t UNUSED, Frame* frame, GcMethod* target) ir::Value* address = popLongAddress(frame); frame->pop(ir::Type::object()); frame->pushLarge(ir::Type::i8(), - c->load(ir::SignExtend, + c->load(ir::ExtendMode::Signed, c->memory(address, ir::Type::iptr()), ir::Type::i8())); return true; @@ -3976,7 +3976,7 @@ loop: frame->push( ir::Type::object(), c->load( - ir::SignExtend, + ir::ExtendMode::Signed, c->memory(array, ir::Type::object(), TargetArrayBody, index), ir::Type::object())); break; @@ -3984,7 +3984,7 @@ loop: case faload: frame->push( ir::Type::f4(), - c->load(ir::SignExtend, + c->load(ir::ExtendMode::Signed, c->memory(array, ir::Type::f4(), TargetArrayBody, index), ir::Type::f4())); break; @@ -3992,7 +3992,7 @@ loop: case iaload: frame->push( ir::Type::i4(), - c->load(ir::SignExtend, + c->load(ir::ExtendMode::Signed, c->memory(array, ir::Type::i4(), TargetArrayBody, index), ir::Type::i4())); break; @@ -4000,7 +4000,7 @@ loop: case baload: frame->push( ir::Type::i4(), - c->load(ir::SignExtend, + c->load(ir::ExtendMode::Signed, c->memory(array, ir::Type::i1(), TargetArrayBody, index), ir::Type::i4())); break; @@ -4008,7 +4008,7 @@ loop: case caload: frame->push( ir::Type::i4(), - c->load(ir::ZeroExtend, + c->load(ir::ExtendMode::Unsigned, c->memory(array, ir::Type::i2(), TargetArrayBody, index), ir::Type::i4())); break; @@ -4016,7 +4016,7 @@ loop: case daload: frame->pushLarge( ir::Type::f8(), - c->load(ir::SignExtend, + c->load(ir::ExtendMode::Signed, c->memory(array, ir::Type::f8(), TargetArrayBody, index), ir::Type::f8())); break; @@ -4024,7 +4024,7 @@ loop: case laload: frame->pushLarge( ir::Type::i8(), - c->load(ir::SignExtend, + c->load(ir::ExtendMode::Signed, c->memory(array, ir::Type::i8(), TargetArrayBody, index), ir::Type::i8())); break; @@ -4032,7 +4032,7 @@ loop: case saload: frame->push( ir::Type::i4(), - c->load(ir::SignExtend, + c->load(ir::ExtendMode::Signed, c->memory(array, ir::Type::i2(), TargetArrayBody, index), ir::Type::i4())); break; @@ -4190,7 +4190,7 @@ loop: case arraylength: { frame->push(ir::Type::i4(), - c->load(ir::SignExtend, + c->load(ir::ExtendMode::Signed, c->memory(frame->pop(ir::Type::object()), ir::Type::iptr(), TargetArrayLength), @@ -4509,7 +4509,7 @@ loop: case ByteField: case BooleanField: frame->push(ir::Type::i4(), - c->load(ir::SignExtend, + c->load(ir::ExtendMode::Signed, c->memory(table, ir::Type::i1(), targetFieldOffset(context, field)), @@ -4518,7 +4518,7 @@ loop: case CharField: frame->push(ir::Type::i4(), - c->load(ir::ZeroExtend, + c->load(ir::ExtendMode::Unsigned, c->memory(table, ir::Type::i2(), targetFieldOffset(context, field)), @@ -4527,7 +4527,7 @@ loop: case ShortField: frame->push(ir::Type::i4(), - c->load(ir::SignExtend, + c->load(ir::ExtendMode::Signed, c->memory(table, ir::Type::i2(), targetFieldOffset(context, field)), @@ -4536,7 +4536,7 @@ loop: case FloatField: frame->push(ir::Type::f4(), - c->load(ir::SignExtend, + c->load(ir::ExtendMode::Signed, c->memory(table, ir::Type::f4(), targetFieldOffset(context, field)), @@ -4545,7 +4545,7 @@ loop: case IntField: frame->push(ir::Type::i4(), - c->load(ir::SignExtend, + c->load(ir::ExtendMode::Signed, c->memory(table, ir::Type::i4(), targetFieldOffset(context, field)), @@ -4554,7 +4554,7 @@ loop: case DoubleField: frame->pushLarge(ir::Type::f8(), - c->load(ir::SignExtend, + c->load(ir::ExtendMode::Signed, c->memory(table, ir::Type::f8(), targetFieldOffset(context, field)), @@ -4563,7 +4563,7 @@ loop: case LongField: frame->pushLarge(ir::Type::i8(), - c->load(ir::SignExtend, + c->load(ir::ExtendMode::Signed, c->memory(table, ir::Type::i8(), targetFieldOffset(context, field)), @@ -4572,7 +4572,7 @@ loop: case ObjectField: frame->push(ir::Type::object(), - c->load(ir::SignExtend, + c->load(ir::ExtendMode::Signed, c->memory(table, ir::Type::object(), targetFieldOffset(context, field)), @@ -4662,7 +4662,7 @@ loop: case i2b: { frame->push(ir::Type::i4(), - c->truncateThenExtend(ir::SignExtend, + c->truncateThenExtend(ir::ExtendMode::Signed, ir::Type::i4(), ir::Type::i1(), frame->pop(ir::Type::i4()))); @@ -4670,7 +4670,7 @@ loop: case i2c: { frame->push(ir::Type::i4(), - c->truncateThenExtend(ir::ZeroExtend, + c->truncateThenExtend(ir::ExtendMode::Unsigned, ir::Type::i4(), ir::Type::i2(), frame->pop(ir::Type::i4()))); @@ -4688,7 +4688,7 @@ loop: case i2l: frame->pushLarge(ir::Type::i8(), - c->truncateThenExtend(ir::SignExtend, + c->truncateThenExtend(ir::ExtendMode::Signed, ir::Type::i8(), ir::Type::i4(), frame->pop(ir::Type::i4()))); @@ -4696,7 +4696,7 @@ loop: case i2s: { frame->push(ir::Type::i4(), - c->truncateThenExtend(ir::SignExtend, + c->truncateThenExtend(ir::ExtendMode::Signed, ir::Type::i4(), ir::Type::i2(), frame->pop(ir::Type::i4()))); @@ -6113,7 +6113,7 @@ next: 0, normalizedKey); - c->jmp(c->load(ir::SignExtend, + c->jmp(c->load(ir::ExtendMode::Signed, context->bootContext ? c->binaryOp(lir::Add, ir::Type::iptr(),