Skip to content

CoreCLR interpreter basic compilation and execution #112369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ include_directories("${GENERATED_INCLUDE_DIR}")
include_directories("hosts/inc")
include_directories("minipal")

add_subdirectory(interpreter)

if(CLR_CMAKE_TARGET_WIN32 AND FEATURE_EVENT_TRACE)
include_directories("${GENERATED_INCLUDE_DIR}/etw")
endif(CLR_CMAKE_TARGET_WIN32 AND FEATURE_EVENT_TRACE)
Expand Down
47 changes: 47 additions & 0 deletions src/coreclr/interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(INTERPRETER_SOURCES
compiler.cpp
compileropt.cpp
intops.cpp
eeinterp.cpp)

set(INTERPRETER_LINK_LIBRARIES
)

if(CLR_CMAKE_HOST_WIN32)
list(APPEND INTERPRETER_LINK_LIBRARIES
${STATIC_MT_CRT_LIB}
${STATIC_MT_VCRT_LIB}
)
endif(CLR_CMAKE_HOST_WIN32)

if(CLR_CMAKE_HOST_WIN32)
set(CLRINTERPRETER_EXPORTS ${CMAKE_CURRENT_LIST_DIR}/clrinterpreter.exports)
set(EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/clrinterpreter.def)
preprocess_file(${CLRINTERPRETER_EXPORTS} ${EXPORTS_FILE})
list(APPEND INTERPRETER_SOURCES ${EXPORTS_FILE})
add_custom_target(interpreter_exports DEPENDS ${EXPORTS_FILE})
else()
set(CLRINTERPRETER_EXPORTS ${CMAKE_CURRENT_LIST_DIR}/clrinterpreter_unixexports.src)
set(EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/clrinterpreter.exports)
generate_exports_file(${CLRINTERPRETER_EXPORTS} ${EXPORTS_FILE})
add_custom_target(interpreter_exports DEPENDS ${EXPORTS_FILE})
endif()

add_library_clr(clrinterpreter SHARED ${INTERPRETER_SOURCES})

add_dependencies(clrinterpreter interpreter_exports)

if(NOT CLR_CMAKE_HOST_WIN32)
set_exports_linker_option(${EXPORTS_FILE})
set_property(TARGET clrinterpreter APPEND_STRING PROPERTY LINK_FLAGS ${EXPORTS_LINKER_OPTION})
endif()

target_link_libraries(clrinterpreter
PRIVATE
${INTERPRETER_LINK_LIBRARIES}
)

set_property(TARGET clrinterpreter APPEND_STRING PROPERTY LINK_DEPENDS ${EXPORTS_FILE})

install_clr(TARGETS clrinterpreter DESTINATIONS . COMPONENT runtime)
5 changes: 5 additions & 0 deletions src/coreclr/interpreter/clrinterpreter.exports
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
; Licensed to the .NET Foundation under one or more agreements.
; The .NET Foundation licenses this file to you under the MIT license.
EXPORTS
getJit
jitStartup
2 changes: 2 additions & 0 deletions src/coreclr/interpreter/clrinterpreter_unixexports.src
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
getJit
jitStartup
Loading
Loading