Browse Source

LibJIT+LibJS: Move JIT::Assembler into a new LibJIT library

This will allow other parts of the system to generate machine code
at runtime. :^)
Andreas Kling 1 year ago
parent
commit
5b87d26027

+ 1 - 0
Meta/Lagom/CMakeLists.txt

@@ -421,6 +421,7 @@ if (BUILD_LAGOM)
         IMAP
         ImageDecoderClient
         IPC
+        JIT
         JS
         Line
         Locale

+ 1 - 0
Userland/Libraries/CMakeLists.txt

@@ -33,6 +33,7 @@ add_subdirectory(LibIDL)
 add_subdirectory(LibIMAP)
 add_subdirectory(LibImageDecoderClient)
 add_subdirectory(LibIPC)
+add_subdirectory(LibJIT)
 add_subdirectory(LibJS)
 add_subdirectory(LibKeyboard)
 add_subdirectory(LibLine)

+ 2 - 2
Userland/Libraries/LibJS/JIT/Assembler.cpp → Userland/Libraries/LibJIT/Assembler.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
-#include <LibJS/JIT/Assembler.h>
+#include <LibJIT/Assembler.h>
 
-namespace JS::JIT {
+namespace JIT {
 
 }

+ 1 - 1
Userland/Libraries/LibJS/JIT/Assembler.h → Userland/Libraries/LibJIT/Assembler.h

@@ -8,7 +8,7 @@
 
 #include <AK/Vector.h>
 
-namespace JS::JIT {
+namespace JIT {
 
 struct Assembler {
     Assembler(Vector<u8>& output)

+ 6 - 0
Userland/Libraries/LibJIT/CMakeLists.txt

@@ -0,0 +1,6 @@
+set(SOURCES
+    Assembler.cpp
+)
+
+serenity_lib(LibJIT jit)
+target_link_libraries(LibJIT PRIVATE LibCore)

+ 1 - 2
Userland/Libraries/LibJS/CMakeLists.txt

@@ -24,7 +24,6 @@ set(SOURCES
     Heap/Heap.cpp
     Heap/HeapBlock.cpp
     Heap/MarkedVector.cpp
-    JIT/Assembler.cpp
     JIT/Compiler.cpp
     JIT/NativeExecutable.cpp
     Lexer.cpp
@@ -268,4 +267,4 @@ set(SOURCES
 )
 
 serenity_lib(LibJS js)
-target_link_libraries(LibJS PRIVATE LibCore LibCrypto LibFileSystem LibRegex LibSyntax LibLocale LibUnicode)
+target_link_libraries(LibJS PRIVATE LibCore LibCrypto LibFileSystem LibRegex LibSyntax LibLocale LibUnicode LibJIT)

+ 3 - 1
Userland/Libraries/LibJS/JIT/Compiler.h

@@ -6,13 +6,15 @@
 
 #pragma once
 
+#include <LibJIT/Assembler.h>
 #include <LibJS/Bytecode/Executable.h>
 #include <LibJS/Bytecode/Op.h>
-#include <LibJS/JIT/Assembler.h>
 #include <LibJS/JIT/NativeExecutable.h>
 
 namespace JS::JIT {
 
+using ::JIT::Assembler;
+
 class Compiler {
 public:
     static OwnPtr<NativeExecutable> compile(Bytecode::Executable&);