Error X86X64FuncDecl::setPrototype(uint32_t conv, const FuncPrototype& p) { if (conv == kFuncConvNone || conv >= _kFuncConvCount) return kErrorInvalidArgument; if (p.getArgCount() > kFuncArgCount) return kErrorInvalidArgument; // Validate that the required convention is supported by the current asmjit // configuration, if only one target is compiled. uint32_t arch = x86GetArchFromCConv(conv); #if defined(ASMJIT_BUILD_X86) && !defined(ASMJIT_BUILD_X64) if (arch == kArchX64) return kErrorInvalidState; #endif // ASMJIT_BUILD_X86 && !ASMJIT_BUILD_X64 #if !defined(ASMJIT_BUILD_X86) && defined(ASMJIT_BUILD_X64) if (arch == kArchX86) return kErrorInvalidState; #endif // !ASMJIT_BUILD_X86 && ASMJIT_BUILD_X64 ASMJIT_PROPAGATE_ERROR(X86X64FuncDecl_initConv(this, arch, conv)); ASMJIT_PROPAGATE_ERROR(X86X64FuncDecl_initFunc(this, arch, p.getRet(), p.getArgList(), p.getArgCount())); return kErrorOk; }
Error Context::compile(FuncNode* func) { Node* end = func->getEnd(); Node* stop = end->getNext(); _func = func; _stop = stop; _extraBlock = end; ASMJIT_PROPAGATE_ERROR(fetch()); ASMJIT_PROPAGATE_ERROR(removeUnreachableCode()); ASMJIT_PROPAGATE_ERROR(livenessAnalysis()); Compiler* compiler = getCompiler(); #if !defined(ASMJIT_DISABLE_LOGGER) if (compiler->hasLogger()) ASMJIT_PROPAGATE_ERROR(annotate()); #endif // !ASMJIT_DISABLE_LOGGER ASMJIT_PROPAGATE_ERROR(translate()); if (compiler->hasFeature(kCodeGenEnableScheduler)) ASMJIT_PROPAGATE_ERROR(schedule()); // We alter the compiler cursor, because it doesn't make sense to reference // it after compilation - some nodes may disappear and it's forbidden to add // new code after the compilation is done. compiler->_setCursor(NULL); return kErrorOk; }
Error BaseContext::compile(FuncNode* func) { BaseNode* end = func->getEnd(); BaseNode* stop = end->getNext(); _func = func; _stop = stop; _extraBlock = end; ASMJIT_PROPAGATE_ERROR(fetch()); ASMJIT_PROPAGATE_ERROR(removeUnreachableCode()); ASMJIT_PROPAGATE_ERROR(analyze()); if (_compiler->hasLogger()) ASMJIT_PROPAGATE_ERROR(annotate()); ASMJIT_PROPAGATE_ERROR(translate()); // We alter the compiler cursor, because it doesn't make sense to reference // it after compilation - some nodes may disappear and it's forbidden to add // new code after the compilation is done. _compiler->_setCursor(NULL); return kErrorOk; }