memcpy: use aligned sse load/stores when alignment permits

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
memcpy: omit frame pointer in wrappers

It's quite expensive with small sizes.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Add helper template for generating a compile-time index list (0, 1, 2...)

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
initialize: add variant for compile-time initialization via template instantation

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
string: use initialized_array<> instead of enumerating a list inline

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
string: copy 256-1023 bytes using sse as well

Faster than rep/movsb.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http Server: Add float support to the json formatter

This adds float support to the json formatter.

Unfortunately, the json format doesn't support infinity. So inifity
numbers would be represented as FLT_MAX.
Similiarly minus inifinity will be represented as -FLT_MAX
and NaN will return 0.

This replaces the default std behavior of returning "inf" and "nan"

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http Server: Allow extending the json interface with a common base class

To allow extending the json interface for user defined types a common
jsonable class was added.

This class has a single method to_json.
To add a user define class, inherit the jsonable class and implement the
to_json method.

The formatter was changed to use that.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http server: Code generation extended enum support

When a return member will be declare as an enum string, a local enum
will be decalre for it with the proper values.

A wrapper class for that enum will be used as the return type, so the
enum values will be replaced by their string representation.

The wrapper class also support auto enum conversion based on enum values
as long as the origin enum will have all the declared values.

For example:

In a swagger json definition file the following entry was added to model Thread:
             "status": {
                  "type": "string",
                  "description": "thread status",
                  "enum": [
                  "invalid",
                  "prestarted"]
              }

In the code we have another enum class defined as:

enum class my_status {invalide, prestarted}

The created Thread class will have a member called status and a enum
class Thread_status.

if we'll declare value of my_status:
my_status status = my_status::invalid;

We can use it to set the value of:
T t;
t.status = status;

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Swagger definition file: Add Thread status and priority

This adds definition for threads status and priority

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
sched: expose thread status

This expose the thread status by moving the status enum to be public and
add a getter method for it.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>