move CallEvent out of compiler.cpp

This commit is contained in:
Joshua Warner
2013-02-13 19:33:40 -07:00
parent 6d265374ec
commit 0f6e098b69
13 changed files with 732 additions and 539 deletions

View File

@ -0,0 +1,52 @@
/* Copyright (c) 2008-2012, Avian Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
There is NO WARRANTY for this software. See license.txt for
details. */
#ifndef AVIAN_CODEGEN_COMPILER_PROMISE_H
#define AVIAN_CODEGEN_COMPILER_PROMISE_H
namespace avian {
namespace codegen {
namespace compiler {
class CodePromise: public Promise {
public:
CodePromise(Context* c, CodePromise* next):
c(c), offset(0), next(next)
{ }
CodePromise(Context* c, Promise* offset):
c(c), offset(offset), next(0)
{ }
virtual int64_t value() {
if (resolved()) {
return reinterpret_cast<intptr_t>(c->machineCode + offset->value());
}
abort(c);
}
virtual bool resolved() {
return c->machineCode != 0 and offset and offset->resolved();
}
Context* c;
Promise* offset;
CodePromise* next;
};
CodePromise* codePromise(Context* c, Promise* offset);
} // namespace compiler
} // namespace codegen
} // namespace avian
#endif // AVIAN_CODEGEN_COMPILER_PROMISE_H