Testing unsafe operations

Clément Béra

For the runtime optimizer (Sista) I am working on, Eliot Miranda and I added new operations (we call them unsafe operations) in Cog’s interpreter and JIT compiler. Before testing them directly by running the optimizer and looking for crashes, I wrote tests to check that each unsafe operation works as expected. I’d like to discuss a bit the design of those tests in this post.

I’ll discuss a specific operation in the post, but all the unsafe operations are handled in a similar way. The operation I chose to described is called USmiLessOrEqual. This operation corresponds to <= but assumes the 2 operands are SmallIntegers, else the behavior of the instruction is undefined. The optimizer uses it only when it can ensure that the two operands are SmallIntegers.

What to test

To test USmiLessOrEqual, one could think I’m going to take an important range of integers and…

View original post 2,352 more words


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: