From 92093dd23f071a1092c2a42721a32291092e5cfd Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Sat, 29 Jun 2019 10:46:28 +0000 Subject: [PATCH] added two more fields into CompiledMethod. no implementation change has been made yet --- moo/kernel/Context.moo | 13 +++++++++++-- moo/lib/comp.c | 4 ++-- moo/lib/moo.h | 6 ++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/moo/kernel/Context.moo b/moo/kernel/Context.moo index d149b66..51e355b 100644 --- a/moo/kernel/Context.moo +++ b/moo/kernel/Context.moo @@ -314,8 +314,17 @@ class(#pointer,#final,#limited) BlockContext(Context) class(#pointer) CompiledMethod(Object) { - // var owner, name, preamble, preamble_data_1, preamble_data_2, ntmprs, nargs, code, source. - var owner, name, preamble, preamble_data_1, preamble_data_2, ntmprs, nargs, source. + var owner, + name, + preamble, + preamble_data_1, + preamble_data_2, + ntmprs, + nargs, + //code, <-- only if moo is built with MOO_USE_METHOD_TRAILER disable. + source, + source_file, + source_line. method preamble { diff --git a/moo/lib/comp.c b/moo/lib/comp.c index dbb799a..3b9a9c5 100644 --- a/moo/lib/comp.c +++ b/moo/lib/comp.c @@ -1775,8 +1775,8 @@ static int get_string (moo_t* moo, moo_ooch_t end_char, moo_ooch_t esc_char, int /* \x, \u, \U not followed by a hexadecimal digit */ if (digit_count == 0) { - static moo_ooch_t rc_tab[] = { '\0', '\0', 'x', '\0', 'u', '\0', '\0', '\0', 'U' }; - ADD_TOKEN_CHAR (moo, rc_tab[escaped]); + static moo_ooch_t esc_char_tab[] = { '\0', '\0', 'x', '\0', 'u', '\0', '\0', '\0', 'U' }; + ADD_TOKEN_CHAR (moo, esc_char_tab[escaped]); } else { diff --git a/moo/lib/moo.h b/moo/lib/moo.h index b93af6f..96ab20d 100644 --- a/moo/lib/moo.h +++ b/moo/lib/moo.h @@ -555,9 +555,9 @@ struct moo_methsig_t }; #if defined(MOO_USE_METHOD_TRAILER) -# define MOO_METHOD_NAMED_INSTVARS 8 +# define MOO_METHOD_NAMED_INSTVARS 10 #else -# define MOO_METHOD_NAMED_INSTVARS 9 +# define MOO_METHOD_NAMED_INSTVARS 11 #endif typedef struct moo_method_t moo_method_t; typedef struct moo_method_t* moo_oop_method_t; @@ -586,6 +586,8 @@ struct moo_method_t #endif moo_oop_t source; /* TODO: what should I put? */ + moo_oop_t source_file; /* source file that contains the definition of this method. nil if unavailable */ + moo_oow_t source_line; /* line of the source file where the method definition begins. valid only if source_file is not nil */ /* == variable indexed part == */ moo_oop_t literal_frame[1]; /* it stores literals */