@@ -38,10 +38,6 @@ public class JitManager {
3838
3939 private static Logger logger = LoggerFactory .getLogger (JitManager .class );
4040
41- static {
42- HybridSeLibrary .initCore ();
43- Engine .InitializeGlobalLLVM ();
44- }
4541
4642 // One jit currently only take one llvm module, since symbol may duplicate
4743 private static Map <String , HybridSeJitWrapper > jits = new HashMap <>();
@@ -112,17 +108,43 @@ private static synchronized void initModule(String tag, ByteBuffer moduleBuffer)
112108 initializedModuleTags .add (tag );
113109 }
114110
111+ public static synchronized void initCore () {
112+ HybridSeLibrary .initCore ();
113+ Engine .InitializeGlobalLLVM ();
114+ }
115+
116+ public static synchronized void initCore (String jsdkCoreLibraryPath ) {
117+ HybridSeLibrary .initCore (jsdkCoreLibraryPath );
118+ Engine .InitializeGlobalLLVM ();
119+ }
120+
115121 /**
116122 * Init llvm module specified by tag. Init native module with module byte buffer.
117123 *
118124 * @param tag tag specified a jit
119125 * @param moduleBuffer ByteBuffer used to initialize native module
120126 */
121127 public static synchronized void initJitModule (String tag , ByteBuffer moduleBuffer ) {
122-
123128 // ensure worker native
124129 HybridSeLibrary .initCore ();
125130
131+ // ensure worker side module
132+ if (!JitManager .hasModule (tag )) {
133+ JitManager .initModule (tag , moduleBuffer );
134+ }
135+ }
136+
137+ /**
138+ * Init llvm module specified by tag. Init native module with module byte buffer.
139+ *
140+ * @param tag tag specified a jit
141+ * @param moduleBuffer ByteBuffer used to initialize native module
142+ * @param jsdkCoreLibraryPath the file path of jsdk core library
143+ */
144+ public static synchronized void initJitModule (String tag , ByteBuffer moduleBuffer , String jsdkCoreLibraryPath ) {
145+ // ensure worker native
146+ HybridSeLibrary .initCore (jsdkCoreLibraryPath );
147+
126148 // ensure worker side module
127149 if (!JitManager .hasModule (tag )) {
128150 JitManager .initModule (tag , moduleBuffer );
0 commit comments