Method call frequency statistics for ARM
authorDavid Flamme <dfla@complang.tuwien.ac.at>
Tue, 16 Mar 2010 15:13:20 +0000 (16:13 +0100)
committerDavid Flamme <dfla@complang.tuwien.ac.at>
Tue, 16 Mar 2010 15:13:20 +0000 (16:13 +0100)
* src/vm/jit/arm/emit.c: Added working emit_profile_method(..) and emit_profile_basicblock(..) for ARM, so now call frequencys can be shown with -Xprof
* src/vm/jit/optimizing/profile.cpp (profile_printstats): The use of DumpList is causing problems, so std::list is used instead

src/vm/jit/arm/emit.c
src/vm/jit/optimizing/profile.cpp

index 6a196037c6807b507f9f5cdb8f2061f80f3f865b..b1587e3403037bf57f1ae6adaf488d0a964f60ba 100644 (file)
@@ -959,6 +959,58 @@ void emit_verbosecall_exit(jitdata *jd)
 #endif /* !defined(NDEBUG) */
 
 
+/**
+ * Emit profiling code for method frequency counting.
+ * Its slow but working, so be carefull, if you want to use it...
+ */
+#if defined(ENABLE_PROFILING)
+void emit_profile_method(codegendata* cd, codeinfo* code)
+{
+       ICONST(REG_ITMP3,code);
+       M_LDR(REG_ITMP2,REG_ITMP3,OFFSET(codeinfo, frequency));
+       M_ADD_IMM(REG_ITMP2, REG_ITMP2, 1);
+       M_STR(REG_ITMP2,REG_ITMP3,OFFSET(codeinfo, frequency));
+//     M_TRAP(0, TRAP_DEBUG);
+}
+
+#endif
+
+/**
+ * Emit profiling code for basicblock frequency counting.
+ * Its slow but working, so be carefull, if you want to use it...
+ */
+#if defined(ENABLE_PROFILING)
+void emit_profile_basicblock(codegendata* cd, codeinfo* code, basicblock* bptr)
+{
+       ICONST(REG_ITMP3,code);
+       M_LDR(REG_ITMP2,REG_ITMP3,OFFSET(codeinfo, bbfrequency));
+       M_ADD_IMM(REG_ITMP2, REG_ITMP2, 1);
+       M_STR(REG_ITMP2,REG_ITMP3,OFFSET(codeinfo, bbfrequency));
+}
+#endif
+
+
+/**
+ * Emit profiling code to start CPU cycle counting.
+ */
+#if defined(ENABLE_PROFILING)
+void emit_profile_cycle_start(codegendata* cd, codeinfo* code)
+{
+       // XXX Not implemented yet!
+}
+#endif
+
+
+/**
+ * Emit profiling code to stop CPU cycle counting.
+ */
+#if defined(ENABLE_PROFILING)
+void emit_profile_cycle_stop(codegendata* cd, codeinfo* code)
+{
+       // XXX Not implemented yet!
+}
+#endif
+
 /*
  * These are local overrides for various environment variables in Emacs.
  * Please do not remove this and leave it at the end of the file, where
index 1ebc554a3d9ba0f5fa08c5063ec6ae307b0ace60..eb8ceccd9b0d4189b0f1632a44a85a3509e24236 100644 (file)
@@ -226,7 +226,8 @@ void profile_printstats(void)
 
        /* create new method list */
 
-       DumpList<methodinfo*> l;
+       std::list<methodinfo*> l;
+       //DumpList<methodinfo*> l; // XXX currently the DumpList doesn't work here.
 
        /* iterate through all classes and methods */