本文整理汇总了C++中VM类的典型用法代码示例。如果您正苦于以下问题:C++ VM类的具体用法?C++ VM怎么用?C++ VM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VM类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: lg
Object* Thread::raise(STATE, GCToken gct, Exception* exc) {
utilities::thread::SpinLock::LockGuard lg(init_lock_);
Thread* self = this;
OnStack<2> os(state, self, exc);
VM* vm = self->vm_;
if(!vm) {
return cNil;
}
vm->register_raise(state, exc);
vm->wakeup(state, gct);
return exc;
}
开发者ID:,项目名称:,代码行数:15,代码来源:
示例2: main
int main(int argc, const char* argv[])
{
if (argc > 2)
{
// TODO(bob): Show usage, etc.
std::cout << "magpie [script]" << std::endl;
return 1;
}
VM vm;
if (argc == 1) return repl(vm);
bool success = vm.runProgram(String::create(argv[1]));
return success ? 0 : 1;
}
开发者ID:relrod,项目名称:magpie,代码行数:16,代码来源:main.cpp
示例3: result
Vector<BasicBlockRange> ControlFlowProfiler::getBasicBlocksForSourceID(intptr_t sourceID, VM& vm) const
{
Vector<BasicBlockRange> result(0);
auto bucketFindResult = m_sourceIDBuckets.find(sourceID);
if (bucketFindResult == m_sourceIDBuckets.end())
return result;
const BlockLocationCache& cache = bucketFindResult->value;
for (const BasicBlockLocation* block : cache.values()) {
bool hasExecuted = block->hasExecuted();
const Vector<BasicBlockLocation::Gap>& blockRanges = block->getExecutedRanges();
for (BasicBlockLocation::Gap gap : blockRanges) {
BasicBlockRange range;
range.m_hasExecuted = hasExecuted;
range.m_startOffset = gap.first;
range.m_endOffset = gap.second;
result.append(range);
}
}
const Vector<std::tuple<bool, unsigned, unsigned>>& unexecutedFunctionRanges = vm.functionHasExecutedCache()->getFunctionRanges(sourceID);
for (const auto& functionRange : unexecutedFunctionRanges) {
BasicBlockRange range;
range.m_hasExecuted = std::get<0>(functionRange);
range.m_startOffset = static_cast<int>(std::get<1>(functionRange));
range.m_endOffset = static_cast<int>(std::get<2>(functionRange));
result.append(range);
}
return result;
}
开发者ID:B-Stefan,项目名称:webkit,代码行数:31,代码来源:ControlFlowProfiler.cpp
示例4: if
void VirshGui::toggleVMStatus()
{
string vmname = ui->vmnameLabel->text().toStdString();
VM vm = vmlist[vmname];
try {
if (vm.getStatus() == VMStatus::shutoff) {
vm.start();
} else if (vm.getStatus() == VMStatus::running) {
vm.destroy();
}
} catch (ssh::SshException e) {
handleDisconnect();
}
refreshVmList();
}
开发者ID:SteveCharleston,项目名称:virsh-gui,代码行数:16,代码来源:virshgui.cpp
示例5: setTimeLimit
void Watchdog::setTimeLimit(VM& vm, std::chrono::microseconds limit,
ShouldTerminateCallback callback, void* data1, void* data2)
{
bool wasEnabled = isEnabled();
if (!m_isStopped)
stopCountdown();
m_didFire = false; // Reset the watchdog.
m_limit = limit;
m_callback = callback;
m_callbackData1 = data1;
m_callbackData2 = data2;
// If this is the first time that timeout is being enabled, then any
// previously JIT compiled code will not have the needed polling checks.
// Hence, we need to flush all the pre-existing compiled code.
//
// However, if the timeout is already enabled, and we're just changing the
// timeout value, then any existing JITted code will have the appropriate
// polling checks. Hence, there is no need to re-do this flushing.
if (!wasEnabled) {
// And if we've previously compiled any functions, we need to revert
// them because they don't have the needed polling checks yet.
vm.releaseExecutableMemory();
}
startCountdownIfNeeded();
}
开发者ID:B-Stefan,项目名称:webkit,代码行数:30,代码来源:Watchdog.cpp
示例6: AddConsole
void AddConsole(VM &vm)
{
vm.setConsole(&con);
vm.sios.addSIO(&con);
vm.sios.addSIO(&sio1);
vm.sios.addSIO(&sio2);
vm.sios.addSIO(&sio3);
vm.sios.addSIO(&sio4);
vm.sios.addSIO(&sio5);
vm.sios.addSIO(&sio6);
vm.sios.addSIO(&sio7);
vm.sios.addSIO(&sio8);
vm.sios.addSIO(&mouse);
server.addClient(&sio1);
server.addClient(&sio2);
server.addClient(&sio3);
server.addClient(&sio4);
server.addClient(&sio5);
server.addClient(&sio6);
server.addClient(&sio7);
server.addClient(&sio8);
server.start();
}
开发者ID:norayr,项目名称:kronos,代码行数:26,代码来源:Kronos3vm.cpp
示例7: os
Thread* Thread::wakeup(STATE, GCToken gct) {
init_lock_.lock();
Thread* self = this;
OnStack<1> os(state, self);
VM* vm = self->vm_;
if(alive() == cFalse || !vm) {
self->init_lock_.unlock();
return force_as<Thread>(Primitives::failure());
}
vm->wakeup(state, gct);
self->init_lock_.unlock();
return self;
}
开发者ID:magnusmorton,项目名称:rubinius,代码行数:16,代码来源:thread.cpp
示例8: switch
gc<ClassObject> AtomObject::getClass(VM& vm) const
{
switch (atom_)
{
case ATOM_FALSE:
case ATOM_TRUE:
return vm.getClass(CLASS_BOOL);
case ATOM_NOTHING: return vm.getClass(CLASS_NOTHING);
case ATOM_DONE: return vm.getClass(CLASS_DONE);
case ATOM_NO_METHOD:
ASSERT(false, "NO_METHOD shouldn't be in AtomObject.");
}
ASSERT(false, "Unexpected atom value.");
return NULL;
}
开发者ID:DawidvC,项目名称:magpie,代码行数:16,代码来源:Object.cpp
示例9: throw
string CViewRenderer::renderFile(const IRenderingContext * context, const string & sourceFile, CDT & data, bool ret) throw (CException)
{
boost::filesystem::path sourcePath(sourceFile);
if (!boost::filesystem::exists(sourcePath)) {
throw CException("View file \"" + sourceFile + "\" does not exist.");
}
string viewFile = getViewFile(sourceFile);
boost::filesystem::path viewPath(viewFile);
if (!boost::filesystem::exists(viewPath) || boost::filesystem::last_write_time(sourcePath) > boost::filesystem::last_write_time(viewPath)) {
if (generateViewFile(sourceFile, viewFile)) {
chmod(viewFile.c_str(), filePermission);
} else {
throw CException("Can't generate view file \"" + viewFile + "\" from source file \"" + sourceFile + "\".");
}
}
if (context != 0) {
return context->renderInternal(viewFile, data, ret);
}
stringstream os;
StreamOutputCollector outputCollector(os);
TDynamicTemplateCacheMap::const_iterator found = _templateCache.find(viewFile);
VMLoader * oLoader = 0;
if (found == _templateCache.end()) {
oLoader = new VMFileLoader(viewFile.c_str());
_templateCache[viewFile.c_str()] = boost::shared_ptr<VMLoader>(oLoader);
} else {
oLoader = found->second.get();
}
PROFILE_BEGIN("CViewRenderer::rendering template bytecode of \"" + viewFile + "\"")
UINT_32 iIP = 0;
VM * vm = Cws::app()->getTemplateEngine()->getVM();
const VMMemoryCore * pVMMemoryCore = oLoader->GetCore();
vm->Init(pVMMemoryCore, &outputCollector, 0);
vm->Run(pVMMemoryCore, &outputCollector, iIP, data, 0);
PROFILE_END()
if (ret) {
return os.str();
} else {
Cws::app()->getOutputStack().top()->echo(os.str());
return "";
}
}
开发者ID:djvibegga,项目名称:yii-cws,代码行数:47,代码来源:CViewRenderer.cpp
示例10: main
int main(int argc, const char **argv)
{
// Usage information.
if (argc < 2)
{
cout<<"Usage: " <<argv[0] <<" <file>\n";
return 0;
}
char *buffer;
istream *f;
// If it's -, read from stdin.
if (strcmp(argv[1], "-") == 0)
{
std::stringstream *stream = new std::stringstream();
*stream << cin.rdbuf();
f = stream;
}
// Otherwise, just open the file.
else
{
f = new ifstream(argv[1]);
}
if (f->fail())
{
cout<<"Input error" <<endl;
delete f;
return 1;
}
// Determine the size.
f->seekg(0, ios::end);
int l = f->tellg();
f->seekg(0, ios::beg);
// Allocate a buffer.
buffer = new char[l];
// Read the data.
f->read(buffer, l);
delete f;
// Create a VM.
VM vm;
// Create a parser and let it parse
// the file for us.
Parser p(&vm);
p.parseBlob(buffer, l);
// And start the main loop!
vm.run();
return 0;
}
开发者ID:bartbes,项目名称:Fetus,代码行数:47,代码来源:fetus.cpp
示例11: STARTDECL
STARTDECL(read_file) (VM &vm, Value &file) {
string buf;
auto l = LoadFile(file.sval()->strv(), &buf);
file.DECRT(vm);
if (l < 0) return Value();
auto s = vm.NewString(buf);
return Value(s);
}
开发者ID:aardappel,项目名称:treesheets,代码行数:8,代码来源:file.cpp
示例12: addImports
void Module::addImports(VM& vm, ErrorReporter& reporter)
{
// Implicitly import core (unless we are core).
if (*name_ != "core")
{
vm.importModule(reporter, this, NULL, String::create("core"));
}
// Load all of the imports.
for (int i = 0; i < ast_->body()->expressions().count(); i++)
{
ImportExpr* import = ast_->body()->expressions()[i]->asImportExpr();
if (import == NULL) continue;
vm.importModule(reporter, this, import->pos(), import->name());
}
}
开发者ID:DawidvC,项目名称:magpie,代码行数:17,代码来源:Module.cpp
示例13: link
void JSCallBase::link(VM& vm, LinkBuffer& linkBuffer)
{
linkBuffer.link(
m_slowCall, FunctionPtr(vm.getCTIStub(linkCallThunkGenerator).code().executableAddress()));
m_callLinkInfo->setCallLocations(linkBuffer.locationOfNearCall(m_slowCall),
linkBuffer.locationOf(m_targetToCheck), linkBuffer.locationOfNearCall(m_fastCall));
}
开发者ID:josedealcala,项目名称:webkit,代码行数:8,代码来源:FTLJSCallBase.cpp
示例14: main
int main (int argc, char *argv[])
{
try {
get_opt& _ = get_opt::instance();
_.parse_cmdline(argc, argv);
VM vm;
vm.load_image (_.inp_name);
vm.interprete ();
}
catch (exception& e) {
cerr << e.what() << endl;
return EXIT_FAILURE;
}
}
开发者ID:alsam,项目名称:cpp-samples,代码行数:17,代码来源:main_driver.cpp
示例15: vncDisplay
void VirshGui::vncDisplay()
{
string vmname = ui->vmnameLabel->text().toStdString();
VM vm = vmlist[vmname];
int vncport = 0;
try {
vncport = stoi(vm.getVNCPort());
} catch (ssh::SshException e) {
handleDisconnect();
}
vncclientwidget2cls *vnc = new vncclientwidget2cls();
vnc->connectVNCTCP(QString::fromStdString(ssh->getHost()), vncport);
vnc->setWindowTitle(QString::fromStdString(vm.getName()));
vnc->showNormal();
}
开发者ID:SteveCharleston,项目名称:virsh-gui,代码行数:17,代码来源:virshgui.cpp
示例16: checkSyntax
bool checkSyntax(VM& vm, const SourceCode& source, ParserError& error)
{
JSLockHolder lock(vm);
RELEASE_ASSERT(vm.atomicStringTable() == wtfThreadData().atomicStringTable());
return !!parse<ProgramNode>(
&vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, error);
}
开发者ID:annulen,项目名称:webkit,代码行数:8,代码来源:Completion.cpp
示例17: run
void* InternalThread::run(void* ptr) {
InternalThread* thread = reinterpret_cast<InternalThread*>(ptr);
VM* vm = thread->vm();
SharedState& shared = vm->shared;
State state_obj(vm), *state = &state_obj;
vm->set_current_thread();
vm->set_run_state(ManagedThread::eIndependent);
RUBINIUS_THREAD_START(
const_cast<RBX_DTRACE_CHAR_P>(vm->name().c_str()), vm->thread_id(), 1);
NativeMethod::init_thread(state);
thread->thread_running_ = true;
thread->run(state);
thread->thread_running_ = false;
NativeMethod::cleanup_thread(state);
RUBINIUS_THREAD_STOP(
const_cast<RBX_DTRACE_CHAR_P>(vm->name().c_str()), vm->thread_id(), 1);
shared.gc_independent();
return 0;
}
开发者ID:vladimir-shcherbakov,项目名称:rubinius,代码行数:30,代码来源:internal_threads.cpp
示例18: descriptor
void JSFloat64Array::finishCreation(VM& vm)
{
Base::finishCreation(vm);
TypedArrayDescriptor descriptor(&JSFloat64Array::s_info, OBJECT_OFFSETOF(JSFloat64Array, m_storage), OBJECT_OFFSETOF(JSFloat64Array, m_storageLength));
vm.registerTypedArrayDescriptor(impl(), descriptor);
m_storage = impl()->data();
m_storageLength = impl()->length();
ASSERT(inherits(&s_info));
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:9,代码来源:JSFloat64Array.cpp
示例19: GcResource
as_object::as_object(VM& vm)
:
GcResource(vm.getRoot().gc()),
_displayObject(nullptr),
_array(false),
_vm(vm),
_members(*this)
{
}
开发者ID:aopui,项目名称:gnash,代码行数:9,代码来源:as_object.cpp
示例20: test_find_and_activate
void test_find_and_activate() {
Thread* cur = Thread::current(state);
Thread* thread = Thread::create(state);
thread->wakeup(state);
state->queue_thread(thread);
bool ret = state->find_and_activate_thread();
TS_ASSERT_EQUALS(true, ret);
TS_ASSERT_EQUALS(Qfalse, thread->queued());
TS_ASSERT_EQUALS(thread, Thread::current(state));
TS_ASSERT_EQUALS(Qtrue, cur->queued());
}
开发者ID:marnen,项目名称:rubinius,代码行数:15,代码来源:test_vm.hpp
注:本文中的VM类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论