simplified source line and source text representation of a methond in dbgi

This commit is contained in:
hyunghwan.chung 2019-07-12 03:38:45 +00:00
parent fcf6d3ffc1
commit 8e5e5234cb
7 changed files with 115 additions and 158 deletions

View File

@ -322,9 +322,7 @@ class(#pointer) CompiledMethod(Object)
ntmprs, ntmprs,
nargs, nargs,
//code, <-- only if moo is built with MOO_USE_METHOD_TRAILER disable. //code, <-- only if moo is built with MOO_USE_METHOD_TRAILER disable.
dbi_text_offset,
dbi_file_offset, dbi_file_offset,
source_line,
dbi_method_offset. dbi_method_offset.
method preamble method preamble
@ -350,10 +348,6 @@ class(#pointer) CompiledMethod(Object)
method(#primitive) sourceText. method(#primitive) sourceText.
method(#primitive) sourceFile. method(#primitive) sourceFile.
method(#primitive) sourceLine.
method(#primitive) ipSourceLine: ip. method(#primitive) ipSourceLine: ip.
method sourceLine
{
^self.source_line
}
} }

View File

@ -79,7 +79,6 @@ while (ctx notNil)
System logNl: (" " & ctx method owner name & ">>" & ctx method name & System logNl: (" " & ctx method owner name & ">>" & ctx method name &
" (" & ctx method sourceFile & " " & (ctx method ipSourceLine: (ctx pc)) asString & ")"). " (" & ctx method sourceFile & " " & (ctx method ipSourceLine: (ctx pc)) asString & ")").
// TODO: get location of the current pc and include it... (ctx method sourceLine: ctx pc) asString dump. // TODO: get location of the current pc and include it... (ctx method sourceLine: ctx pc) asString dump.
}. }.
// TODO: include blockcontext??? // TODO: include blockcontext???
ctx := ctx sender. ctx := ctx sender.

View File

@ -2518,10 +2518,10 @@ static MOO_INLINE int emit_byte_instruction (moo_t* moo, moo_oob_t code, const m
cc->mth.code.ptr[cc->mth.code.len] = code; cc->mth.code.ptr[cc->mth.code.len] = code;
if (srcloc) if (srcloc)
{ {
/* store the distance from the method body start */
if (srcloc->file == cc->mth.code_start_loc.file && srcloc->line >= cc->mth.code_start_loc.line) if (srcloc->file == cc->mth.code_start_loc.file && srcloc->line >= cc->mth.code_start_loc.line)
{ {
cc->mth.code.locptr[cc->mth.code.len] = srcloc->line - cc->mth.code_start_loc.line; /*cc->mth.code.locptr[cc->mth.code.len] = srcloc->line - cc->mth.code_start_loc.line;*/
cc->mth.code.locptr[cc->mth.code.len] = srcloc->line;
} }
else else
{ {
@ -6975,17 +6975,6 @@ static int add_compiled_method (moo_t* moo)
MOO_STORE_OOP (moo, (moo_oop_t*)&mth->code, (moo_oop_t)code); MOO_STORE_OOP (moo, (moo_oop_t*)&mth->code, (moo_oop_t)code);
#endif #endif
if (cc->mth.code_start_loc.line <= MOO_SMOOI_MAX)
{
mth->source_line = MOO_SMOOI_TO_OOP(cc->mth.code_start_loc.line);
}
else
{
/* the source line is too large to be held as a SmallInteger.
* Just set it to 0 to indicate that the information is not available */
mth->source_line = MOO_SMOOI_TO_OOP(0);
}
if (moo->dbgi) if (moo->dbgi)
{ {
moo_oow_t file_offset; moo_oow_t file_offset;
@ -7005,9 +6994,10 @@ static int add_compiled_method (moo_t* moo)
/* TODO: warning */ /* TODO: warning */
file_offset = 0; file_offset = 0;
} }
mth->dbi_file_offset = MOO_SMOOI_TO_OOP(file_offset); mth->dbgi_file_offset = MOO_SMOOI_TO_OOP(file_offset);
if (moo_addmethodtodbgi(moo, file_offset, cc->dbgi_class_offset, cc->mth.name.ptr, cc->mth.code.locptr, cc->mth.code.len, &method_offset) <= -1) /* TODO: preserve source text... */
if (moo_addmethodtodbgi(moo, file_offset, cc->dbgi_class_offset, cc->mth.name.ptr, cc->mth.code_start_loc.line, cc->mth.code.locptr, cc->mth.code.len, MOO_NULL, 0, &method_offset) <= -1)
{ {
/* TODO: warning. no debug information about this method will be available */ /* TODO: warning. no debug information about this method will be available */
method_offset = 0; method_offset = 0;
@ -7016,14 +7006,9 @@ static int add_compiled_method (moo_t* moo)
{ {
method_offset = 0; method_offset = 0;
} }
mth->dbi_method_offset = MOO_SMOOI_TO_OOP(method_offset); mth->dbgi_method_offset = MOO_SMOOI_TO_OOP(method_offset);
} }
/*TODO: preserve source??? mth->text = cc->mth.text
the compiler must collect all source method string collected so far.
need to write code to collect string.
*/
#if defined(MOO_DEBUG_COMPILER) #if defined(MOO_DEBUG_COMPILER)
moo_decode (moo, mth, &cc->fqn); moo_decode (moo, mth, &cc->fqn);
#endif #endif

View File

@ -169,39 +169,6 @@ int moo_addfiletodbgi (moo_t* moo, const moo_ooch_t* file_name, moo_oow_t* start
return 0; return 0;
} }
int moo_addtexttodbgi (moo_t* moo, const moo_ooch_t* text_ptr, moo_oow_t text_len, moo_oow_t* start_offset)
{
moo_oow_t text_bytes, text_bytes_aligned, req_bytes;
moo_dbgi_text_t* di;
if (!moo->dbgi)
{
if (start_offset) *start_offset = MOO_NULL;
return 0; /* debug information is disabled*/
}
/* NOTE: there is no duplication check for text */
text_bytes = (text_len + 1) * MOO_SIZEOF(*text_ptr);
text_bytes_aligned = MOO_ALIGN_POW2(text_bytes, MOO_SIZEOF_OOW_T);
req_bytes = MOO_SIZEOF(moo_dbgi_text_t) + text_bytes_aligned;
di = (moo_dbgi_text_t*)secure_dbgi_space(moo, req_bytes);
if (!di) return -1;
di->_type = MOO_DBGI_MAKE_TYPE(MOO_DBGI_TYPE_CODE_TEXT, 0);
di->_len = req_bytes;
di->_next = moo->dbgi->_last_text;
di->text_len = text_len;
moo_copy_oochars ((moo_ooch_t*)(di + 1), text_ptr, text_len);
moo->dbgi->_last_text = moo->dbgi->_len;
moo->dbgi->_len += req_bytes;
if (start_offset) *start_offset = moo->dbgi->_last_text;
return 0;
}
int moo_addclasstodbgi (moo_t* moo, const moo_ooch_t* class_name, moo_oow_t file_offset, moo_oow_t file_line, moo_oow_t* start_offset) int moo_addclasstodbgi (moo_t* moo, const moo_ooch_t* class_name, moo_oow_t file_offset, moo_oow_t file_line, moo_oow_t* start_offset)
{ {
moo_oow_t name_len, name_bytes, name_bytes_aligned, req_bytes; moo_oow_t name_len, name_bytes, name_bytes_aligned, req_bytes;
@ -248,10 +215,11 @@ int moo_addclasstodbgi (moo_t* moo, const moo_ooch_t* class_name, moo_oow_t file
return 0; return 0;
} }
int moo_addmethodtodbgi (moo_t* moo, moo_oow_t file_offset, moo_oow_t class_offset, const moo_ooch_t* method_name, const moo_oow_t* code_loc_ptr, moo_oow_t code_loc_len, moo_oow_t* start_offset) int moo_addmethodtodbgi (moo_t* moo, moo_oow_t file_offset, moo_oow_t class_offset, const moo_ooch_t* method_name, moo_oow_t start_line, const moo_oow_t* code_loc_ptr, moo_oow_t code_loc_len, const moo_ooch_t* text_ptr, moo_oow_t text_len, moo_oow_t* start_offset)
{ {
moo_oow_t name_len, name_bytes, name_bytes_aligned, code_loc_bytes, code_loc_bytes_aligned, req_bytes; moo_oow_t name_len, name_bytes, name_bytes_aligned, code_loc_bytes, code_loc_bytes_aligned, text_bytes, text_bytes_aligned, req_bytes;
moo_dbgi_method_t* di; moo_dbgi_method_t* di;
moo_uint8_t* curptr;
if (!moo->dbgi) return 0; /* debug information is disabled*/ if (!moo->dbgi) return 0; /* debug information is disabled*/
@ -260,7 +228,9 @@ int moo_addmethodtodbgi (moo_t* moo, moo_oow_t file_offset, moo_oow_t class_offs
name_bytes_aligned = MOO_ALIGN_POW2(name_bytes, MOO_SIZEOF_OOW_T); name_bytes_aligned = MOO_ALIGN_POW2(name_bytes, MOO_SIZEOF_OOW_T);
code_loc_bytes = code_loc_len * MOO_SIZEOF(*code_loc_ptr); code_loc_bytes = code_loc_len * MOO_SIZEOF(*code_loc_ptr);
code_loc_bytes_aligned = MOO_ALIGN_POW2(code_loc_bytes, MOO_SIZEOF_OOW_T); code_loc_bytes_aligned = MOO_ALIGN_POW2(code_loc_bytes, MOO_SIZEOF_OOW_T);
req_bytes = MOO_SIZEOF(moo_dbgi_method_t) + name_bytes_aligned + code_loc_bytes_aligned; text_bytes = text_len * MOO_SIZEOF(*text_ptr);
text_bytes_aligned = MOO_ALIGN_POW2(text_bytes, MOO_SIZEOF_OOW_T);
req_bytes = MOO_SIZEOF(moo_dbgi_method_t) + name_bytes_aligned + code_loc_bytes_aligned + text_bytes_aligned;
di = (moo_dbgi_method_t*)secure_dbgi_space(moo, req_bytes); di = (moo_dbgi_method_t*)secure_dbgi_space(moo, req_bytes);
if (!di) return -1; if (!di) return -1;
@ -270,11 +240,23 @@ int moo_addmethodtodbgi (moo_t* moo, moo_oow_t file_offset, moo_oow_t class_offs
di->_next = moo->dbgi->_last_method; di->_next = moo->dbgi->_last_method;
di->_file = file_offset; di->_file = file_offset;
di->_class = class_offset; di->_class = class_offset;
di->start_line = start_line;
di->code_loc_start = name_bytes_aligned; di->code_loc_start = name_bytes_aligned;
di->code_loc_len = code_loc_len; di->code_loc_len = code_loc_len;
di->text_start = name_bytes_aligned + code_loc_bytes_aligned;
di->text_len = text_len;
moo_copy_oocstr ((moo_ooch_t*)(di + 1), name_len + 1, method_name); curptr = (moo_uint8_t*)(di + 1);
MOO_MEMCPY ((moo_uint8_t*)(di + 1) + name_bytes_aligned, code_loc_ptr, code_loc_bytes); moo_copy_oocstr ((moo_ooch_t*)curptr, name_len + 1, method_name);
curptr += name_bytes_aligned;
MOO_MEMCPY (curptr, code_loc_ptr, code_loc_bytes);
if (text_len > 0)
{
curptr += code_loc_bytes_aligned;
moo_copy_oochars ((moo_ooch_t*)curptr, text_ptr, text_len);
}
moo->dbgi->_last_method = moo->dbgi->_len; moo->dbgi->_last_method = moo->dbgi->_len;
moo->dbgi->_len += req_bytes; moo->dbgi->_len += req_bytes;

View File

@ -2216,45 +2216,26 @@ static moo_pfrc_t pf_context_find_exception_handler (moo_t* moo, moo_mod_t* mod,
} }
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
static moo_pfrc_t pf_method_get_source_text (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs) static MOO_INLINE moo_dbgi_method_t* get_dbgi_method (moo_t* moo, moo_oop_method_t mth)
{ {
moo_oop_method_t rcv; moo_dbgi_method_t* di = MOO_NULL;
moo_oop_t retv = moo->_nil; /* TODO: empty string instead of nil? */
/* TODO: return something else lighter-weight than a string? */ if (moo->dbgi && MOO_OOP_IS_SMOOI(mth->dbgi_method_offset))
rcv = (moo_oop_method_t)MOO_STACK_GETRCV(moo, nargs);
MOO_PF_CHECK_RCV (moo, MOO_CLASSOF(moo, rcv) == moo->_method);
if (moo->dbgi)
{ {
if (MOO_OOP_IS_SMOOI(rcv->dbi_text_offset)) moo_ooi_t dbgi_method_offset;
dbgi_method_offset = MOO_OOP_TO_SMOOI(mth->dbgi_method_offset);
if (dbgi_method_offset > 0)
{ {
moo_ooi_t dbi_text_offset; MOO_ASSERT (moo, dbgi_method_offset < moo->dbgi->_len);
di = (moo_dbgi_method_t*)&((moo_uint8_t*)moo->dbgi)[dbgi_method_offset];
dbi_text_offset = MOO_OOP_TO_SMOOI(rcv->dbi_text_offset); MOO_ASSERT (moo, MOO_DBGI_GET_TYPE_CODE(di->_type) == MOO_DBGI_TYPE_CODE_METHOD);
if (dbi_text_offset > 0)
{
moo_dbgi_text_t* di;
const moo_ooch_t* text_ptr;
MOO_ASSERT (moo, dbi_text_offset < moo->dbgi->_len);
di = (moo_dbgi_text_t*)&((moo_uint8_t*)moo->dbgi)[dbi_text_offset];
MOO_ASSERT (moo, MOO_DBGI_GET_TYPE_CODE(di->_type) == MOO_DBGI_TYPE_CODE_TEXT);
text_ptr = (const moo_ooch_t*)(di + 1);
moo_pushvolat (moo, &retv);
retv = moo_makestring(moo, text_ptr, di->text_len);
moo_popvolat (moo);
if (!retv) return MOO_PF_FAILURE;
}
} }
} }
MOO_STACK_SETRET (moo, nargs, retv); return di;
return MOO_PF_SUCCESS;
} }
static moo_pfrc_t pf_method_get_source_file (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs) static moo_pfrc_t pf_method_get_source_file (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
{ {
moo_oop_method_t rcv; moo_oop_method_t rcv;
@ -2266,18 +2247,18 @@ static moo_pfrc_t pf_method_get_source_file (moo_t* moo, moo_mod_t* mod, moo_ooi
if (moo->dbgi) if (moo->dbgi)
{ {
if (MOO_OOP_IS_SMOOI(rcv->dbi_file_offset)) if (MOO_OOP_IS_SMOOI(rcv->dbgi_file_offset))
{ {
moo_ooi_t dbi_file_offset; moo_ooi_t dbgi_file_offset;
dbi_file_offset = MOO_OOP_TO_SMOOI(rcv->dbi_file_offset); dbgi_file_offset = MOO_OOP_TO_SMOOI(rcv->dbgi_file_offset);
if (dbi_file_offset > 0) if (dbgi_file_offset > 0)
{ {
moo_dbgi_file_t* di; moo_dbgi_file_t* di;
const moo_ooch_t* file_name; const moo_ooch_t* file_name;
MOO_ASSERT (moo, dbi_file_offset < moo->dbgi->_len); MOO_ASSERT (moo, dbgi_file_offset < moo->dbgi->_len);
di = (moo_dbgi_file_t*)&((moo_uint8_t*)moo->dbgi)[dbi_file_offset]; di = (moo_dbgi_file_t*)&((moo_uint8_t*)moo->dbgi)[dbgi_file_offset];
MOO_ASSERT (moo, MOO_DBGI_GET_TYPE_CODE(di->_type) == MOO_DBGI_TYPE_CODE_FILE); MOO_ASSERT (moo, MOO_DBGI_GET_TYPE_CODE(di->_type) == MOO_DBGI_TYPE_CODE_FILE);
file_name = (const moo_ooch_t*)(di + 1); file_name = (const moo_ooch_t*)(di + 1);
@ -2293,52 +2274,83 @@ static moo_pfrc_t pf_method_get_source_file (moo_t* moo, moo_mod_t* mod, moo_ooi
return MOO_PF_SUCCESS; return MOO_PF_SUCCESS;
} }
static moo_pfrc_t pf_method_get_ip_source_line (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs) static moo_pfrc_t pf_method_get_ip_source_line (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
{ {
/* get source line of the given instruction pointer */ /* get source line of the given instruction pointer */
moo_oop_method_t rcv; moo_oop_method_t rcv;
moo_oow_t line = 0; moo_oop_t ip;
moo_dbgi_method_t* di;
moo_oow_t retv = MOO_SMOOI_TO_OOP(0);
rcv = (moo_oop_method_t)MOO_STACK_GETRCV(moo, nargs); rcv = (moo_oop_method_t)MOO_STACK_GETRCV(moo, nargs);
MOO_PF_CHECK_RCV (moo, MOO_CLASSOF(moo, rcv) == moo->_method); MOO_PF_CHECK_RCV (moo, MOO_CLASSOF(moo, rcv) == moo->_method);
if (moo->dbgi && MOO_OOP_IS_SMOOI(rcv->source_line))
{
moo_oop_t ip;
moo_ooi_t source_line, ipv;
ip = MOO_STACK_GETARG(moo, nargs, 0); ip = MOO_STACK_GETARG(moo, nargs, 0);
MOO_PF_CHECK_ARGS (moo, nargs, MOO_OOP_IS_SMOOI(ip)); MOO_PF_CHECK_ARGS (moo, nargs, MOO_OOP_IS_SMOOI(ip));
source_line = MOO_OOP_TO_SMOOI(rcv->source_line); di = get_dbgi_method(moo, rcv);
ipv = MOO_OOP_TO_SMOOI(ip); if (di)
if (source_line >= 0 && ipv >= 0 && MOO_OOP_IS_SMOOI(rcv->dbi_method_offset))
{ {
moo_ooi_t dbi_method_offset; moo_ooi_t ipv;
dbi_method_offset = MOO_OOP_TO_SMOOI(rcv->dbi_method_offset);
if (dbi_method_offset > 0)
{
moo_dbgi_method_t* di;
moo_oow_t* code_loc_ptr; moo_oow_t* code_loc_ptr;
MOO_ASSERT (moo, dbi_method_offset < moo->dbgi->_len); ipv = MOO_OOP_TO_SMOOI(ip);
di = (moo_dbgi_method_t*)&((moo_uint8_t*)moo->dbgi)[dbi_method_offset];
MOO_ASSERT (moo, MOO_DBGI_GET_TYPE_CODE(di->_type) == MOO_DBGI_TYPE_CODE_METHOD);
code_loc_ptr = (moo_oow_t*)((moo_uint8_t*)(di + 1) + di->code_loc_start); code_loc_ptr = (moo_oow_t*)((moo_uint8_t*)(di + 1) + di->code_loc_start);
if (ipv < di->code_loc_len && code_loc_ptr[ipv] <= MOO_SMOOI_MAX) if (ipv < di->code_loc_len && code_loc_ptr[ipv] <= MOO_SMOOI_MAX)
{ {
line = code_loc_ptr[ipv] + source_line; /* this won't overflow but can exceed MOO_SMOOI_MAX */ retv = moo_oowtoint(moo, code_loc_ptr[ipv]);
if (line > MOO_SMOOI_MAX) line = 0; if (!retv) return MOO_PF_FAILURE;
}
}
} }
/* TODO: security check for data corruption? check if the ipv offset and the size calcualted doesn't exceed di->_len... */ /* TODO: security check for data corruption? check if the ipv offset and the size calcualted doesn't exceed di->_len... */
} }
MOO_STACK_SETRET (moo, nargs, MOO_SMOOI_TO_OOP(line)); MOO_STACK_SETRET (moo, nargs, retv);
return MOO_PF_SUCCESS;
}
static moo_pfrc_t pf_method_get_source_line (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
{
moo_oop_method_t rcv;
moo_dbgi_method_t* di;
moo_oow_t retv = MOO_SMOOI_TO_OOP(0);
rcv = (moo_oop_method_t)MOO_STACK_GETRCV(moo, nargs);
MOO_PF_CHECK_RCV (moo, MOO_CLASSOF(moo, rcv) == moo->_method);
di = get_dbgi_method(moo, rcv);
if (di)
{
retv = moo_oowtoint(moo, di->start_line);
if (!retv) return MOO_PF_FAILURE;
}
MOO_STACK_SETRET (moo, nargs,retv);
return MOO_PF_SUCCESS;
}
static moo_pfrc_t pf_method_get_source_text (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
{
moo_oop_method_t rcv;
moo_dbgi_method_t* di;
moo_oop_t retv = moo->_nil;
rcv = (moo_oop_method_t)MOO_STACK_GETRCV(moo, nargs);
MOO_PF_CHECK_RCV (moo, MOO_CLASSOF(moo, rcv) == moo->_method);
di = get_dbgi_method(moo, rcv);
if (di)
{
if (di->text_len > 0)
{
const moo_ooch_t* text_ptr;
text_ptr = (const moo_ooch_t*)((moo_uint8_t*)(di + 1) + di->text_start);
retv = moo_makestring(moo, text_ptr, di->text_len);
if (!retv) return MOO_PF_FAILURE;
}
}
MOO_STACK_SETRET (moo, nargs, retv);
return MOO_PF_SUCCESS; return MOO_PF_SUCCESS;
} }
@ -4067,6 +4079,7 @@ static pf_t pftab[] =
{ "CompiledMethod_ipSourceLine:", { pf_method_get_ip_source_line, 1, 1 } }, { "CompiledMethod_ipSourceLine:", { pf_method_get_ip_source_line, 1, 1 } },
{ "CompiledMethod_sourceFile", { pf_method_get_source_file, 0, 0 } }, { "CompiledMethod_sourceFile", { pf_method_get_source_file, 0, 0 } },
{ "CompiledMethod_sourceLine", { pf_method_get_source_line, 0, 0 } },
{ "CompiledMethod_sourceText", { pf_method_get_source_text, 0, 0 } }, { "CompiledMethod_sourceText", { pf_method_get_source_text, 0, 0 } },
{ "Error_asCharacter", { pf_error_as_character, 0, 0 } }, { "Error_asCharacter", { pf_error_as_character, 0, 0 } },

View File

@ -1670,9 +1670,8 @@ void moo_dumpsymtab (moo_t* moo);
void moo_dumpdic (moo_t* moo, moo_oop_dic_t dic, const moo_bch_t* title); void moo_dumpdic (moo_t* moo, moo_oop_dic_t dic, const moo_bch_t* title);
int moo_addfiletodbgi (moo_t* moo, const moo_ooch_t* file_name, moo_oow_t* start_offset); int moo_addfiletodbgi (moo_t* moo, const moo_ooch_t* file_name, moo_oow_t* start_offset);
int moo_addtexttodbgi (moo_t* moo, const moo_ooch_t* text_ptr, moo_oow_t text_len, moo_oow_t* start_offset);
int moo_addclasstodbgi (moo_t* moo, const moo_ooch_t* class_name, moo_oow_t file_offset, moo_oow_t file_line, moo_oow_t* start_offset); int moo_addclasstodbgi (moo_t* moo, const moo_ooch_t* class_name, moo_oow_t file_offset, moo_oow_t file_line, moo_oow_t* start_offset);
int moo_addmethodtodbgi (moo_t* moo, moo_oow_t file_offset, moo_oow_t class_offset, const moo_ooch_t* method_name, const moo_oow_t* code_loc_ptr, moo_oow_t code_loc_len, moo_oow_t* start_offset); int moo_addmethodtodbgi (moo_t* moo, moo_oow_t file_offset, moo_oow_t class_offset, const moo_ooch_t* method_name, moo_oow_t start_line, const moo_oow_t* code_loc_ptr, moo_oow_t code_loc_len, const moo_ooch_t* text_ptr, moo_oow_t text_len, moo_oow_t* start_offset);
/* ========================================================================= */ /* ========================================================================= */
/* comp.c */ /* comp.c */

View File

@ -555,9 +555,9 @@ struct moo_methsig_t
}; };
#if defined(MOO_USE_METHOD_TRAILER) #if defined(MOO_USE_METHOD_TRAILER)
# define MOO_METHOD_NAMED_INSTVARS 11 # define MOO_METHOD_NAMED_INSTVARS 9
#else #else
# define MOO_METHOD_NAMED_INSTVARS 12 # define MOO_METHOD_NAMED_INSTVARS 10
#endif #endif
typedef struct moo_method_t moo_method_t; typedef struct moo_method_t moo_method_t;
typedef struct moo_method_t* moo_oop_method_t; typedef struct moo_method_t* moo_oop_method_t;
@ -585,10 +585,8 @@ struct moo_method_t
moo_oop_byte_t code; /* ByteArray */ moo_oop_byte_t code; /* ByteArray */
#endif #endif
moo_oop_t dbi_text_offset; /* SmallInteger. Offset to source text in moo->dbgi. 0 if unavailable */ moo_oop_t dbgi_file_offset; /* SmallInteger. source file path that contains the definition of this method. offset from moo->dbgi. 0 if unavailable */
moo_oop_t dbi_file_offset; /* SmallInteger. source file path that contains the definition of this method. offset from moo->dbgi. 0 if unavailable */ moo_oop_t dbgi_method_offset; /* SmallInteger */
moo_oop_t source_line; /* SmallInteger. line of the source file where the method definition begins. valid only if dbi_file_offset is greater than 0 */
moo_oop_t dbi_method_offset; /* SmallInteger */
/* == variable indexed part == */ /* == variable indexed part == */
moo_oop_t literal_frame[1]; /* it stores literals */ moo_oop_t literal_frame[1]; /* it stores literals */
@ -984,22 +982,6 @@ struct moo_dbgi_file_t
/* ... file path here ... */ /* ... file path here ... */
}; };
typedef struct moo_dbgi_text_t moo_dbgi_text_t;
struct moo_dbgi_text_t
{
moo_oow_t _type;
moo_oow_t _len; /* length of this record including the header and the text payload */
moo_oow_t _next; /* offset to a previous text */
/*moo_oow_t _file;
moo_oow_t _line; */
moo_oow_t text_len;
/*moo_oow_t class_name_start; <--- needed for compaction.
moo_oow_t method_name_start; <--- needed for compaction */
/* ... text ... */
/* class name... */
/* method name ... */
};
typedef struct moo_dbgi_class_t moo_dbgi_class_t; typedef struct moo_dbgi_class_t moo_dbgi_class_t;
struct moo_dbgi_class_t struct moo_dbgi_class_t
{ {
@ -1019,8 +1001,11 @@ struct moo_dbgi_method_t
moo_oow_t _next; moo_oow_t _next;
moo_oow_t _file; moo_oow_t _file;
moo_oow_t _class; moo_oow_t _class;
moo_oow_t start_line;
moo_oow_t code_loc_start; /* start offset from the payload beginning within this record */ moo_oow_t code_loc_start; /* start offset from the payload beginning within this record */
moo_oow_t code_loc_len; moo_oow_t code_loc_len;
moo_oow_t text_start;
moo_oow_t text_len;
/* ... method name here ... */ /* ... method name here ... */
/* ... code line numbers here ... */ /* ... code line numbers here ... */
}; };