0
#include "shotgun/lib/fixnum.h"
0
#include "shotgun/lib/primitive_util.h"
0
+#if CONFIG_ENABLE_DTRACE
0
+#define ENABLE_DTRACE 1
0
+#define ENABLE_DTRACE 0
0
#define RISA(obj,cls) (REFERENCE_P(obj) && ISA(obj,BASIC_CLASS(cls)))
0
#define next_int _int = *ip_ptr++;
0
@@ -553,9 +560,39 @@ static inline int cpu_try_primitive(STATE, cpu c, OBJECT mo, OBJECT recv, int ar
0
req = FIXNUM_TO_INT(cmethod_get_required(mo));
0
if(args == req || req < 0) {
0
+ if (RUBINIUS_FUNCTION_ENTRY_ENABLED()) {
0
+ const char * module_name = mod == Qnil ? "<unknown>" : rbs_symbol_to_cstring(state, module_get_name(mod));
0
+ const char * method_name = rbs_symbol_to_cstring(state, sym);
0
+ struct fast_context *fc = FASTCTX(c->active_context);
0
+ int line_number = cpu_ip2line(state, fc->method, fc->ip);
0
+ const char * filename = rbs_symbol_to_cstring(state, cmethod_get_file(fc->method));
0
+ RUBINIUS_FUNCTION_ENTRY(module_name, method_name, filename, line_number);
0
if(cpu_perform_primitive(state, c, prim, mo, args, sym, mod, block)) {
0
+ if (RUBINIUS_FUNCTION_RETURN_ENABLED()) {
0
+ const char * module_name = mod == Qnil ? "<unknown>" : rbs_symbol_to_cstring(state, module_get_name(mod));
0
+ const char * method_name = rbs_symbol_to_cstring(state, sym);
0
+ struct fast_context *fc = FASTCTX(c->active_context);
0
+ int line_number = cpu_ip2line(state, fc->method, fc->ip);
0
+ const char * filename = rbs_symbol_to_cstring(state, cmethod_get_file(fc->method));
0
+ RUBINIUS_FUNCTION_RETURN(module_name, method_name, filename, line_number);
0
/* Didn't work, need to remove the recv we put on before. */
0
@@ -647,6 +684,23 @@ void nmc_activate(STATE, cpu c, OBJECT nmc, OBJECT val, int reraise);
0
inline int cpu_simple_return(STATE, cpu c, OBJECT val) {
0
OBJECT destination, home;
0
+ if (RUBINIUS_FUNCTION_RETURN_ENABLED()) {
0
+ OBJECT module = cpu_current_module(state, c);
0
+ const char * module_name = (module == Qnil) ? "<unknown>" : rbs_symbol_to_cstring(state, module_get_name(module));
0
+ const char * method_name = rbs_symbol_to_cstring(state, cmethod_get_name(cpu_current_method(state, c)));
0
+ struct fast_context *fc = FASTCTX(c->active_context);
0
+ int line_number = cpu_ip2line(state, fc->method, fc->ip);
0
+ const char * filename = rbs_symbol_to_cstring(state, cmethod_get_file(fc->method));
0
+ RUBINIUS_FUNCTION_RETURN(module_name, method_name, filename, line_number);
0
destination = cpu_current_sender(c);
0
// printf("Rtrnng frm %p (%d)\n", c->active_context, FASTCTX(c->active_context)->size);
0
@@ -710,6 +764,24 @@ inline int cpu_return_to_sender(STATE, cpu c, OBJECT val, int consider_block, in
0
is_block = blokctx_s_block_context_p(state, c->active_context);
0
destination = cpu_current_sender(c);
0
+ if (RUBINIUS_FUNCTION_RETURN_ENABLED() && !is_block) {
0
+ OBJECT module = cpu_current_module(state, c);
0
+ const char * module_name = (module == Qnil) ? "<unknown>" : rbs_symbol_to_cstring(state, module_get_name(module));
0
+ const char * method_name = rbs_symbol_to_cstring(state, cmethod_get_name(cpu_current_method(state, c)));
0
+ struct fast_context *fc = FASTCTX(c->active_context);
0
+ int line_number = cpu_ip2line(state, fc->method, fc->ip);
0
+ const char * filename = rbs_symbol_to_cstring(state, cmethod_get_file(fc->method));
0
+ RUBINIUS_FUNCTION_RETURN(module_name, method_name, filename, line_number);
0
if(destination == Qnil) {
0
object_memory_retire_context(state->om, c->active_context);
0
@@ -856,8 +928,9 @@ static inline void cpu_return_to_block_creator(STATE, cpu c) {
0
inline void cpu_goto_method(STATE, cpu c, OBJECT recv, OBJECT meth,
0
int count, OBJECT name, OBJECT block) {
0
if(cpu_try_primitive(state, c, meth, recv, count, name, Qnil, block)) { return; }
0
ctx = cpu_create_context(state, c, recv, meth, name,
0
_real_class(state, recv), (unsigned long int)count, block);
0
cpu_activate_context(state, c, ctx, ctx, 0);
0
@@ -933,6 +1006,22 @@ static inline void _cpu_build_and_activate(STATE, cpu c, OBJECT mo,
0
missing ? "METHOD MISSING" : ""
0
+ if (RUBINIUS_FUNCTION_ENTRY_ENABLED()) {
0
+ const char * module_name = rbs_symbol_to_cstring(state, module_get_name(mod));
0
+ const char * method_name = rbs_symbol_to_cstring(state, sym);
0
+ struct fast_context *fc = FASTCTX(c->active_context);
0
+ int line_number = cpu_ip2line(state, fc->method, fc->ip);
0
+ const char * filename = rbs_symbol_to_cstring(state, cmethod_get_file(fc->method));
0
+ RUBINIUS_FUNCTION_ENTRY(module_name, method_name, filename, line_number);
0
ctx = cpu_create_context(state, c, recv, mo, sym, mod, (unsigned long int)args, block);
0
/* If it was missing, setup some extra data in the MethodContext for
0
the method_missing method to check out, to see why it was missing. */
0
@@ -1281,6 +1370,12 @@ next_op:
0
if(state->om->collect_now) {
0
+ if (RUBINIUS_GC_BEGIN_ENABLED()) {
0
int cm = state->om->collect_now;
0
/* Collect the first generation. */
0
@@ -1311,6 +1406,12 @@ check_interrupts:
0
state->om->collect_now = 0;
0
+ if (RUBINIUS_GC_END_ENABLED()) {
0
if(state->check_events) {