From 5b87d26027f6a9df4d25ffd5dd43b64c805d651c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 26 Oct 2023 15:18:28 +0200 Subject: [PATCH] LibJIT+LibJS: Move JIT::Assembler into a new LibJIT library This will allow other parts of the system to generate machine code at runtime. :^) --- Meta/Lagom/CMakeLists.txt | 1 + Userland/Libraries/CMakeLists.txt | 1 + Userland/Libraries/{LibJS/JIT => LibJIT}/Assembler.cpp | 4 ++-- Userland/Libraries/{LibJS/JIT => LibJIT}/Assembler.h | 2 +- Userland/Libraries/LibJIT/CMakeLists.txt | 6 ++++++ Userland/Libraries/LibJS/CMakeLists.txt | 3 +-- Userland/Libraries/LibJS/JIT/Compiler.h | 4 +++- 7 files changed, 15 insertions(+), 6 deletions(-) rename Userland/Libraries/{LibJS/JIT => LibJIT}/Assembler.cpp (68%) rename Userland/Libraries/{LibJS/JIT => LibJIT}/Assembler.h (99%) create mode 100644 Userland/Libraries/LibJIT/CMakeLists.txt diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index 7b84ce6eb0..6b7b83e9fe 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -421,6 +421,7 @@ if (BUILD_LAGOM) IMAP ImageDecoderClient IPC + JIT JS Line Locale diff --git a/Userland/Libraries/CMakeLists.txt b/Userland/Libraries/CMakeLists.txt index 83c0cec63e..4c88547404 100644 --- a/Userland/Libraries/CMakeLists.txt +++ b/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) diff --git a/Userland/Libraries/LibJS/JIT/Assembler.cpp b/Userland/Libraries/LibJIT/Assembler.cpp similarity index 68% rename from Userland/Libraries/LibJS/JIT/Assembler.cpp rename to Userland/Libraries/LibJIT/Assembler.cpp index 2886e9f34c..f58017660a 100644 --- a/Userland/Libraries/LibJS/JIT/Assembler.cpp +++ b/Userland/Libraries/LibJIT/Assembler.cpp @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include -namespace JS::JIT { +namespace JIT { } diff --git a/Userland/Libraries/LibJS/JIT/Assembler.h b/Userland/Libraries/LibJIT/Assembler.h similarity index 99% rename from Userland/Libraries/LibJS/JIT/Assembler.h rename to Userland/Libraries/LibJIT/Assembler.h index b744ae2532..b5a376f4df 100644 --- a/Userland/Libraries/LibJS/JIT/Assembler.h +++ b/Userland/Libraries/LibJIT/Assembler.h @@ -8,7 +8,7 @@ #include -namespace JS::JIT { +namespace JIT { struct Assembler { Assembler(Vector& output) diff --git a/Userland/Libraries/LibJIT/CMakeLists.txt b/Userland/Libraries/LibJIT/CMakeLists.txt new file mode 100644 index 0000000000..37cdec2343 --- /dev/null +++ b/Userland/Libraries/LibJIT/CMakeLists.txt @@ -0,0 +1,6 @@ +set(SOURCES + Assembler.cpp +) + +serenity_lib(LibJIT jit) +target_link_libraries(LibJIT PRIVATE LibCore) diff --git a/Userland/Libraries/LibJS/CMakeLists.txt b/Userland/Libraries/LibJS/CMakeLists.txt index 19c058a06b..fba6268146 100644 --- a/Userland/Libraries/LibJS/CMakeLists.txt +++ b/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) diff --git a/Userland/Libraries/LibJS/JIT/Compiler.h b/Userland/Libraries/LibJS/JIT/Compiler.h index 37f23ac93e..edafd2797d 100644 --- a/Userland/Libraries/LibJS/JIT/Compiler.h +++ b/Userland/Libraries/LibJS/JIT/Compiler.h @@ -6,13 +6,15 @@ #pragma once +#include #include #include -#include #include namespace JS::JIT { +using ::JIT::Assembler; + class Compiler { public: static OwnPtr compile(Bytecode::Executable&);