sketch new version of x86.cpp to conform to new assembler.h APIs

This commit is contained in:
Joel Dice 2008-08-19 17:38:37 -06:00
parent 9654e3445d
commit 9908bbcf50
6 changed files with 224 additions and 1847 deletions

View File

@ -23,7 +23,6 @@ enum Operation {
const unsigned OperationCount = Return + 1; const unsigned OperationCount = Return + 1;
enum UnaryOperation { enum UnaryOperation {
PushFrame,
Call, Call,
LongCall, LongCall,
AlignedCall, AlignedCall,
@ -34,20 +33,20 @@ enum UnaryOperation {
JumpIfLessOrEqual, JumpIfLessOrEqual,
JumpIfGreaterOrEqual, JumpIfGreaterOrEqual,
JumpIfEqual, JumpIfEqual,
JumpIfNotEqual, JumpIfNotEqual
Negate
}; };
const unsigned UnaryOperationCount = Negate + 1; const unsigned UnaryOperationCount = JumpIfNotEqual + 1;
enum BinaryOperation { enum BinaryOperation {
Move, Move,
MoveZ, MoveZ,
Swap, Swap,
Compare Compare,
Negate
}; };
const unsigned BinaryOperationCount = Compare + 1; const unsigned BinaryOperationCount = Negate + 1;
enum TernaryOperation { enum TernaryOperation {
LongCompare, LongCompare,
@ -172,7 +171,6 @@ class Assembler {
virtual unsigned registerCount() = 0; virtual unsigned registerCount() = 0;
virtual int stack() = 0; virtual int stack() = 0;
virtual int base() = 0;
virtual int thread() = 0; virtual int thread() = 0;
virtual int returnLow() = 0; virtual int returnLow() = 0;
virtual int returnHigh() = 0; virtual int returnHigh() = 0;
@ -241,12 +239,13 @@ class Assembler {
virtual void dispose() = 0; virtual void dispose() = 0;
}; };
Assembler*
makeAssembler(System* system, Allocator* allocator, Zone* zone);
Assembler::Architecture* Assembler::Architecture*
makeArchitecture(System* system); makeArchitecture(System* system);
Assembler*
makeAssembler(System* system, Allocator* allocator, Zone* zone,
Assembler::Architecture* architecture);
} // namespace vm } // namespace vm
#endif//ASSEMBLER_H #endif//ASSEMBLER_H

View File

@ -517,7 +517,7 @@ class Context {
Context(MyThread* t, object method): Context(MyThread* t, object method):
thread(t), thread(t),
zone(t->m->system, t->m->heap, 16 * 1024), zone(t->m->system, t->m->heap, 16 * 1024),
assembler(makeAssembler(t->m->system, t->m->heap, &zone)), assembler(makeAssembler(t->m->system, t->m->heap, &zone, t->arch)),
client(t), client(t),
compiler(makeCompiler(t->m->system, assembler, &zone, &client)), compiler(makeCompiler(t->m->system, assembler, &zone, &client)),
method(method), method(method),
@ -533,7 +533,7 @@ class Context {
Context(MyThread* t): Context(MyThread* t):
thread(t), thread(t),
zone(t->m->system, t->m->heap, LikelyPageSizeInBytes), zone(t->m->system, t->m->heap, LikelyPageSizeInBytes),
assembler(makeAssembler(t->m->system, t->m->heap, &zone)), assembler(makeAssembler(t->m->system, t->m->heap, &zone, t->arch)),
client(t), client(t),
compiler(0), compiler(0),
method(0), method(0),

View File

@ -16,14 +16,6 @@ using namespace vm;
namespace { namespace {
void*
allocate(System* s, unsigned size)
{
void* p = s->tryAllocate(size);
if (p == 0) abort();
return p;
}
const char* const char*
append(System* s, const char* a, const char* b, append(System* s, const char* a, const char* b,
const char* c) const char* c)

View File

@ -77,14 +77,6 @@ run(void* r)
return 0; return 0;
} }
void*
allocate(System* s, unsigned size)
{
void* p = s->tryAllocate(size);
if (p == 0) abort();
return p;
}
void void
pathOfExecutable(System* s, const char** retBuf, unsigned* size) pathOfExecutable(System* s, const char** retBuf, unsigned* size)
{ {

View File

@ -148,6 +148,14 @@ class System {
virtual void dispose() = 0; virtual void dispose() = 0;
}; };
inline void*
allocate(System* s, unsigned size)
{
void* p = s->tryAllocate(size);
if (p == 0) s->abort();
return p;
}
#define ACQUIRE_MONITOR(t, m) \ #define ACQUIRE_MONITOR(t, m) \
System::MonitorResource MAKE_NAME(monitorResource_) (t, m) System::MonitorResource MAKE_NAME(monitorResource_) (t, m)

File diff suppressed because it is too large Load Diff