nagyistoce / open-source-spin-compiler

Automatically exported from code.google.com/p/open-source-spin-compiler
0 stars 0 forks source link

Need Spin "Program size is N longs" #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Need a report of program size like in BSTC which reports
"Program size is N longs"

Propose this or something like it:

...

    ComposeRAM(&pBuffer, bufferSize, bDATonly);
    FILE* pFile = fopen(binaryFilename, "wb");
    if (pFile)
    {
        fwrite(pBuffer, bufferSize, 1, pFile);
        fclose(pFile);
    }
    delete [] pBuffer;

+   if (!bQuiet)
+   {
+       printf("Program size is %d longs\n", bufferSize);
+   }

...

Original issue reported on code.google.com by jsden...@gmail.com on 23 Jun 2012 at 2:22

GoogleCodeExporter commented 9 years ago
File is SpinSource/spin.cpp with proposed code after printf("Done.\n");
Could put before "Done." message.

Original comment by jsden...@gmail.com on 23 Jun 2012 at 2:23

GoogleCodeExporter commented 9 years ago
Well bufferSize reports code-size bytes, not longs. This misunderstanding was 
promoted by BSTC's output which says "longs" but that appears to be a bug.

Question though: It seems to me that the minimum "program size" is not "code 
size" but code size + first object size + var size + stack markers. In other 
words, dcurr.

Original comment by jsden...@gmail.com on 23 Jun 2012 at 2:56

GoogleCodeExporter commented 9 years ago
So program size should be reported like this no?

+   if (!bQuiet)
+   {
+       printf("Program size is %d bytes\n", ((unsigned short*)pBuffer)[7]);
+   }

    delete [] pBuffer;

Original comment by jsden...@gmail.com on 23 Jun 2012 at 2:58

GoogleCodeExporter commented 9 years ago

Original comment by reltham on 25 Jun 2012 at 9:00

GoogleCodeExporter commented 9 years ago
I can output whatever you want it to be.
I'll put in your last suggestion for now, and if you think of something 
different/more, let me know.

Original comment by reltham on 25 Jun 2012 at 9:02

GoogleCodeExporter commented 9 years ago
Fixed in source code (r34).  

Original comment by reltham on 25 Jun 2012 at 9:57