changeset 2475:b9734859db5c

Add few comments about the state of jssOptimizeModule().
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 27 Apr 2020 18:13:11 +0300
parents e2e94f9afe1b
children 90eec3e1f85f
files tools/xm2jss.c
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tools/xm2jss.c	Mon Apr 27 18:08:39 2020 +0300
+++ b/tools/xm2jss.c	Mon Apr 27 18:13:11 2020 +0300
@@ -915,7 +915,14 @@
 }
 
 
-/* Optimize a given module
+/* Optimize a given module.
+ * NOTE! While this function creates and returns a new JSSModule,
+ * it mostly copies references to data in the source module,
+ * AND also modifies the source module - which is kinda "bad".
+ * If/when freeing module data, you MUST only jssFreeModule()
+ * the source one, and dmFree() the optimized result.
+ *
+ * This should be re-written to copy the data instead.
  */
 JSSModule *jssOptimizeModule(JSSModule *src)
 {
@@ -1096,6 +1103,9 @@
     if (usedInstruments[ninst])
     {
         JSSInstrument *ip;
+
+        // XXX TODO instrument stripping should be done here
+        // if this ever gets rewritten to copy source data instead.
         if (optStripInstr)
             continue;
 
@@ -1141,6 +1151,8 @@
     {
         JSSExtInstrument *eip;
 
+        // XXX TODO instrument stripping should be done here
+        // if this ever gets rewritten to copy source data instead.
         if (optStripExtInstr)
             continue;