From 4b3e318428f29c28ce65a8293e5aa5416abc2bf1 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 8 Feb 2021 09:41:40 +0000 Subject: [PATCH] used hcl_openstdwithmmgr() in hcl-s.c and deleted unneeded code --- lib/hcl-s.c | 66 +++++++---------------------------------------------- lib/hcl.h | 7 ++++++ lib/std.c | 9 ++++++-- 3 files changed, 22 insertions(+), 60 deletions(-) diff --git a/lib/hcl-s.c b/lib/hcl-s.c index 78ae71b..462c978 100644 --- a/lib/hcl-s.c +++ b/lib/hcl-s.c @@ -41,12 +41,6 @@ #if defined(_WIN32) # include # include -# if defined(HCL_HAVE_CFG_H) && defined(HCL_ENABLE_LIBLTDL) -# include -# define USE_LTDL -# else -# define USE_WIN_DLL -# endif #elif defined(__OS2__) # define INCL_DOSMODULEMGR # define INCL_DOSPROCESS @@ -59,19 +53,6 @@ # include #else -# if defined(HCL_ENABLE_LIBLTDL) -# include -# define USE_LTDL -# elif defined(HAVE_DLFCN_H) -# include -# define USE_DLFCN -# elif defined(__APPLE__) || defined(__MACOSX__) -# define USE_MACH_O_DYLD -# include -# else -# error UNSUPPORTED DYNAMIC LINKER -# endif - # if defined(HAVE_TIME_H) # include # endif @@ -100,40 +81,6 @@ # include #endif -#if !defined(HCL_DEFAULT_PFMODDIR) -# define HCL_DEFAULT_PFMODDIR "" -#endif - -#if !defined(HCL_DEFAULT_PFMODPREFIX) -# if defined(_WIN32) -# define HCL_DEFAULT_PFMODPREFIX "hcl-" -# elif defined(__OS2__) -# define HCL_DEFAULT_PFMODPREFIX "hcl" -# elif defined(__DOS__) -# define HCL_DEFAULT_PFMODPREFIX "hcl" -# else -# define HCL_DEFAULT_PFMODPREFIX "libhcl-" -# endif -#endif - -#if !defined(HCL_DEFAULT_PFMODPOSTFIX) -# if defined(_WIN32) -# define HCL_DEFAULT_PFMODPOSTFIX "" -# elif defined(__OS2__) -# define HCL_DEFAULT_PFMODPOSTFIX "" -# elif defined(__DOS__) -# define HCL_DEFAULT_PFMODPOSTFIX "" -# else -# if defined(USE_DLFCN) -# define HCL_DEFAULT_PFMODPOSTFIX ".so" -# elif defined(USE_MACH_O_DYLD) -# define HCL_DEFAULT_PFMODPOSTFIX ".dylib" -# else -# define HCL_DEFAULT_PFMODPOSTFIX "" -# endif -# endif -#endif - struct bb_t { char buf[1024]; @@ -712,6 +659,7 @@ hcl_server_proto_t* hcl_server_proto_open (hcl_oow_t xtnsize, hcl_server_worker_ worker_hcl_xtn_t* xtn; hcl_bitmask_t trait; +#if 0 HCL_MEMSET (&vmprim, 0, HCL_SIZEOF(vmprim)); if (worker->server->cfg.trait & HCL_SERVER_TRAIT_USE_LARGE_PAGES) { @@ -728,6 +676,7 @@ hcl_server_proto_t* hcl_server_proto_open (hcl_oow_t xtnsize, hcl_server_worker_ vmprim.dl_getsym = hcl_vmprim_dl_getsym; vmprim.vm_gettime = hcl_vmprim_vm_gettime; vmprim.vm_sleep = hcl_vmprim_vm_sleep; +#endif proto = (hcl_server_proto_t*)hcl_server_allocmem(worker->server, HCL_SIZEOF(*proto)); if (!proto) return HCL_NULL; @@ -736,7 +685,12 @@ hcl_server_proto_t* hcl_server_proto_open (hcl_oow_t xtnsize, hcl_server_worker_ proto->worker = worker; proto->exec_runtime_event_index = HCL_TMR_INVALID_INDEX; - proto->hcl = hcl_open(hcl_server_getmmgr(proto->worker->server), HCL_SIZEOF(*xtn), worker->server->cfg.actor_heap_size, &vmprim, HCL_NULL); +#if 0 + /*proto->hcl = hcl_open(hcl_server_getmmgr(proto->worker->server), HCL_SIZEOF(*xtn), worker->server->cfg.actor_heap_size, &vmprim, HCL_NULL);*/ +#endif + /* TODO: set the log write handerl to log_write .. */ + /* TODO: LARGE_PAGES */ + proto->hcl = hcl_openstdwithmmgr(hcl_server_getmmgr(proto->worker->server), HCL_SIZEOF(*xtn), worker->server->cfg.actor_heap_size, HCL_NULL); if (!proto->hcl) goto oops; xtn = (worker_hcl_xtn_t*)hcl_getxtn(proto->hcl); @@ -1602,10 +1556,6 @@ hcl_server_t* hcl_server_open (hcl_mmgr_t* mmgr, hcl_oow_t xtnsize, hcl_server_p vmprim.vm_gettime = hcl_vmprim_vm_gettime; vmprim.vm_sleep = hcl_vmprim_vm_sleep; -#if defined(USE_LTDL) - lt_dlinit (); -#endif - hcl = hcl_open(mmgr, HCL_SIZEOF(*xtn), 2048, &vmprim, errnum); if (!hcl) goto oops; diff --git a/lib/hcl.h b/lib/hcl.h index 28b5c82..8db50b3 100644 --- a/lib/hcl.h +++ b/lib/hcl.h @@ -1746,6 +1746,13 @@ HCL_EXPORT hcl_t* hcl_open ( hcl_errnum_t* errnum ); +HCL_EXPORT hcl_t* hcl_openstdwithmmgr ( + hcl_mmgr_t* mmgr, + hcl_oow_t xtnsize, + hcl_oow_t heapsize, + hcl_errnum_t* errnum +); + HCL_EXPORT hcl_t* hcl_openstd ( hcl_oow_t xtnsize, hcl_oow_t heapsize, diff --git a/lib/std.c b/lib/std.c index cefc2d0..5b1463b 100644 --- a/lib/std.c +++ b/lib/std.c @@ -2868,7 +2868,7 @@ static void cb_vm_cleanup (hcl_t* hcl) * STANDARD HCL * ----------------------------------------------------------------- */ -hcl_t* hcl_openstd (hcl_oow_t xtnsize, hcl_oow_t heapsize, hcl_errnum_t* errnum) +hcl_t* hcl_openstdwithmmgr (hcl_mmgr_t* mmgr, hcl_oow_t xtnsize, hcl_oow_t heapsize, hcl_errnum_t* errnum) { hcl_t* hcl; hcl_vmprim_t vmprim; @@ -2895,7 +2895,7 @@ hcl_t* hcl_openstd (hcl_oow_t xtnsize, hcl_oow_t heapsize, hcl_errnum_t* errnum) vmprim.vm_muxwait = vm_muxwait; vmprim.vm_sleep = vm_sleep; - hcl = hcl_open(&sys_mmgr, HCL_SIZEOF(xtn_t) + xtnsize, heapsize, &vmprim, errnum); + hcl = hcl_open(mmgr, HCL_SIZEOF(xtn_t) + xtnsize, heapsize, &vmprim, errnum); if (HCL_UNLIKELY(!hcl)) return HCL_NULL; /* adjust the object size by the sizeof xtn_t so that moo_getxtn() returns the right pointer. */ @@ -2917,3 +2917,8 @@ hcl_t* hcl_openstd (hcl_oow_t xtnsize, hcl_oow_t heapsize, hcl_errnum_t* errnum) return hcl; } + +hcl_t* hcl_openstd (hcl_oow_t xtnsize, hcl_oow_t heapsize, hcl_errnum_t* errnum) +{ + return hcl_openstdwithmmgr(&sys_mmgr, xtnsize, heapsize, errnum); +}