[cc65] Modules with self modifying code

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2011-02-04 15:22:44
Christian Krüger, who has already contributed optimized memxxx functions has
sent me a memset replacement that uses self modifying code. It performs
significantly better than the existing one, especially for larger memory
blocks and is based on two independent include files that contain macros and
contants for developing modules containing self modifying code.

Now the question is what to do with it.

In the past, I've refrained from using self modifying code, because it is not
romable, quite difficult to debug, and has more potential for errors in my
experience. In addition, some of the functions that would benefit most from
smc are inlined by the compiler, so the library function is never called. And,
there are platforms that have programs in ROM, so they can use these modules
only with tricks.

On the other side, there are definitely cases, where problems are almost
impossible to solve without self modifying code, and there are other cases,
where smc gives a huge performance increase.

As I see it, my options are:

  1. Don't accept modules/changes containing smc. There's nothing that
     prevents programmers to use smc on their own as it was before. To support
     people writing their own modules, Christians include files could be
     incorporated into the library, so there's a base to build on.

  2. Accept replacement functions using smc, but let them have different
     names, so a programmer must explicitly call the smc version.

  3. Accept replacement functions and create a separate library together with
     a small script that allows an end user to replace the modules in a target
     library with smc versions.

  4. Accept replacement functions and add them by default to the target
     libraries of the platforms where programs are usually run in RAM. Since a
     programmer must still be able to write romable code, there must be some
     measure to create a library without smc code.

A disadvantage of options 2-4 is that it's probably me who is expected to
implement them:-)

Anyway, are there more options? Opinions in favour of one of the options
listed above? In favour or against self modifying code?

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Feb 4 15:22:57 2011

This archive was generated by hypermail 2.1.8 : 2011-02-04 15:23:00 CET