Store backtrace to field of struct RException

Since the possible values of the backtrace are limited to `nil`, `RData`, and `RAray`, they are now stored as object pointers.

This change saves memory by eliminating the need to use instance variables for common exceptions.

ref. #2485
This commit is contained in:
dearblue
2022-03-13 15:39:07 +09:00
parent 7d85092bc4
commit 92ef9f1a9e
4 changed files with 48 additions and 36 deletions
+1
View File
@@ -18,6 +18,7 @@ struct RException {
MRB_OBJECT_HEADER;
struct iv_tbl *iv;
struct RObject *mesg; // NULL or probably RString
struct RObject *backtrace; // NULL, RArray or RData
};
#define mrb_exc_ptr(v) ((struct RException*)mrb_ptr(v))