- The fixed_t type for the VM also is not needed any longer and was removed.

This commit is contained in:
Christoph Oelckers 2016-03-25 15:50:39 +01:00
parent 8cdfbeea01
commit 2b33601d00
7 changed files with 1 additions and 112 deletions

View file

@ -79,7 +79,6 @@ PName *TypeName;
PSound *TypeSound; PSound *TypeSound;
PColor *TypeColor; PColor *TypeColor;
PStatePointer *TypeState; PStatePointer *TypeState;
PFixed *TypeFixed;
// PRIVATE DATA DEFINITIONS ------------------------------------------------ // PRIVATE DATA DEFINITIONS ------------------------------------------------
@ -505,8 +504,7 @@ void PType::StaticInit()
RUNTIME_CLASS(PPrototype)->TypeTableType = RUNTIME_CLASS(PPrototype); RUNTIME_CLASS(PPrototype)->TypeTableType = RUNTIME_CLASS(PPrototype);
RUNTIME_CLASS(PClass)->TypeTableType = RUNTIME_CLASS(PClass); RUNTIME_CLASS(PClass)->TypeTableType = RUNTIME_CLASS(PClass);
RUNTIME_CLASS(PStatePointer)->TypeTableType = RUNTIME_CLASS(PStatePointer); RUNTIME_CLASS(PStatePointer)->TypeTableType = RUNTIME_CLASS(PStatePointer);
RUNTIME_CLASS(PFixed)->TypeTableType = RUNTIME_CLASS(PFixed);
// Create types and add them type the type table. // Create types and add them type the type table.
TypeTable.AddType(TypeError = new PErrorType); TypeTable.AddType(TypeError = new PErrorType);
TypeTable.AddType(TypeVoid = new PVoidType); TypeTable.AddType(TypeVoid = new PVoidType);
@ -524,7 +522,6 @@ void PType::StaticInit()
TypeTable.AddType(TypeSound = new PSound); TypeTable.AddType(TypeSound = new PSound);
TypeTable.AddType(TypeColor = new PColor); TypeTable.AddType(TypeColor = new PColor);
TypeTable.AddType(TypeState = new PStatePointer); TypeTable.AddType(TypeState = new PStatePointer);
TypeTable.AddType(TypeFixed = new PFixed);
GlobalSymbols.AddSymbol(new PSymbolType(NAME_sByte, TypeSInt8)); GlobalSymbols.AddSymbol(new PSymbolType(NAME_sByte, TypeSInt8));
GlobalSymbols.AddSymbol(new PSymbolType(NAME_Byte, TypeUInt8)); GlobalSymbols.AddSymbol(new PSymbolType(NAME_Byte, TypeUInt8));
@ -542,7 +539,6 @@ void PType::StaticInit()
GlobalSymbols.AddSymbol(new PSymbolType(NAME_Sound, TypeSound)); GlobalSymbols.AddSymbol(new PSymbolType(NAME_Sound, TypeSound));
GlobalSymbols.AddSymbol(new PSymbolType(NAME_Color, TypeColor)); GlobalSymbols.AddSymbol(new PSymbolType(NAME_Color, TypeColor));
GlobalSymbols.AddSymbol(new PSymbolType(NAME_State, TypeState)); GlobalSymbols.AddSymbol(new PSymbolType(NAME_State, TypeState));
GlobalSymbols.AddSymbol(new PSymbolType(NAME_Fixed, TypeFixed));
} }
@ -1081,67 +1077,6 @@ PColor::PColor()
assert(sizeof(PalEntry) == __alignof(PalEntry)); assert(sizeof(PalEntry) == __alignof(PalEntry));
} }
/* PFixed *****************************************************************/
IMPLEMENT_CLASS(PFixed)
//==========================================================================
//
// PFixed Default Constructor
//
//==========================================================================
PFixed::PFixed()
: PFloat(sizeof(fixed_t))
{
}
//==========================================================================
//
// PFixed :: SetValue
//
//==========================================================================
void PFixed::SetValue(void *addr, int val)
{
assert(((intptr_t)addr & (Align - 1)) == 0 && "unaligned address");
*(fixed_t *)addr = val << FRACBITS;
}
//==========================================================================
//
// PFixed :: GetValueInt
//
//==========================================================================
int PFixed::GetValueInt(void *addr) const
{
assert(((intptr_t)addr & (Align - 1)) == 0 && "unaligned address");
return *(fixed_t *)addr >> FRACBITS;
}
//==========================================================================
//
// PFixed :: GetStoreOp
//
//==========================================================================
int PFixed::GetStoreOp() const
{
return OP_SX;
}
//==========================================================================
//
// PFixed :: GetLoadOp
//
//==========================================================================
int PFixed::GetLoadOp() const
{
return OP_LX;
}
/* PStatePointer **********************************************************/ /* PStatePointer **********************************************************/
IMPLEMENT_CLASS(PStatePointer) IMPLEMENT_CLASS(PStatePointer)

View file

@ -400,21 +400,6 @@ public:
PColor(); PColor();
}; };
// Variations of floating point types ---------------------------------------
// These get converted to floats when they're loaded from memory.
class PFixed : public PFloat
{
DECLARE_CLASS(PFixed, PFloat);
public:
PFixed();
virtual void SetValue(void *addr, int val);
virtual int GetValueInt(void *addr) const;
virtual int GetStoreOp() const;
virtual int GetLoadOp() const;
};
// Pointers ----------------------------------------------------------------- // Pointers -----------------------------------------------------------------
class PStatePointer : public PBasicType class PStatePointer : public PBasicType
@ -771,7 +756,6 @@ extern PName *TypeName;
extern PSound *TypeSound; extern PSound *TypeSound;
extern PColor *TypeColor; extern PColor *TypeColor;
extern PStatePointer *TypeState; extern PStatePointer *TypeState;
extern PFixed *TypeFixed;
// A constant value --------------------------------------------------------- // A constant value ---------------------------------------------------------

View file

@ -192,7 +192,6 @@ std2:
/* other DECORATE top level keywords */ /* other DECORATE top level keywords */
'#include' { RET(TK_Include); } '#include' { RET(TK_Include); }
'fixed_t' { RET(TK_Fixed_t); }
L (L|D)* { RET(TK_Identifier); } L (L|D)* { RET(TK_Identifier); }

View file

@ -111,7 +111,6 @@ xx(TK_Global, "'global'")
xx(TK_Self, "'self'") xx(TK_Self, "'self'")
xx(TK_Stop, "'stop'") xx(TK_Stop, "'stop'")
xx(TK_Include, "'include'") xx(TK_Include, "'include'")
xx(TK_Fixed_t, "'fixed_t'")
xx(TK_Is, "'is'") xx(TK_Is, "'is'")
xx(TK_Replaces, "'replaces'") xx(TK_Replaces, "'replaces'")

View file

@ -486,10 +486,6 @@ static void ParseNativeFunction(FScanner &sc, PClassActor *cls)
rets.Push(TypeFloat64); rets.Push(TypeFloat64);
break; break;
case TK_Fixed_t:
rets.Push(TypeFixed);
break;
case TK_State: case TK_State:
rets.Push(TypeState); rets.Push(TypeState);
break; break;

View file

@ -210,16 +210,6 @@ begin:
reg.f[a+2] = v[2]; reg.f[a+2] = v[2];
} }
NEXTOP; NEXTOP;
OP(LX):
ASSERTF(a); ASSERTA(B); ASSERTKD(C);
GETADDR(PB,KC,X_READ_NIL);
reg.f[a] = *(VM_SWORD *)ptr / 65536.0;
NEXTOP;
OP(LX_R):
ASSERTF(a); ASSERTA(B); ASSERTD(C);
GETADDR(PB,RC,X_READ_NIL);
reg.f[a] = *(VM_SWORD *)ptr / 65536.0;
NEXTOP;
OP(LBIT): OP(LBIT):
ASSERTD(a); ASSERTA(B); ASSERTD(a); ASSERTA(B);
GETADDR(PB,0,X_READ_NIL); GETADDR(PB,0,X_READ_NIL);
@ -316,16 +306,6 @@ begin:
v[2] = (float)reg.f[B+2]; v[2] = (float)reg.f[B+2];
} }
NEXTOP; NEXTOP;
OP(SX):
ASSERTA(a); ASSERTF(B); ASSERTKD(C);
GETADDR(PA,KC,X_WRITE_NIL);
*(VM_SWORD *)ptr = (VM_SWORD)(reg.f[B] * 65536.0);
NEXTOP;
OP(SX_R):
ASSERTA(a); ASSERTF(B); ASSERTD(C);
GETADDR(PA,RC,X_WRITE_NIL);
*(VM_SWORD *)ptr = (VM_SWORD)(reg.f[B] * 65536.0);
NEXTOP;
OP(SBIT): OP(SBIT):
ASSERTA(a); ASSERTD(B); ASSERTA(a); ASSERTD(B);
GETADDR(PA,0,X_WRITE_NIL); GETADDR(PA,0,X_WRITE_NIL);

View file

@ -35,8 +35,6 @@ xx(LP, lp, RPRPKI), // load pointer
xx(LP_R, lp, RPRPRI), xx(LP_R, lp, RPRPRI),
xx(LV, lv, RVRPKI), // load vector xx(LV, lv, RVRPKI), // load vector
xx(LV_R, lv, RVRPRI), xx(LV_R, lv, RVRPRI),
xx(LX, lx, RFRPKI), // load fixed point
xx(LX_R, lx, RFRPRI),
xx(LBIT, lbit, RIRPI8), // rA = !!(*rB & C) -- *rB is a byte xx(LBIT, lbit, RIRPI8), // rA = !!(*rB & C) -- *rB is a byte
@ -57,8 +55,6 @@ xx(SP, sp, RPRPKI), // store pointer
xx(SP_R, sp, RPRPRI), xx(SP_R, sp, RPRPRI),
xx(SV, sv, RPRVKI), // store vector xx(SV, sv, RPRVKI), // store vector
xx(SV_R, sv, RPRVRI), xx(SV_R, sv, RPRVRI),
xx(SX, sx, RPRFKI), // store fixed point
xx(SX_R, sx, RPRFRI),
xx(SBIT, sbit, RPRII8), // *rA |= C if rB is true, *rA &= ~C otherwise xx(SBIT, sbit, RPRII8), // *rA |= C if rB is true, *rA &= ~C otherwise