vm: fep out if monotonic counter decreases
parent
62e7aed2d3
commit
0a3c5f5ac6
|
@ -15,7 +15,10 @@ void factor_vm::primitive_system_micros()
|
||||||
|
|
||||||
void factor_vm::primitive_nano_count()
|
void factor_vm::primitive_nano_count()
|
||||||
{
|
{
|
||||||
box_unsigned_8(nano_count());
|
u64 nanos = nano_count();
|
||||||
|
if(nanos < last_nano_count) critical_error("Monotonic counter decreased",0);
|
||||||
|
last_nano_count = nanos;
|
||||||
|
box_unsigned_8(nanos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void factor_vm::primitive_sleep()
|
void factor_vm::primitive_sleep()
|
||||||
|
|
|
@ -10,7 +10,8 @@ factor_vm::factor_vm() :
|
||||||
current_gc(NULL),
|
current_gc(NULL),
|
||||||
gc_events(NULL),
|
gc_events(NULL),
|
||||||
fep_disabled(false),
|
fep_disabled(false),
|
||||||
full_output(false)
|
full_output(false),
|
||||||
|
last_nano_count(0)
|
||||||
{
|
{
|
||||||
primitive_reset_dispatch_stats();
|
primitive_reset_dispatch_stats();
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,10 @@ struct factor_vm
|
||||||
/* Incrementing object counter for identity hashing */
|
/* Incrementing object counter for identity hashing */
|
||||||
cell object_counter;
|
cell object_counter;
|
||||||
|
|
||||||
|
/* Sanity check to ensure that monotonic counter doesn't
|
||||||
|
decrease */
|
||||||
|
u64 last_nano_count;
|
||||||
|
|
||||||
// contexts
|
// contexts
|
||||||
void reset_datastack();
|
void reset_datastack();
|
||||||
void reset_retainstack();
|
void reset_retainstack();
|
||||||
|
|
Loading…
Reference in New Issue