preparing to produce debug information

This commit is contained in:
hyung-hwan 2021-01-26 10:10:18 +00:00
parent 1a0594ac3f
commit 8829e27c33
4 changed files with 10 additions and 8 deletions

View File

@ -1164,7 +1164,7 @@ hcl_logufmt (hcl, HCL_LOG_WARN, fmt, ustr, 0x6789);
#if 0 #if 0
// TODO: change the option name // TODO: change the option name
// in the INTERACTIVE mode, the compiler generates MAKE_FUNCTION for lambda functions. // in the INTERACTIVE mode, the compiler generates MAKE_FUNCTION for lambda functions.
// in the non-INTERACTIVE mode, the compiler generates MAKE_CONTEXT for lambda functions. // in the non-INTERACTIVE mode, the compiler generates MAKE_BLOCK for lambda functions.
{ {
hcl_bitmask_t trait; hcl_bitmask_t trait;
hcl_getoption (hcl, HCL_TRAIT, &trait); hcl_getoption (hcl, HCL_TRAIT, &trait);

View File

@ -3108,7 +3108,7 @@ int hcl_compile2 (hcl_t* hcl, hcl_cnode_t* obj)
* translated to base context objects instead. * translated to base context objects instead.
* *
* In the INTERACTIVE mode, the literal frame base plays a key role. * In the INTERACTIVE mode, the literal frame base plays a key role.
* hcl_compile() is called for the top-level expression andthe literal * hcl_compile() is called for the top-level expression and the literal
* frame base can be 0. The means it is ok for a top-level code to * frame base can be 0. The means it is ok for a top-level code to
* reference part of the literal frame reserved for a lambda function. * reference part of the literal frame reserved for a lambda function.
* *

View File

@ -1807,10 +1807,10 @@ static int __activate_function (hcl_t* hcl, hcl_oop_function_t rcv_func, hcl_ooi
hcl_ooi_t local_ntmprs, i; hcl_ooi_t local_ntmprs, i;
/* /*
* (defun sum (x) (defun sum (x)
* (if (< x 2) 1 (if (< x 2) 1
* else (+ x (sum (- x 1))))) else (+ x (sum (- x 1)))))
* (printf ">>>> %d\n" (sum 10)) (printf ">>>> %d\n" (sum 10))
*/ */
/* the receiver must be a function */ /* the receiver must be a function */
@ -3645,6 +3645,7 @@ hcl_oop_t hcl_execute (hcl_t* hcl)
#endif #endif
} }
/* create a virtual function object that hold the bytes codes generated */
func = make_function(hcl, hcl->code.lit.len, hcl->code.bc.ptr, hcl->code.bc.len); func = make_function(hcl, hcl->code.lit.len, hcl->code.bc.ptr, hcl->code.bc.len);
if (HCL_UNLIKELY(!func)) return HCL_NULL; if (HCL_UNLIKELY(!func)) return HCL_NULL;

View File

@ -532,7 +532,7 @@ struct hcl_fpdec_t
#define HCL_FUNCTION_GET_CODE_BYTE(m) HCL_OBJ_GET_TRAILER_BYTE(m) #define HCL_FUNCTION_GET_CODE_BYTE(m) HCL_OBJ_GET_TRAILER_BYTE(m)
#define HCL_FUNCTION_GET_CODE_SIZE(m) HCL_OBJ_GET_TRAILER_SIZE(m) #define HCL_FUNCTION_GET_CODE_SIZE(m) HCL_OBJ_GET_TRAILER_SIZE(m)
#define HCL_FUNCTION_NAMED_INSTVARS 3 /* this excludes literal frames and byte codes */ #define HCL_FUNCTION_NAMED_INSTVARS 4 /* this excludes literal frames and byte codes */
typedef struct hcl_function_t hcl_function_t; typedef struct hcl_function_t hcl_function_t;
typedef struct hcl_function_t* hcl_oop_function_t; typedef struct hcl_function_t* hcl_oop_function_t;
@ -552,6 +552,8 @@ struct hcl_function_t
hcl_oop_t nargs; /* smooi. number of arguments */ hcl_oop_t nargs; /* smooi. number of arguments */
hcl_oop_context_t home; /* home context. nil for the initial function */ hcl_oop_context_t home; /* home context. nil for the initial function */
hcl_oop_t dbgi_file_offset;
/* == variable indexed part == */ /* == variable indexed part == */
hcl_oop_t literal_frame[1]; /* it stores literals. it may not exist */ hcl_oop_t literal_frame[1]; /* it stores literals. it may not exist */
@ -838,7 +840,6 @@ enum hcl_dbgi_type_t
HCL_DBGI_TYPE_CODE_FILE = 0, HCL_DBGI_TYPE_CODE_FILE = 0,
HCL_DBGI_TYPE_CODE_CLASS = 1, HCL_DBGI_TYPE_CODE_CLASS = 1,
HCL_DBGI_TYPE_CODE_TEXT = 2, HCL_DBGI_TYPE_CODE_TEXT = 2,
/* TODO: interface? etc? */
HCL_DBGI_TYPE_CODE_METHOD = 3, /* method instruction location information */ HCL_DBGI_TYPE_CODE_METHOD = 3, /* method instruction location information */
/* low 8 bits */ /* low 8 bits */