PageRenderTime 23ms CodeModel.GetById 9ms app.highlight 9ms RepoModel.GetById 2ms app.codeStats 0ms

/vm/run.cpp

http://github.com/abeaumont/factor
C++ | 37 lines | 31 code | 6 blank | 0 comment | 1 complexity | 881467d084549b76ff716b9db746e65c MD5 | raw file
 1#include "master.hpp"
 2
 3namespace factor
 4{
 5
 6void factor_vm::primitive_exit()
 7{
 8	exit((int)to_fixnum(ctx->pop()));
 9}
10
11void exit(int status)
12{
13	factor_vm::close_console();
14	::exit(status);
15}
16
17void factor_vm::primitive_nano_count()
18{
19	u64 nanos = nano_count();
20	if(nanos < last_nano_count)
21	{
22		std::cout << "Monotonic counter decreased from 0x";
23		std::cout << std::hex << last_nano_count;
24		std::cout << " to 0x" << nanos << "." << std::dec << "\n";
25		std::cout << "Please report this error.\n";
26		current_vm()->factorbug();
27	}
28	last_nano_count = nanos;
29	ctx->push(from_unsigned_8(nanos));
30}
31
32void factor_vm::primitive_sleep()
33{
34	sleep_nanos(to_unsigned_8(ctx->pop()));
35}
36
37}