|
10 | 10 | #include "ponyassert.h"
|
11 | 11 | #include <string.h>
|
12 | 12 |
|
| 13 | +#if defined(USE_RUNTIME_TRACING) |
| 14 | +#define DESC_ID 0 |
| 15 | +#define DESC_SIZE 1 |
| 16 | +#define DESC_SERIALISEID 2 |
| 17 | +#define DESC_FIELD_COUNT 3 |
| 18 | +#define DESC_FIELD_OFFSET 4 |
| 19 | +#define DESC_INSTANCE 5 |
| 20 | +#define DESC_NAME 6 |
| 21 | +#define DESC_GET_BEHAVIOR_NAME 7 |
| 22 | +#define DESC_TRACE 8 |
| 23 | +#define DESC_SERIALISE_TRACE 9 |
| 24 | +#define DESC_SERIALISE 10 |
| 25 | +#define DESC_DESERIALISE 11 |
| 26 | +#define DESC_CUSTOM_SERIALISE_SPACE 12 |
| 27 | +#define DESC_CUSTOM_DESERIALISE 13 |
| 28 | +#define DESC_DISPATCH 14 |
| 29 | +#define DESC_FINALISE 15 |
| 30 | +#define DESC_EVENT_NOTIFY 16 |
| 31 | +#define DESC_MIGHT_REFERENCE_ACTOR 17 |
| 32 | +#define DESC_TRAITS 18 |
| 33 | +#define DESC_FIELDS 19 |
| 34 | +#define DESC_VTABLE 20 |
| 35 | + |
| 36 | +#define DESC_LENGTH 21 |
| 37 | +#else |
13 | 38 | #define DESC_ID 0
|
14 | 39 | #define DESC_SIZE 1
|
15 | 40 | #define DESC_SERIALISEID 2
|
|
31 | 56 | #define DESC_VTABLE 18
|
32 | 57 |
|
33 | 58 | #define DESC_LENGTH 19
|
| 59 | +#endif |
34 | 60 |
|
35 | 61 | static LLVMValueRef make_unbox_function(compile_t* c, reach_type_t* t,
|
36 | 62 | reach_method_t* m)
|
@@ -195,6 +221,13 @@ static LLVMValueRef make_trait_bitmap(compile_t* c, reach_type_t* t)
|
195 | 221 | return global;
|
196 | 222 | }
|
197 | 223 |
|
| 224 | +#if defined(USE_RUNTIME_TRACING) |
| 225 | +static LLVMValueRef make_name(compile_t* c, reach_type_t* t) |
| 226 | +{ |
| 227 | + return codegen_string(c, t->name, strlen(t->name)); |
| 228 | +} |
| 229 | +#endif |
| 230 | + |
198 | 231 | static LLVMValueRef make_field_count(compile_t* c, reach_type_t* t)
|
199 | 232 | {
|
200 | 233 | if(t->underlying != TK_TUPLETYPE)
|
@@ -335,6 +368,10 @@ void gendesc_basetype(compile_t* c, LLVMTypeRef desc_type)
|
335 | 368 | params[DESC_FIELD_COUNT] = c->i32;
|
336 | 369 | params[DESC_FIELD_OFFSET] = c->i32;
|
337 | 370 | params[DESC_INSTANCE] = c->ptr;
|
| 371 | +#if defined(USE_RUNTIME_TRACING) |
| 372 | + params[DESC_NAME] = c->ptr; |
| 373 | + params[DESC_GET_BEHAVIOR_NAME] = c->ptr; |
| 374 | +#endif |
338 | 375 | params[DESC_TRACE] = c->ptr;
|
339 | 376 | params[DESC_SERIALISE_TRACE] = c->ptr;
|
340 | 377 | params[DESC_SERIALISE] = c->ptr;
|
@@ -383,6 +420,10 @@ void gendesc_type(compile_t* c, reach_type_t* t)
|
383 | 420 | params[DESC_FIELD_COUNT] = c->i32;
|
384 | 421 | params[DESC_FIELD_OFFSET] = c->i32;
|
385 | 422 | params[DESC_INSTANCE] = c->ptr;
|
| 423 | +#if defined(USE_RUNTIME_TRACING) |
| 424 | + params[DESC_NAME] = c->ptr; |
| 425 | + params[DESC_GET_BEHAVIOR_NAME] = c->ptr; |
| 426 | +#endif |
386 | 427 | params[DESC_TRACE] = c->ptr;
|
387 | 428 | params[DESC_SERIALISE_TRACE] = c->ptr;
|
388 | 429 | params[DESC_SERIALISE] = c->ptr;
|
@@ -421,6 +462,10 @@ void gendesc_init(compile_t* c, reach_type_t* t)
|
421 | 462 | args[DESC_FIELD_COUNT] = make_field_count(c, t);
|
422 | 463 | args[DESC_FIELD_OFFSET] = make_field_offset(c, t);
|
423 | 464 | args[DESC_INSTANCE] = make_desc_ptr(c, c_t->instance);
|
| 465 | +#if defined(USE_RUNTIME_TRACING) |
| 466 | + args[DESC_NAME] = make_name(c, t); |
| 467 | + args[DESC_GET_BEHAVIOR_NAME] = make_desc_ptr(c, c_t->get_behavior_name_fn); |
| 468 | +#endif |
424 | 469 | args[DESC_TRACE] = make_desc_ptr(c, c_t->trace_fn);
|
425 | 470 | args[DESC_SERIALISE_TRACE] = make_desc_ptr(c, c_t->serialise_trace_fn);
|
426 | 471 | args[DESC_SERIALISE] = make_desc_ptr(c, c_t->serialise_fn);
|
|
0 commit comments