On Mon, Apr 8, 2024 at 11:33 AM Jean Louis Faucher <jfaucher...@gmail.com>
wrote:

> Thanks!
>
> Returns an instance from the integer cache maintained by the
> RexxIntegerClass object. These are all marked by the live() method on the
> object, so RexxMemory doesn't need to do anything special.
>
>
> I never realised that the RexxInteger has a (what? metaclass?) different
> from RexxClass.…
> And apparently, it’s the only class to be like that.
>

That's because it has some additional static fields that need to be marked
for garbage collection.



>
> My notes:
>
> All classes declare they class using CLASS_CREATE
> except RexxInteger and NumberString which use CLASS_CREATE_SPECIAL
> and except RexxClass, probably for bootstrap.
>     CLASS_CREATE_SPECIAL(NumberString, "String", RexxClass);
>     CLASS_CREATE_SPECIAL(Integer,      "String", *RexxIntegerClass*);
>
> RexxClass *NumberString::classInstance = OREF_NULL;
> *RexxIntegerClass* *RexxInteger::classInstance = OREF_NULL;
>

The  NumberString and Integer classes are special optimizations for doing
arithmetic. The instances masquerade as string objects, but from an ooRexx
user standpoint, they don't exist.

>
>
> Only the file IntegerClass.cpp has 2 live methods:
> void RexxInteger::live(size_t liveMark)
> void RexxIntegerClass::live(size_t liveMark)
>

That's because it has additional marking to do. NumberString has no such
requirement, so it can be created from a standard Class instance.

>
>
> I noticed that all the class are doing
>     memory_mark(objectVariables);
> instead of doing
>     RexxObject::live(liveMark)
>
> This is aligned with the comment in ObjectClass.cpp
>  * Other exported classes that inherit from Object are
>  * also expected to mark this field.
> but to not forget if other attributes are added to RexxObject in the
> future.
>
> _______________________________________________
> Oorexx-devel mailing list
> Oorexx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to