A number of little updates have been applied to the Copper interpreter and documentation this week including better type identification and string-related methods.
New changes this week in Copper fill in some of the gaps that show up when trying to use Copper for real-world projects. The first of these is the indication of the support of multiple interfaces, which solves the dilemma of distinguishing between polymorphic objects turned into Copper objects. The second is the addition of a system function that enables the sharing of user-created function bodies.
In other notes, the string_map extension received a bug fix for not correctly returning when “exit” was called in the middle of the callback function it was given.
Up to this point, the foreign function system did not allow using callbacks via Engine::runFunctionObject() until after Engine::execute() or Engine::run() (which calls Engine::execute()) had completed. My recent update changes that and makes recursive execution of opcodes easier.
One of the features I had been meaning to get around to for some time was improvements to the logging. The original system had one enum value per error. It gets quite tedious pretty quickly when you have to write out redundant messages with only a single word changed. Since it would be nice to have the messages be localized (i.e. translated into different languages), I used an enum, but obviously, I needed to shorten the process.
The result of my long evening of work was a rewrite of part of the logging system that resulting in an easily extensible interface for which I created pretty print logging (which you can see in the feature image of this post).
Back at it again, this time I’ve made some important bug fixes that have laid hidden since branch Cheetah. Uh oh. Sometimes a bug can be simply reference counting too much, in which case, we call it a memory leak. The major issue, however, was a parsing bug that duplicated variable address names. Hard to believe I missed something as important as that, but it required a certain state of the parser, so I don’t feel quite as bad about missing it. In any case, those are done.
I did some speed profiling… – something I probably should have done a before outright stating my virtual machine is “not improvable” on its blog. Of course, I know better, and that’s why I performed speed profiling.
The profiling narrowed down the bulk of the speed bottleneck to function calls (actually, it was a confirmed educated guess, but I think I know where the other bottlenecks are).
Not to the surprise of any expert, the primary issue turned out to be string comparison. Strings add up to be amazingly expensive. Currently, there are too many function calls that depend on them in the script execution section of the engine.
Continue reading “Type System Revise”
Feels odd that this is technically the first complete progress report being made on this project, but the good news is that there are a number of positive things to report.