factor/vm/run.cpp

30 lines
502 B
C++
Raw Normal View History

2009-05-02 05:04:19 -04:00
#include "master.hpp"
2009-05-04 02:46:13 -04:00
namespace factor
{
void factor_vm::primitive_exit()
2009-05-02 05:04:19 -04:00
{
2010-01-24 08:17:18 -05:00
exit((int)to_fixnum(ctx->pop()));
2009-05-02 05:04:19 -04:00
}
void factor_vm::primitive_system_micros()
2009-05-02 05:04:19 -04:00
{
ctx->push(from_unsigned_8(system_micros()));
2009-05-02 05:04:19 -04:00
}
void factor_vm::primitive_nano_count()
{
u64 nanos = nano_count();
if(nanos < last_nano_count) critical_error("Monotonic counter decreased",0);
last_nano_count = nanos;
ctx->push(from_unsigned_8(nanos));
}
void factor_vm::primitive_sleep()
2009-05-02 05:04:19 -04:00
{
sleep_nanos(to_unsigned_8(ctx->pop()));
2009-05-02 05:04:19 -04:00
}
2009-05-04 02:46:13 -04:00
}