Permalink
Browse files

support subprof_fun, subprof_hll, subprof_ops

  • Loading branch information...
1 parent 7dd1a74 commit beef84c30b066a66b620aae99a91d4e8ff7c5156 @mlschroe mlschroe committed Sep 7, 2011
Showing with 355 additions and 160 deletions.
  1. +6 −5 include/parrot/runcore_subprof.h
  2. +6 −2 src/embed/api.c
  3. +0 −79 src/runcore/cores.c
  4. +4 −1 src/runcore/main.c
  5. +339 −73 src/runcore/subprof.c
@@ -73,19 +73,20 @@ struct subprofile {
uint64_t callerticks;
};
+#define SUBPROF_TYPE_FUN 1
+#define SUBPROF_TYPE_HLL 2
+#define SUBPROF_TYPE_OPS 3
+
struct subprofiledata {
- int have_profile_data;
+ /* type of profile */
+ int profile_type;
/* the collected data */
subprofile *subprofilehash[32768];
/* the current context */
PMC *cursubpmc;
PMC *curctx;
subprofile *cursp;
- lineinfo *curline;
-
- opcode_t *startop;
- opcode_t *endop;
/* ticks are added at the end of the op */
uint64_t *tickadd;
View
@@ -188,8 +188,12 @@ Parrot_api_set_runcore(Parrot_PMC interp_pmc, ARGIN(const char * corename),
Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "slow"));
else if (STREQ(corename, "fast") || STREQ(corename, "jit") || STREQ(corename, "function"))
Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "fast"));
- else if (STREQ(corename, "subprof"))
- Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "subprof"));
+ else if (STREQ(corename, "subprof_fun"))
+ Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "subprof_fun"));
+ else if (STREQ(corename, "subprof_hll"))
+ Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "subprof_hll"));
+ else if (STREQ(corename, "subprof_ops"))
+ Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "subprof_ops"));
else if (STREQ(corename, "exec"))
Parrot_runcore_switch(interp, Parrot_str_new_constant(interp, "exec"));
else if (STREQ(corename, "trace"))
View
@@ -244,7 +244,6 @@ next opcode, or examine and manipulate data from the executing program.
#include "parrot/runcore_api.h"
#include "parrot/embed.h"
#include "parrot/runcore_trace.h"
-#include "parrot/runcore_subprof.h"
#include "cores.str"
#include "parrot/oplib/ops.h"
@@ -306,14 +305,6 @@ static opcode_t * runops_slow_core(PARROT_INTERP,
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
-static opcode_t * runops_subprof_core(PARROT_INTERP,
- Parrot_runcore_t *runcore,
- ARGIN(opcode_t *pc))
- __attribute__nonnull__(1)
- __attribute__nonnull__(3);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
static opcode_t * runops_trace_core(PARROT_INTERP, ARGIN(opcode_t *pc))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -334,9 +325,6 @@ static opcode_t * runops_trace_core(PARROT_INTERP, ARGIN(opcode_t *pc))
#define ASSERT_ARGS_runops_slow_core __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pc))
-#define ASSERT_ARGS_runops_subprof_core __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(pc))
#define ASSERT_ARGS_runops_trace_core __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pc))
@@ -406,35 +394,6 @@ Parrot_runcore_fast_init(PARROT_INTERP)
/*
-=item C<void Parrot_runcore_subprof_init(PARROT_INTERP)>
-
-Registers the subprof runcore with Parrot.
-
-=cut
-
-*/
-
-void
-Parrot_runcore_subprof_init(PARROT_INTERP)
-{
- ASSERT_ARGS(Parrot_runcore_subprof_init)
-
- Parrot_runcore_t * const coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);
- coredata->name = CONST_STRING(interp, "subprof");
- coredata->id = PARROT_SLOW_CORE;
- coredata->opinit = PARROT_CORE_OPLIB_INIT;
- coredata->runops = runops_subprof_core;
- coredata->prepare_run = NULL;
- coredata->destroy = NULL;
- coredata->flags = 0;
-
- PARROT_RUNCORE_FUNC_TABLE_SET(coredata);
-
- Parrot_runcore_register(interp, coredata);
-}
-
-/*
-
=item C<void Parrot_runcore_exec_init(PARROT_INTERP)>
Registers the exec runcore with Parrot.
@@ -648,44 +607,6 @@ runops_trace_core(PARROT_INTERP, ARGIN(opcode_t *pc))
/*
-=item C<static opcode_t * runops_subprof_core(PARROT_INTERP, Parrot_runcore_t
-*runcore, opcode_t *pc)>
-
-Runs the Parrot operations starting at C<pc> until there are no more
-operations, with sub-level profiling, tracing and bounds checking enabled.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static opcode_t *
-runops_subprof_core(PARROT_INTERP, SHIM(Parrot_runcore_t *runcore), ARGIN(opcode_t *pc))
-{
- ASSERT_ARGS(runops_slow_core)
-
- if (Interp_trace_TEST(interp, PARROT_TRACE_OPS_FLAG))
- return runops_trace_core(interp, pc);
-
- while (pc) {
- if (pc < code_start || pc >= code_end)
- Parrot_ex_throw_from_c_args(interp, NULL, 1,
- "attempt to access code outside of current code segment");
-
- Parrot_pcc_set_pc(interp, CURRENT_CONTEXT(interp), pc);
-
- profile(interp, CURRENT_CONTEXT(interp), pc);
-
- DO_OP(pc, interp);
- }
-
- return pc;
-}
-
-
-/*
-
=item C<static opcode_t * runops_slow_core(PARROT_INTERP, Parrot_runcore_t
*runcore, opcode_t *pc)>
View
@@ -20,6 +20,7 @@ The runcore API handles running the operations.
#include "parrot/parrot.h"
#include "parrot/runcore_api.h"
#include "parrot/runcore_profiling.h"
+#include "parrot/runcore_subprof.h"
#include "parrot/oplib/core_ops.h"
#include "parrot/oplib/ops.h"
#include "main.str"
@@ -68,7 +69,9 @@ Parrot_runcore_init(PARROT_INTERP)
Parrot_runcore_slow_init(interp);
Parrot_runcore_fast_init(interp);
- Parrot_runcore_subprof_init(interp);
+ Parrot_runcore_subprof_ops_init(interp);
+ Parrot_runcore_subprof_hll_init(interp);
+ Parrot_runcore_subprof_fun_init(interp);
Parrot_runcore_exec_init(interp);
Parrot_runcore_gc_debug_init(interp);
Parrot_runcore_debugger_init(interp);
Oops, something went wrong.

0 comments on commit beef84c

Please sign in to comment.