diff --git a/bin/main.c b/bin/main.c index 687760c..cac769a 100644 --- a/bin/main.c +++ b/bin/main.c @@ -1164,7 +1164,7 @@ hcl_logufmt (hcl, HCL_LOG_WARN, fmt, ustr, 0x6789); #if 0 // TODO: change the option name // 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_getoption (hcl, HCL_TRAIT, &trait); diff --git a/lib/comp2.c b/lib/comp2.c index 5a02a55..e6ed05c 100644 --- a/lib/comp2.c +++ b/lib/comp2.c @@ -3108,7 +3108,7 @@ int hcl_compile2 (hcl_t* hcl, hcl_cnode_t* obj) * translated to base context objects instead. * * 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 * reference part of the literal frame reserved for a lambda function. * diff --git a/lib/exec.c b/lib/exec.c index 33574ee..2c08656 100644 --- a/lib/exec.c +++ b/lib/exec.c @@ -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; /* - * (defun sum (x) - * (if (< x 2) 1 - * else (+ x (sum (- x 1))))) - * (printf ">>>> %d\n" (sum 10)) + (defun sum (x) + (if (< x 2) 1 + else (+ x (sum (- x 1))))) + (printf ">>>> %d\n" (sum 10)) */ /* the receiver must be a function */ @@ -3645,6 +3645,7 @@ hcl_oop_t hcl_execute (hcl_t* hcl) #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); if (HCL_UNLIKELY(!func)) return HCL_NULL; diff --git a/lib/hcl.h b/lib/hcl.h index 31a3bff..a5fbd45 100644 --- a/lib/hcl.h +++ b/lib/hcl.h @@ -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_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_oop_function_t; @@ -552,6 +552,8 @@ struct hcl_function_t hcl_oop_t nargs; /* smooi. number of arguments */ hcl_oop_context_t home; /* home context. nil for the initial function */ + hcl_oop_t dbgi_file_offset; + /* == variable indexed part == */ 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_CLASS = 1, HCL_DBGI_TYPE_CODE_TEXT = 2, - /* TODO: interface? etc? */ HCL_DBGI_TYPE_CODE_METHOD = 3, /* method instruction location information */ /* low 8 bits */