diff --git a/include/clasp/core/configure_clasp.h b/include/clasp/core/configure_clasp.h index 340615b9d4..2e5a37f28e 100644 --- a/include/clasp/core/configure_clasp.h +++ b/include/clasp/core/configure_clasp.h @@ -79,7 +79,7 @@ THE SOFTWARE. #error "We are sorry but this address model is not supported yet." #endif -#if defined( _TARGET_OS_DARWIN ) && defined( __arm64__ ) +#if defined( _TARGET_OS_DARWIN ) && defined( __aarch64__ ) # define CLASP_APPLE_SILICON 1 #endif @@ -96,8 +96,12 @@ THE SOFTWARE. #if defined( _ADDRESS_MODEL_64 ) -#define GCROOTS_IN_MODULE_NAME "__clasp_gcroots_in_module_" -#define LITERALS_NAME "__clasp_literals_" +#define __EX(var) #var +#define CXX_MACRO_STRING(var) __EX(var) +#define CLASP_GCROOTS_IN_MODULE(NAME) __clasp_gcroots_in_module_ ## NAME +#define GCROOTS_IN_MODULE_NAME CXX_MACRO_STRING(CLASP_GCROOTS_IN_MODULE()) +#define CLASP_LITERALS(NAME) __clasp_literals_ ## NAME +#define LITERALS_NAME CXX_MACRO_STRING(CLASP_LITERALS()) #define INTPTR_BITS 64 typedef uint64_t bit_array_word; // "word" for bit array purposes (see gcbitarray.h) diff --git a/include/clasp/core/lispCallingConvention.h b/include/clasp/core/lispCallingConvention.h index cda632ff5c..5f390d6916 100644 --- a/include/clasp/core/lispCallingConvention.h +++ b/include/clasp/core/lispCallingConvention.h @@ -92,7 +92,7 @@ LCC_RETURN_RAW general_entry_point_redirect_7(core::T_O* closure, core::T_O* far /*! This is X86_64 dependent code */ -#if (defined(X86_64) || defined(ARM64)) && defined(_ADDRESS_MODEL_64) +#if defined(__x86_64__) || defined(__aarch64__) // This is VERY HACKISH // it's based on the System V Application Binary Interface for X86_64 diff --git a/src/core/corePackage.cc b/src/core/corePackage.cc index 0d94c71afd..4e10db51a6 100644 --- a/src/core/corePackage.cc +++ b/src/core/corePackage.cc @@ -1235,73 +1235,78 @@ void CoreExposer_O::define_essential_globals(LispPtr lisp) { _sym_STARdebugVaslistSTAR->defparameter(nil()); _sym_STARdebug_dtree_interpreterSTAR->defparameter(nil()); _sym_STARdebug_symbol_lookupSTAR->defparameter(nil()); -#if defined(__x86_64__) - SYMBOL_EXPORT_SC_(KeywordPkg, 64_bit); - Symbol_sp address_model = kw::_sym_64_bit; -#if defined(__APPLE__) && defined(__MACH__) -#include - -#if TARGET_OS_IPHONE == 1 -#error Currently iPhone simulator and iOS are not supported -#elif TARGET_OS_MAC == 1 - - SYMBOL_EXPORT_SC_(KeywordPkg, target_os_darwin); - Symbol_sp target_os = kw::_sym_target_os_darwin; - -#else -#error Your TargetConditionals.h file says you are not a Mac or iPhone????? + List_sp features = nil(); + features = Cons_O::create(_lisp->internKeyword("CLASP"), features); + features = Cons_O::create(_lisp->internKeyword("COMMON-LISP"), features); + features = Cons_O::create(_lisp->internKeyword("ANSI-CL"), features); + features = Cons_O::create(_lisp->internKeyword("IEEE-FLOATING-POINT"), features); + features = Cons_O::create(_lisp->internKeyword("64-BIT"), features); +#ifdef _TARGET_OS_DARWIN + features = Cons_O::create(_lisp->internKeyword("UNIX"), features); + features = Cons_O::create(_lisp->internKeyword("OS-UNIX"), features); + features = Cons_O::create(_lisp->internKeyword("BSD"), features); + features = Cons_O::create(_lisp->internKeyword("DARWIN"), features); #endif - -#elif defined(__linux__) - - SYMBOL_EXPORT_SC_(KeywordPkg, target_os_linux); - Symbol_sp target_os = kw::_sym_target_os_linux; - -#elif defined(__FreeBSD__) - - SYMBOL_EXPORT_SC_(KeywordPkg, target_os_freebsd); - Symbol_sp target_os = kw::_sym_target_os_freebsd; - -#elif defined(CLASP_APPLE_SILICON) -#error "__arm__ is defined" -#else -#error Currently only MacOSX, linux and FreeBSD are supported for x86_64 +#ifdef _TARGET_OS_LINUX + features = Cons_O::create(_lisp->internKeyword("UNIX"), features); + features = Cons_O::create(_lisp->internKeyword("OS-UNIX"), features); + features = Cons_O::create(_lisp->internKeyword("LINUX"), features); #endif - -#elif defined(__i386__) - - SYMBOL_EXPORT_SC_(KeywordPkg, 32_bit); - Symbol_sp address_model = kw::_sym_32_bit; - -#if defined(__linux__) - - SYMBOL_EXPORT_SC_(KeywordPkg, target_os_linux); - Symbol_sp target_os = kw::_sym_target_os_linux; - -#else -#error Currently only linux is supported for i386 +#ifdef _TARGET_OS_FREEBSD + features = Cons_O::create(_lisp->internKeyword("UNIX"), features); + features = Cons_O::create(_lisp->internKeyword("OS-UNIX"), features); + features = Cons_O::create(_lisp->internKeyword("BSD"), features); + features = Cons_O::create(_lisp->internKeyword("FREEBSD"), features); #endif - -#elif defined(CLASP_APPLE_SILICON) - - SYMBOL_EXPORT_SC_(KeywordPkg, target_os_darwin); - Symbol_sp target_os = kw::_sym_target_os_darwin; - SYMBOL_EXPORT_SC_(KeywordPkg, 64_bit); - Symbol_sp address_model = kw::_sym_64_bit; - -#else -#error Currently only x86_64 and i386 is supported +#ifdef __x86_64__ + features = Cons_O::create(_lisp->internKeyword("X86-64"), features); #endif - - ql::list features; - features << target_os; - features << address_model; - - // Now add other standard features - // features << kw::_sym_brcl; - - cl::_sym_STARfeaturesSTAR->exportYourself()->defparameter(features.cons()); +#ifdef __aarch64__ + features = Cons_O::create(_lisp->internKeyword("ARM64"), features); +#endif +#ifdef CLASP_UNICODE + features = Cons_O::create(_lisp->internKeyword("UNICODE"), features); +#endif + features = Cons_O::create(_lisp->internKeyword("LLVM" CXX_MACRO_STRING(__clang_major__)), features); +#ifdef VARARGS + features = Cons_O::create(_lisp->internKeyword("VARARGS"), features); +#endif +#ifdef POLYMORPHIC_SMART_PTR + features = Cons_O::create(_lisp->internKeyword("POLYMORPHIC-SMART-PTR"), features); +#endif +#ifdef _DEBUG_BUILD + features = Cons_O::create(_lisp->internKeyword("DEBUG-BUILD"), features); +#else // _RELEASE_BUILD + features = Cons_O::create(_lisp->internKeyword("RELEASE-BUILD"), features); +#endif +#ifdef USE_MPI + features = Cons_O::create(_lisp->internKeyword("USE-MPI"), features); +#endif +#if defined(USE_BOEHM) + features = Cons_O::create(_lisp->internKeyword("USE-BOEHM"), features); +#elif defined(USE_MPS) + features = Cons_O::create(_lisp->internKeyword("USE-MPS"), features); +#elif defined(USE_MMTK) + features = Cons_O::create(_lisp->internKeyword("USE-MMTK"), features); +#endif +#ifdef USE_PRECISE_GC + // Informs CL that precise GC is being used + features = Cons_O::create(_lisp->internKeyword("USE-PRECISE-GC"), features); +#endif +#ifdef CLASP_THREADS + features = Cons_O::create(_lisp->internKeyword("THREADS"),features); +#endif +#if TAG_BITS==4 + features = Cons_O::create(_lisp->internKeyword("TAG-BITS4"),features); +#endif +#ifdef CLASP_EXTENSIONS + features = Cons_O::create(_lisp->internKeyword("EXTENSIONS"),features); +#endif +#if CLASP_BUILD_MODE == 6 + features = Cons_O::create(_lisp->internKeyword("BYTECODE"), features); +#endif + cl::_sym_STARfeaturesSTAR->exportYourself()->defparameter(features); } void add_defsetf_access_update(Symbol_sp access_fn, Symbol_sp update_fn) { diff --git a/src/core/cscript.lisp b/src/core/cscript.lisp index e570da7342..ad277e4fac 100644 --- a/src/core/cscript.lisp +++ b/src/core/cscript.lisp @@ -113,3 +113,6 @@ #~"hwinfo.cc" #~"clasp_ffi_package.cc" #~"fli.cc") + +(k:sources :trampoline + #~"trampoline/trampoline.cc") diff --git a/src/core/lisp.cc b/src/core/lisp.cc index b27b051590..6d4f9fc4e8 100644 --- a/src/core/lisp.cc +++ b/src/core/lisp.cc @@ -599,77 +599,6 @@ void Lisp::startupLispEnvironment() { gctools::initialize_unix_signal_handlers(); this->_Booted = true; - List_sp features = cl::_sym_STARfeaturesSTAR->symbolValue(); - features = Cons_O::create(_lisp->internKeyword("CLASP"), features); - features = Cons_O::create(_lisp->internKeyword("COMMON-LISP"), features); - features = Cons_O::create(_lisp->internKeyword("ANSI-CL"), features); - features = Cons_O::create(_lisp->internKeyword("IEEE-FLOATING-POINT"), features); -#ifdef _TARGET_OS_DARWIN - features = Cons_O::create(_lisp->internKeyword("DARWIN"), features); - features = Cons_O::create(_lisp->internKeyword("BSD"), features); - features = Cons_O::create(_lisp->internKeyword("OS-UNIX"), features); - features = Cons_O::create(_lisp->internKeyword("UNIX"), features); -#endif -#ifdef _TARGET_OS_LINUX - features = Cons_O::create(_lisp->internKeyword("UNIX"), features); - features = Cons_O::create(_lisp->internKeyword("OS-UNIX"), features); - features = Cons_O::create(_lisp->internKeyword("LINUX"), features); -#endif -#ifdef _TARGET_OS_FREEBSD - features = Cons_O::create(_lisp->internKeyword("UNIX"), features); - features = Cons_O::create(_lisp->internKeyword("OS-UNIX"), features); - features = Cons_O::create(_lisp->internKeyword("FREEBSD"), features); - features = Cons_O::create(_lisp->internKeyword("BSD"), features); -#endif -#ifdef X86_64 - features = Cons_O::create(_lisp->internKeyword("X86-64"), features); -#endif -#ifdef ARM64 - features = Cons_O::create(_lisp->internKeyword("ARM64"), features); -#endif -#ifdef CLASP_UNICODE - features = Cons_O::create(_lisp->internKeyword("UNICODE"), features); -#endif - features = Cons_O::create(_lisp->internKeyword("LLVM" CXX_MACRO_STRING(__clang_major__)), features); -#ifdef VARARGS - features = Cons_O::create(_lisp->internKeyword("VARARGS"), features); -#endif -#ifdef POLYMORPHIC_SMART_PTR - features = Cons_O::create(_lisp->internKeyword("POLYMORPHIC-SMART-PTR"), features); -#endif -#ifdef _DEBUG_BUILD - features = Cons_O::create(_lisp->internKeyword("DEBUG-BUILD"), features); -#else // _RELEASE_BUILD - features = Cons_O::create(_lisp->internKeyword("RELEASE-BUILD"), features); -#endif -#ifdef USE_MPI - features = Cons_O::create(_lisp->internKeyword("USE-MPI"), features); -#endif -#if defined(USE_BOEHM) - features = Cons_O::create(_lisp->internKeyword("USE-BOEHM"), features); -#elif defined(USE_MPS) - features = Cons_O::create(_lisp->internKeyword("USE-MPS"), features); -#elif defined(USE_MMTK) - features = Cons_O::create(_lisp->internKeyword("USE-MMTK"), features); -#endif -#ifdef USE_PRECISE_GC - // Informs CL that precise GC is being used - features = Cons_O::create(_lisp->internKeyword("USE-PRECISE-GC"), features); -#endif -#ifdef CLASP_THREADS - features = Cons_O::create(_lisp->internKeyword("THREADS"),features); -#endif -#if TAG_BITS==4 - features = Cons_O::create(_lisp->internKeyword("TAG-BITS4"),features); -#endif -#ifdef CLASP_EXTENSIONS - features = Cons_O::create(_lisp->internKeyword("EXTENSIONS"),features); -#endif -#if CLASP_BUILD_MODE == 6 - features = Cons_O::create(_lisp->internKeyword("BYTECODE"), features); -#endif - cl::_sym_STARfeaturesSTAR->setf_symbolValue(features); - globals_->_InitFileName = "sys:src;lisp;" KERNEL_NAME ";init.lisp"; } diff --git a/src/core/trampoline/makefile b/src/core/trampoline/makefile deleted file mode 100644 index 3d3d92bdb4..0000000000 --- a/src/core/trampoline/makefile +++ /dev/null @@ -1,21 +0,0 @@ - -UNAME=$(shell uname) - -ifeq ($(UNAME), Linux) -DIR=/usr/bin -CLANG=$(DIR)/clang++-14 -DIS=$(DIR)/llvm-dis-14 -endif -ifeq ($(UNAME), Darwin) -DIR=/usr/local/opt/llvm@14/bin -CLANG=$(DIR)/clang++ -DIS=$(DIR)/llvm-dis -endif - -all: - $(CLANG) -c -emit-llvm -O3 -g -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer trampoline.cc - $(DIS) -o=trampoline-raw.ll trampoline.bc - tail --lines=+5 trampoline-raw.ll >trampoline.ll - - -# $(CLANG) -c -emit-llvm -O3 -g -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer trampoline.cc diff --git a/src/core/trampoline/trampoline.cc b/src/core/trampoline/trampoline.cc index 4e3269aad2..c7a18c2821 100644 --- a/src/core/trampoline/trampoline.cc +++ b/src/core/trampoline/trampoline.cc @@ -1,119 +1,48 @@ - -/* - This file generates trampoline function llvm-IR that can be edited to generate stackmaps. - - Compile this file with the following command... - - - clang++-14 -c -emit-llvm -g -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer trampoline.cc - llvm-dis-14 trampoline.bc - - Then make the following changes to the trampoline.ll file and insert it into llvmoPackage.cc: - -meister@zeus:~/Development/test$ diff -u trampoline.ll trampoline-done.ll ---- trampoline.ll 2022-09-05 15:58:15.961365240 -0400 -+++ trampoline-done.ll 2022-09-05 15:57:47.576558426 -0400 -@@ -1,13 +1,19 @@ -+ -+ - ; ModuleID = 'trampoline.bc' - source_filename = "trampoline.cc" - target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" - target triple = "x86_64-pc-linux-gnu" - -+@__clasp_gcroots_in_module_trampoline = internal global { i64, i8*, i64, i64, i8**, i64 } zeroinitializer -+@__clasp_literals_trampoline = internal global [0 x i8*] zeroinitializer -+ - @_ZL16global_save_args = internal unnamed_addr global i64* null, align 8, !dbg !0 - -@@ -41,6 +46,7 @@ - ; Function Attrs: mustprogress uwtable - define dso_local { i8*, i64 } @bytecode_trampoline_with_stackmap({ i8*, i64 } (i64, i8*, i64, i8**)* nocapture noundef readonly %0, i64 noundef %1, i8* noundef %2, i64 noundef %3, i8** noundef %4) local_unnamed_addr #0 !dbg !145 { - %6 = alloca [3 x i64], align 16 -+ call void (i64, i32, ...) @llvm.experimental.stackmap(i64 3735879680, i32 0, [3 x i64]* nonnull %6) - call void @llvm.dbg.value(metadata { i8*, i64 } (i64, i8*, i64, i8**)* %0, metadata !153, metadata !DIExpression()), !dbg !159 - call void @llvm.dbg.value(metadata i64 %1, metadata !154, metadata !DIExpression()), !dbg !159 - call void @llvm.dbg.value(metadata i8* %2, metadata !155, metadata !DIExpression()), !dbg !159 - -... - -- store i64* %7, i64** @_ZL16global_save_args, align 8, !dbg !129, !tbaa !130 - -@@ -64,18 +70,21 @@ - } - - - ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone uwtable willreturn --define dso_local void @CLASP_STARTUP_trampoline() local_unnamed_addr #3 !dbg !173 { -+define dso_local void @"CLASP_STARTUP_trampoline"() local_unnamed_addr #3 !dbg !173 { - ret void, !dbg !177 - } - - ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn - declare void @llvm.dbg.value(metadata, metadata, metadata) #1 - -+declare void @llvm.experimental.stackmap(i64, i32, ...) #5 -+ - attributes #0 = { mustprogress uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } - attributes #1 = { nofree nosync nounwind readnone speculatable willreturn } - attributes #2 = { argmemonly nofree nosync nounwind willreturn } - attributes #3 = { mustprogress nofree norecurse nosync nounwind readnone uwtable willreturn "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } - attributes #4 = { nounwind } -+attributes #5 = { nofree nosync willreturn } - - !llvm.dbg.cu = !{!2} - !llvm.module.flags = !{!96, !97, !98, !99, !100, !101, !102} -@@ -259,3 +268,5 @@ - !175 = !{null} - !176 = !{} - !177 = !DILocation(line: 42, column: 3, scope: !173) -+ -+ -*/ - - #include +#include +#include #define MAGIC 3735879680 struct Gcroots { uint64_t val1; - void* val2; + void *val2; uint64_t val3; uint64_t val4; - void** val5; + void **val5; uint64_t val6; }; struct return_type { - void* _ptr; + void *_ptr; uint64_t _nvals; -return_type(void* ptr, uint64_t nvals) : _ptr(ptr), _nvals(nvals) {}; + return_type(void *ptr, uint64_t nvals) : _ptr(ptr), _nvals(nvals){}; }; -typedef uint64_t* save_args; +typedef uint64_t *save_args; -typedef return_type (bytecode_trampoline_type)(uint64_t pc, void* closure, uint64_t nargs, void** args); +typedef return_type(bytecode_trampoline_type)(uint64_t pc, void *closure, uint64_t nargs, void **args); extern "C" { - Gcroots CLASP_GCROOTS[0]; - void* CLASP_LITERALS[0]; - - void LLVM_EXPERIMENTAL_STACKMAP( uint64_t type, uint32_t dummy, ... ); +Gcroots CLASP_GCROOTS_IN_MODULE(trampoline)[0]; +void *CLASP_LITERALS(trampoline)[0]; + +// Use asm and nodebug to add declaration for the LLVM intrinsic. +__attribute__((nodebug)) void LLVM_EXPERIMENTAL_STACKMAP(uint64_t type, uint32_t dummy, ...) asm("llvm.experimental.stackmap"); - return_type bytecode_call( uint64_t pc, void* closure, uint64_t nargs, void** args); +return_type bytecode_call(uint64_t pc, void *closure, uint64_t nargs, void **args); - return_type WRAPPER_NAME_trampoline( uint64_t pc, void* closure, uint64_t nargs, void** args) { - uint64_t trampoline_save_args[3]; - LLVM_EXPERIMENTAL_STACKMAP( (uint64_t)MAGIC, 0, &trampoline_save_args ); - trampoline_save_args[0] = (uintptr_t)closure; - trampoline_save_args[1] = (uintptr_t)nargs; - trampoline_save_args[2] = (uintptr_t)args; - return bytecode_call(pc,closure,nargs,args); - } +// The wrapper name may have a scope resolution operator which would require quotes so we use asm with colon to ensure the name is +// quoted in the bitcode. +return_type WRAPPER_NAME(uint64_t pc, void *closure, uint64_t nargs, void **args) asm("wrapper:name"); - void CLASP_STARTUP() - { - }; +return_type WRAPPER_NAME(uint64_t pc, void *closure, uint64_t nargs, void **args) { + uint64_t trampoline_save_args[3]; + LLVM_EXPERIMENTAL_STACKMAP((uint64_t)MAGIC, 0, &trampoline_save_args); + trampoline_save_args[0] = (uintptr_t)closure; + trampoline_save_args[1] = (uintptr_t)nargs; + trampoline_save_args[2] = (uintptr_t)args; + return bytecode_call(pc, closure, nargs, args); +} }; diff --git a/src/gctools/interrupt.cc b/src/gctools/interrupt.cc index 4fbd8f7f9e..c887701cb0 100644 --- a/src/gctools/interrupt.cc +++ b/src/gctools/interrupt.cc @@ -3,7 +3,7 @@ #if defined(__i386__) || defined(__x86_64__) # include #endif -#ifdef __arm64__ +#ifdef __aarch64__ #include #include #endif @@ -333,7 +333,7 @@ DOCGROUP(clasp); CL_DEFUN void core__disable_all_fpe_masks() { #if defined(__i386__) || defined(__x86_64__) _MM_SET_EXCEPTION_MASK(_MM_MASK_MASK); -#elif defined(__arm64__) +#elif defined(__aarch64__) std::fenv_t env; std::feholdexcept(&env); #else @@ -362,7 +362,7 @@ CL_DEFUN void core__enable_fpe_masks(core::T_sp underflow, core::T_sp overflow, _mm_setcsr(_mm_getcsr() & (~ _MM_MASK_DIV_ZERO)); if (denormalized_operand.notnilp()) _mm_setcsr(_mm_getcsr() & (~ _MM_MASK_DENORM)); -#elif defined(__arm64__) +#elif defined(CLASP_APPLE_SILICON) std::fenv_t env; std::fegetenv(&env); env.__fpcr = (underflow.notnilp() ? __fpcr_trap_underflow : 0) | (overflow.notnilp() ? __fpcr_trap_overflow : 0) | @@ -380,7 +380,7 @@ CL_DEFUN core::Fixnum_sp core__get_current_fpe_mask() { #if defined(__i386__) || defined(__x86_64__) unsigned int before = _MM_GET_EXCEPTION_MASK (); return core::clasp_make_fixnum(before); -#elif defined(__arm64__) +#elif defined(__aarch64__) std::fenv_t env; std::fegetenv(&env); return core::clasp_make_fixnum(env.__fpcr); @@ -395,7 +395,7 @@ CL_DEFUN void core__set_current_fpe_mask(core::Fixnum_sp mask) { Fixnum value = core::unbox_fixnum(mask); #if defined(__i386__) || defined(__x86_64__) _MM_SET_EXCEPTION_MASK(value); -#elif defined(__arm64__) +#elif defined(__aarch64__) std::fenv_t env; std::fegetenv(&env); env.__fpcr = value; diff --git a/src/koga/config-header.lisp b/src/koga/config-header.lisp index e343584f3c..52ef049925 100644 --- a/src/koga/config-header.lisp +++ b/src/koga/config-header.lisp @@ -42,8 +42,6 @@ "INCLUDED_FROM_CLASP" t "INHERITED_FROM_SRC" t "NDEBUG" t - "X86_64" (and (member :x86-64 *features*) t) - "ARM64" (and (member :arm64 *features*) t) "BUILD_EXTENSION" (and (extensions configuration) t) "DEFAULT_STARTUP_TYPE" (if (extensions configuration) :|cloExtensionImage| :|cloBaseImage|) "CLASP_EXTENSIONS" (and (extensions configuration) t) diff --git a/src/koga/configure.lisp b/src/koga/configure.lisp index e22eaea52e..964a2809e7 100644 --- a/src/koga/configure.lisp +++ b/src/koga/configure.lisp @@ -513,6 +513,11 @@ :initform nil :type (or null pathname) :documentation "The cxx binary to use. If not set then llvm-config will be used to find clang++.") + (dis :accessor dis + :initarg :dis + :initform nil + :type (or null pathname) + :documentation "The llvm-dis binary to use. If not set then llvm-config will be used to find llvm-dis.") (git :accessor git :initarg :git :initform nil @@ -612,11 +617,14 @@ is not compatible with snapshots.") :documentation "Default stage for installation") (units :accessor units :initform '(:git :describe :cpu-count #+darwin :xcode :base :default-target :pkg-config - :clang :llvm :ar :cc :cxx :mpi :nm :etags :ctags :objcopy :jupyter :reproducible :asdf) + :clang :llvm :ar :cc :cxx :dis :mpi :nm :etags :ctags :objcopy :jupyter + :reproducible :asdf) :type list :documentation "The configuration units") (outputs :accessor outputs - :initform (alexandria:plist-hash-table (list :generate-sif + :initform (alexandria:plist-hash-table (list :trampoline + (list (make-source #P"trampoline.lisp" :build)) + :generate-sif (list (make-source #P"generate-sif.lisp" :build)) :generate-headers (list (make-source #P"generate-headers.lisp" :variant) @@ -658,7 +666,8 @@ is not compatible with snapshots.") :bitcode :iclasp :cclasp :modules :eclasp :eclasp-link :sclasp :install-bin :install-code :clasp :regression-tests :analyzer :analyze - :tags :install-extension-code :vm-header) + :tags :install-extension-code :vm-header + :trampoline) :config-h (list (make-source #P"config.h" :variant) :scraper) diff --git a/src/koga/ninja.lisp b/src/koga/ninja.lisp index 1f4f62833a..33df494d43 100644 --- a/src/koga/ninja.lisp +++ b/src/koga/ninja.lisp @@ -28,6 +28,7 @@ :ar (ar configuration) :cc (cc configuration) :cxx (cxx configuration) + :dis (dis configuration) :ldflags (ldflags configuration) :ldlibs (ldlibs configuration) :lisp (lisp configuration) @@ -99,6 +100,15 @@ :command "$cxx $variant-cxxflags $cxxflags -c -MD -MF $out.d -o$out $in" :description "Compiling $in" :depfile "$out.d") + (ninja:write-rule output-stream :cxx-llvm + :command "$cxx $variant-cxxflags $cxxflags -c -emit-llvm -g -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -o$out $in" + :description "") + (ninja:write-rule output-stream :disassemble + :command "$dis -o $out $in" + :description "Dissassembling $in") + (ninja:write-rule output-stream :trampoline + :command (lisp-command "trampoline.lisp" "$out $in") + :description "Creating trampoline $out") (ninja:write-rule output-stream :link :command "$cxx $variant-ldflags $ldflags -o$out $in $variant-ldlibs $ldlibs" :description "Linking $out") @@ -185,6 +195,29 @@ :command (lisp-command "update-unicode.lisp" "$source") :description "Updating unicode tables")) +(defmethod print-variant-target-source + (configuration (name (eql :ninja)) output-stream (target (eql :trampoline)) (source cc-source) + &aux (ll (make-source-output source :type "ll")) + (bc (make-source-output source :type "bc")) + (header (make-source "trampoline.h" :variant-generated)) + (installed-header (make-source "trampoline.h" :installed-generated))) + (declare (ignore configuration)) + (ninja:write-build output-stream :cxx-llvm + :variant-cxxflags *variant-cxxflags* + :inputs (list source) + :outputs (list ll)) + (ninja:write-build output-stream :disassemble + :inputs (list ll) + :outputs (list bc)) + (ninja:write-build output-stream :trampoline + :inputs (list bc) + :outputs (list header)) + (when *variant-default* + (ninja:write-build output-stream :install-file + :inputs (list header) + :outputs (list installed-header))) + (list :outputs header)) + (defmethod print-variant-target-sources (configuration (name (eql :ninja)) output-stream (target (eql :tags)) sources &key &allow-other-keys @@ -299,7 +332,8 @@ (ninja:write-build output-stream :scrape-pp :variant-cppflags *variant-cppflags* :inputs (list source) - :order-only-inputs (list (make-source "virtualMachine.h" :variant-generated)) + :order-only-inputs (list (make-source "virtualMachine.h" :variant-generated) + (make-source "trampoline.h" :variant-generated)) :outputs (list pp)) (ninja:write-build output-stream :generate-sif :inputs (list pp) @@ -308,6 +342,7 @@ :variant-cxxflags *variant-cxxflags* :inputs (list source) :order-only-inputs (list* (make-source "virtualMachine.h" :variant-generated) + (make-source "trampoline.h" :variant-generated) (if *variant-precise* (scraper-precise-headers configuration) (scraper-headers configuration))) @@ -420,6 +455,7 @@ "install_extension_code" "install_bin" (make-source "virtualMachine.h" :installed-generated) + (make-source "trampoline.h" :installed-generated) exe-installed lib-installed symlink-installed) diff --git a/src/koga/scripts.lisp b/src/koga/scripts.lisp index 2711f069d2..17c1b7b297 100644 --- a/src/koga/scripts.lisp +++ b/src/koga/scripts.lisp @@ -312,3 +312,12 @@ fi cp -r ../src/lisp/modules/asdf \"$WORK_DIR\" cd \"$WORK_DIR\"/asdf make $2 l=clasp CLASP=$CLASP")) + +(defmethod print-prologue (configuration (name (eql :trampoline)) output-stream) + (print-asdf-stub output-stream t :alexandria) + (format output-stream " +(with-open-file (stream (first (uiop:command-line-arguments)) :direction :output :if-exists :supersede :if-does-not-exist :create) + (write-line \"std::string global_trampoline = R\\\"trampoline(\" stream) + (write-string (alexandria:read-file-into-string (second (uiop:command-line-arguments))) + stream) + (write-line \")trampoline\\\";\" stream))")) diff --git a/src/koga/units.lisp b/src/koga/units.lisp index c49b32dddb..4243f481a1 100644 --- a/src/koga/units.lisp +++ b/src/koga/units.lisp @@ -79,6 +79,16 @@ (or cxx (merge-pathnames #P"clang++" llvm-bindir)) :required t)))) +(defmethod configure-unit (configuration (unit (eql :dis))) + "Find the llvm0dis binary." + (with-accessors ((dis dis) + (llvm-bindir llvm-bindir)) + configuration + (message :emph "Configuring ar") + (setf dis (configure-program "dis" + (or dis (merge-pathnames #P"llvm-dis" llvm-bindir)) + :required t)))) + (defmethod configure-unit (configuration (unit (eql :nm))) "Find the nm binary." (with-accessors ((nm nm) diff --git a/src/llvmo/llvmoPackage.cc b/src/llvmo/llvmoPackage.cc index b03c74531d..4682026d25 100644 --- a/src/llvmo/llvmoPackage.cc +++ b/src/llvmo/llvmoPackage.cc @@ -638,7 +638,7 @@ gctools::return_type lambda_nil(unsigned char* pc, core::T_O* closure, uint64_t }; namespace llvmo { -#include "trampoline.h" +#include std::atomic global_trampoline_counter; #ifdef CLASP_THREADS @@ -653,24 +653,18 @@ CL_DEFUN core::Pointer_mv cmp__compile_trampoline(core::T_sp tname) { ClaspJIT_sp jit = llvm_sys__clasp_jit(); if (!global_options->_GenerateTrampolines) { if (!getenv("CLASP_ENABLE_TRAMPOLINES")) { - // If the JIT isn't ready then use the default trampoline - return Values(Pointer_O::create((void*)bytecode_call), - SimpleBaseString_O::make("bytecode_call")); + // If the JIT isn't ready then use the default trampoline + return Values(Pointer_O::create((void *)bytecode_call), SimpleBaseString_O::make("bytecode_call")); } } if (jit.nilp()) { // If the JIT isn't ready then use the default trampoline - return Values(Pointer_O::create((void*)default_bytecode_trampoline), - SimpleBaseString_O::make("default_bytecode_trampoline")); + return Values(Pointer_O::create((void *)default_bytecode_trampoline), SimpleBaseString_O::make("default_bytecode_trampoline")); } - if (tname.consp() - && CONS_CAR(tname)==::cl::_sym_lambda - && CONS_CDR(tname).consp() - && CONS_CAR(CONS_CDR(tname)).nilp()) { - return Values(Pointer_O::create((void*)lambda_nil), - SimpleBaseString_O::make("lambda_nil")); + if (tname.consp() && CONS_CAR(tname) == ::cl::_sym_lambda && CONS_CDR(tname).consp() && CONS_CAR(CONS_CDR(tname)).nilp()) { + return Values(Pointer_O::create((void *)lambda_nil), SimpleBaseString_O::make("lambda_nil")); } - + std::string name; if (gc::IsA(tname)) { name = gc::As_unsafe(tname)->fullName(); @@ -678,36 +672,22 @@ CL_DEFUN core::Pointer_mv cmp__compile_trampoline(core::T_sp tname) { name = _rep_(tname); // printf("%s:%d:%s trampoline name = |%s|\n", __FILE__, __LINE__, __FUNCTION__, name.c_str()); // fflush(); - if (name[0]=='"' && name[name.size()-1] == '"') { + if (name[0] == '"' && name[name.size() - 1] == '"') { if (name.size() < 3) { // matches "" - return Values(Pointer_O::create((void*)unknown_bytecode_trampoline), + return Values(Pointer_O::create((void *)unknown_bytecode_trampoline), SimpleBaseString_O::make("unknown_bytecode_trampoline")); } } - name = name.substr(1,name.size()-2); // Strip double quotes + name = name.substr(1, name.size() - 2); // Strip double quotes } name = name + "_bct" + std::to_string(global_trampoline_counter++); LLVMContext_sp context = llvm_sys__thread_local_llvm_context(); - std::string trampoline = global_trampoline; - trampoline = core::searchAndReplaceString( trampoline, "@WRAPPER_NAME", "@\""+name+"\""); - trampoline = core::searchAndReplaceString( trampoline, "WRAPPER_NAME", name); - stringstream ss_trampoline; - ss_trampoline << global_trampoline_datalayout_triple; - ss_trampoline << trampoline; - trampoline = ss_trampoline.str(); - //printf("%s:%d:%s About to parseIRString %s\n", __FILE__, __LINE__, __FUNCTION__, trampoline.c_str()); - Module_sp module = llvm_sys__parseIRString(trampoline, context, "backtrace_trampoline" ); - //printf("%s:%d:%s About to call loadModule with module = %p name = %s\n", __FILE__, __LINE__, __FUNCTION__, module.raw_(), name.c_str() ); - JITDylib_sp jitDylib = loadModule( module, 0, "trampoline" ); - core::Pointer_sp bytecode_ptr = jit->lookup(jitDylib,name); - // printf("%s:%d:%s before interpreter_trampoline = %p\n", __FILE__, __LINE__, __FUNCTION__, core::interpreter_trampoline ); - // printf("%s:%d:%s after interpreter_t - return Values(bytecode_ptr,SimpleBaseString_O::make(name)); + std::string trampoline = core::searchAndReplaceString(global_trampoline, "wrapper:name", name); + Module_sp module = llvm_sys__parseIRString(trampoline, context, "backtrace_trampoline"); + JITDylib_sp jitDylib = loadModule(module, 0, "trampoline"); + core::Pointer_sp bytecode_ptr = jit->lookup(jitDylib, name); + return Values(bytecode_ptr, SimpleBaseString_O::make(name)); } - - - - }; namespace llvmo { diff --git a/src/llvmo/trampoline.h b/src/llvmo/trampoline.h deleted file mode 100644 index e2cbe555b4..0000000000 --- a/src/llvmo/trampoline.h +++ /dev/null @@ -1,241 +0,0 @@ - - - -#if defined(_TARGET_OS_DARWIN) -std::string global_trampoline_datalayout_triple = R"big( -;ModuleID = 'trampoline.bc' -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx12.0.0" -)big"; -#elif defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_FREEBSD) -std::string global_trampoline_datalayout_triple = R"big( -;ModuleID = 'trampoline.bc' -source_filename = "trampoline.cc" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-pc-linux-gnu" - )big"; -#else -# error "Add info for unknown os" -#endif - -std::string global_trampoline = R"trampoline( - -%struct.Gcroots = type { i64, i8*, i64, i64, i8**, i64 } - -@__clasp_gcroots_in_module_trampoline = local_unnamed_addr global [0 x %struct.Gcroots] zeroinitializer, align 8, !dbg !0 -@__clasp_literals_trampoline = local_unnamed_addr global [0 x i8*] zeroinitializer, align 8, !dbg !12 - -; Function Attrs: mustprogress ssp uwtable -define { i8*, i64 } @WRAPPER_NAME(i64 noundef %0, i8* noundef %1, i64 noundef %2, i8** noundef %3) local_unnamed_addr #0 !dbg !114 { - %5 = alloca [3 x i64], align 16 - call void @llvm.dbg.value(metadata i64 %0, metadata !126, metadata !DIExpression()), !dbg !134 - call void @llvm.dbg.value(metadata i8* %1, metadata !127, metadata !DIExpression()), !dbg !134 - call void @llvm.dbg.value(metadata i64 %2, metadata !128, metadata !DIExpression()), !dbg !134 - call void @llvm.dbg.value(metadata i8** %3, metadata !129, metadata !DIExpression()), !dbg !134 - %6 = bitcast [3 x i64]* %5 to i8*, !dbg !135 - call void @llvm.lifetime.start.p0i8(i64 24, i8* nonnull %6) #5, !dbg !135 - call void @llvm.dbg.declare(metadata [3 x i64]* %5, metadata !130, metadata !DIExpression()), !dbg !136 - call void (i64, i32, ...) @llvm.experimental.stackmap(i64 noundef 3735879680, i32 noundef 0, [3 x i64]* noundef nonnull %5), !dbg !137 - %7 = ptrtoint i8* %1 to i64, !dbg !138 - %8 = getelementptr inbounds [3 x i64], [3 x i64]* %5, i64 0, i64 0, !dbg !139 - store i64 %7, i64* %8, align 16, !dbg !140, !tbaa !141 - %9 = getelementptr inbounds [3 x i64], [3 x i64]* %5, i64 0, i64 1, !dbg !145 - store i64 %2, i64* %9, align 8, !dbg !146, !tbaa !141 - %10 = ptrtoint i8** %3 to i64, !dbg !147 - %11 = getelementptr inbounds [3 x i64], [3 x i64]* %5, i64 0, i64 2, !dbg !148 - store i64 %10, i64* %11, align 16, !dbg !149, !tbaa !141 - %12 = call { i8*, i64 } @bytecode_call(i64 noundef %0, i8* noundef %1, i64 noundef %2, i8** noundef %3), !dbg !150 - call void @llvm.lifetime.end.p0i8(i64 24, i8* nonnull %6) #5, !dbg !151 - ret { i8*, i64 } %12, !dbg !151 -} - -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - -; Function Attrs: argmemonly nofree nosync nounwind willreturn -declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #2 - -declare !dbg !152 void @llvm.experimental.stackmap(i64 noundef, i32 noundef, ...) local_unnamed_addr #3 - -declare !dbg !156 { i8*, i64 } @bytecode_call(i64 noundef, i8* noundef, i64 noundef, i8** noundef) local_unnamed_addr #3 - -; Function Attrs: argmemonly nofree nosync nounwind willreturn -declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #2 - -; Function Attrs: nofree nosync nounwind readnone speculatable willreturn -declare void @llvm.dbg.value(metadata, metadata, metadata) #1 - -attributes #0 = { mustprogress ssp uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "tune-cpu"="generic" } -attributes #1 = { nofree nosync nounwind readnone speculatable willreturn } -attributes #2 = { argmemonly nofree nosync nounwind willreturn } -attributes #3 = { "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "tune-cpu"="generic" } -attributes #4 = { mustprogress nofree norecurse nosync nounwind readnone ssp uwtable willreturn "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "tune-cpu"="generic" } -attributes #5 = { nounwind } - -!llvm.dbg.cu = !{!2} -!llvm.module.flags = !{!107, !108, !109, !110, !111, !112} -!llvm.ident = !{!113} - -!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) -!1 = distinct !DIGlobalVariable(name: "__clasp_gcroots_in_module_trampoline", scope: !2, file: !3, line: 100, type: !97, isLocal: false, isDefinition: true) -!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "Homebrew clang version 14.0.6", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: !4, globals: !11, imports: !18, splitDebugInlining: false, nameTableKind: None, sysroot: "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk", sdk: "MacOSX12.sdk") -!3 = !DIFile(filename: "trampoline.cc", directory: "/Users/su-chris/Development/clasp/src/core/trampoline") -!4 = !{!5, !8} -!5 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint64_t", file: !6, line: 31, baseType: !7) -!6 = !DIFile(filename: "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/_types/_uint64_t.h", directory: "") -!7 = !DIBasicType(name: "unsigned long long", size: 64, encoding: DW_ATE_unsigned) -!8 = !DIDerivedType(tag: DW_TAG_typedef, name: "uintptr_t", file: !9, line: 34, baseType: !10) -!9 = !DIFile(filename: "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/sys/_types/_uintptr_t.h", directory: "") -!10 = !DIBasicType(name: "unsigned long", size: 64, encoding: DW_ATE_unsigned) -!11 = !{!0, !12} -!12 = !DIGlobalVariableExpression(var: !13, expr: !DIExpression()) -!13 = distinct !DIGlobalVariable(name: "__clasp_literals_trampoline", scope: !2, file: !3, line: 101, type: !14, isLocal: false, isDefinition: true) -!14 = !DICompositeType(tag: DW_TAG_array_type, baseType: !15, elements: !16) -!15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -!16 = !{!17} -!17 = !DISubrange(count: 0) -!18 = !{!19, !26, !30, !34, !38, !42, !46, !50, !51, !54, !56, !58, !60, !62, !64, !66, !68, !70, !72, !74, !76, !78, !80, !82, !84, !90, !91, !94} -!19 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !22, file: !25, line: 152) -!20 = !DINamespace(name: "__1", scope: !21, exportSymbols: true) -!21 = !DINamespace(name: "std", scope: null) -!22 = !DIDerivedType(tag: DW_TAG_typedef, name: "int8_t", file: !23, line: 30, baseType: !24) -!23 = !DIFile(filename: "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/sys/_types/_int8_t.h", directory: "") -!24 = !DIBasicType(name: "signed char", size: 8, encoding: DW_ATE_signed_char) -!25 = !DIFile(filename: "/usr/local/opt/llvm@14/bin/../include/c++/v1/cstdint", directory: "") -!26 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !27, file: !25, line: 153) -!27 = !DIDerivedType(tag: DW_TAG_typedef, name: "int16_t", file: !28, line: 30, baseType: !29) -!28 = !DIFile(filename: "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/sys/_types/_int16_t.h", directory: "") -!29 = !DIBasicType(name: "short", size: 16, encoding: DW_ATE_signed) -!30 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !31, file: !25, line: 154) -!31 = !DIDerivedType(tag: DW_TAG_typedef, name: "int32_t", file: !32, line: 30, baseType: !33) -!32 = !DIFile(filename: "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/sys/_types/_int32_t.h", directory: "") -!33 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -!34 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !35, file: !25, line: 155) -!35 = !DIDerivedType(tag: DW_TAG_typedef, name: "int64_t", file: !36, line: 30, baseType: !37) -!36 = !DIFile(filename: "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/sys/_types/_int64_t.h", directory: "") -!37 = !DIBasicType(name: "long long", size: 64, encoding: DW_ATE_signed) -!38 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !39, file: !25, line: 157) -!39 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint8_t", file: !40, line: 31, baseType: !41) -!40 = !DIFile(filename: "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/_types/_uint8_t.h", directory: "") -!41 = !DIBasicType(name: "unsigned char", size: 8, encoding: DW_ATE_unsigned_char) -!42 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !43, file: !25, line: 158) -!43 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint16_t", file: !44, line: 31, baseType: !45) -!44 = !DIFile(filename: "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/_types/_uint16_t.h", directory: "") -!45 = !DIBasicType(name: "unsigned short", size: 16, encoding: DW_ATE_unsigned) -!46 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !47, file: !25, line: 159) -!47 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint32_t", file: !48, line: 31, baseType: !49) -!48 = !DIFile(filename: "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/_types/_uint32_t.h", directory: "") -!49 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) -!50 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !5, file: !25, line: 160) -!51 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !52, file: !25, line: 162) -!52 = !DIDerivedType(tag: DW_TAG_typedef, name: "int_least8_t", file: !53, line: 29, baseType: !22) -!53 = !DIFile(filename: "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/stdint.h", directory: "") -!54 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !55, file: !25, line: 163) -!55 = !DIDerivedType(tag: DW_TAG_typedef, name: "int_least16_t", file: !53, line: 30, baseType: !27) -!56 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !57, file: !25, line: 164) -!57 = !DIDerivedType(tag: DW_TAG_typedef, name: "int_least32_t", file: !53, line: 31, baseType: !31) -!58 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !59, file: !25, line: 165) -!59 = !DIDerivedType(tag: DW_TAG_typedef, name: "int_least64_t", file: !53, line: 32, baseType: !35) -!60 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !61, file: !25, line: 167) -!61 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint_least8_t", file: !53, line: 33, baseType: !39) -!62 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !63, file: !25, line: 168) -!63 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint_least16_t", file: !53, line: 34, baseType: !43) -!64 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !65, file: !25, line: 169) -!65 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint_least32_t", file: !53, line: 35, baseType: !47) -!66 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !67, file: !25, line: 170) -!67 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint_least64_t", file: !53, line: 36, baseType: !5) -!68 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !69, file: !25, line: 172) -!69 = !DIDerivedType(tag: DW_TAG_typedef, name: "int_fast8_t", file: !53, line: 40, baseType: !22) -!70 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !71, file: !25, line: 173) -!71 = !DIDerivedType(tag: DW_TAG_typedef, name: "int_fast16_t", file: !53, line: 41, baseType: !27) -!72 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !73, file: !25, line: 174) -!73 = !DIDerivedType(tag: DW_TAG_typedef, name: "int_fast32_t", file: !53, line: 42, baseType: !31) -!74 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !75, file: !25, line: 175) -!75 = !DIDerivedType(tag: DW_TAG_typedef, name: "int_fast64_t", file: !53, line: 43, baseType: !35) -!76 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !77, file: !25, line: 177) -!77 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint_fast8_t", file: !53, line: 44, baseType: !39) -!78 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !79, file: !25, line: 178) -!79 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint_fast16_t", file: !53, line: 45, baseType: !43) -!80 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !81, file: !25, line: 179) -!81 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint_fast32_t", file: !53, line: 46, baseType: !47) -!82 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !83, file: !25, line: 180) -!83 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint_fast64_t", file: !53, line: 47, baseType: !5) -!84 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !85, file: !25, line: 182) -!85 = !DIDerivedType(tag: DW_TAG_typedef, name: "intptr_t", file: !86, line: 32, baseType: !87) -!86 = !DIFile(filename: "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/sys/_types/_intptr_t.h", directory: "") -!87 = !DIDerivedType(tag: DW_TAG_typedef, name: "__darwin_intptr_t", file: !88, line: 51, baseType: !89) -!88 = !DIFile(filename: "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/i386/_types.h", directory: "") -!89 = !DIBasicType(name: "long", size: 64, encoding: DW_ATE_signed) -!90 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !8, file: !25, line: 183) -!91 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !92, file: !25, line: 185) -!92 = !DIDerivedType(tag: DW_TAG_typedef, name: "intmax_t", file: !93, line: 32, baseType: !89) -!93 = !DIFile(filename: "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/_types/_intmax_t.h", directory: "") -!94 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !20, entity: !95, file: !25, line: 186) -!95 = !DIDerivedType(tag: DW_TAG_typedef, name: "uintmax_t", file: !96, line: 32, baseType: !10) -!96 = !DIFile(filename: "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/_types/_uintmax_t.h", directory: "") -!97 = !DICompositeType(tag: DW_TAG_array_type, baseType: !98, elements: !16) -!98 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Gcroots", file: !3, line: 79, size: 384, flags: DIFlagTypePassByValue, elements: !99, identifier: "_ZTS7Gcroots") -!99 = !{!100, !101, !102, !103, !104, !106} -!100 = !DIDerivedType(tag: DW_TAG_member, name: "val1", scope: !98, file: !3, line: 80, baseType: !5, size: 64) -!101 = !DIDerivedType(tag: DW_TAG_member, name: "val2", scope: !98, file: !3, line: 81, baseType: !15, size: 64, offset: 64) -!102 = !DIDerivedType(tag: DW_TAG_member, name: "val3", scope: !98, file: !3, line: 82, baseType: !5, size: 64, offset: 128) -!103 = !DIDerivedType(tag: DW_TAG_member, name: "val4", scope: !98, file: !3, line: 83, baseType: !5, size: 64, offset: 192) -!104 = !DIDerivedType(tag: DW_TAG_member, name: "val5", scope: !98, file: !3, line: 84, baseType: !105, size: 64, offset: 256) -!105 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !15, size: 64) -!106 = !DIDerivedType(tag: DW_TAG_member, name: "val6", scope: !98, file: !3, line: 85, baseType: !5, size: 64, offset: 320) -!107 = !{i32 7, !"Dwarf Version", i32 4} -!108 = !{i32 2, !"Debug Info Version", i32 3} -!109 = !{i32 1, !"wchar_size", i32 4} -!110 = !{i32 7, !"PIC Level", i32 2} -!111 = !{i32 7, !"uwtable", i32 1} -!112 = !{i32 7, !"frame-pointer", i32 2} -!113 = !{!"Homebrew clang version 14.0.6"} -!114 = distinct !DISubprogram(name: "WRAPPER_NAME", scope: !3, file: !3, line: 107, type: !115, scopeLine: 107, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !125) -!115 = !DISubroutineType(types: !116) -!116 = !{!117, !5, !15, !5, !105} -!117 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "return_type", file: !3, line: 88, size: 128, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !118, identifier: "_ZTS11return_type") -!118 = !{!119, !120, !121} -!119 = !DIDerivedType(tag: DW_TAG_member, name: "_ptr", scope: !117, file: !3, line: 89, baseType: !15, size: 64) -!120 = !DIDerivedType(tag: DW_TAG_member, name: "_nvals", scope: !117, file: !3, line: 90, baseType: !5, size: 64, offset: 64) -!121 = !DISubprogram(name: "return_type", scope: !117, file: !3, line: 91, type: !122, scopeLine: 91, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized) -!122 = !DISubroutineType(types: !123) -!123 = !{null, !124, !15, !5} -!124 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !117, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) -!125 = !{!126, !127, !128, !129, !130} -!126 = !DILocalVariable(name: "pc", arg: 1, scope: !114, file: !3, line: 107, type: !5) -!127 = !DILocalVariable(name: "closure", arg: 2, scope: !114, file: !3, line: 107, type: !15) -!128 = !DILocalVariable(name: "nargs", arg: 3, scope: !114, file: !3, line: 107, type: !5) -!129 = !DILocalVariable(name: "args", arg: 4, scope: !114, file: !3, line: 107, type: !105) -!130 = !DILocalVariable(name: "trampoline_save_args", scope: !114, file: !3, line: 108, type: !131) -!131 = !DICompositeType(tag: DW_TAG_array_type, baseType: !5, size: 192, elements: !132) -!132 = !{!133} -!133 = !DISubrange(count: 3) -!134 = !DILocation(line: 0, scope: !114) -!135 = !DILocation(line: 108, column: 5, scope: !114) -!136 = !DILocation(line: 108, column: 14, scope: !114) -!137 = !DILocation(line: 109, column: 5, scope: !114) -!138 = !DILocation(line: 110, column: 31, scope: !114) -!139 = !DILocation(line: 110, column: 5, scope: !114) -!140 = !DILocation(line: 110, column: 29, scope: !114) -!141 = !{!142, !142, i64 0} -!142 = !{!"long long", !143, i64 0} -!143 = !{!"omnipotent char", !144, i64 0} -!144 = !{!"Simple C++ TBAA"} -!145 = !DILocation(line: 111, column: 5, scope: !114) -!146 = !DILocation(line: 111, column: 29, scope: !114) -!147 = !DILocation(line: 112, column: 31, scope: !114) -!148 = !DILocation(line: 112, column: 5, scope: !114) -!149 = !DILocation(line: 112, column: 29, scope: !114) -!150 = !DILocation(line: 113, column: 12, scope: !114) -!151 = !DILocation(line: 114, column: 3, scope: !114) -!152 = !DISubprogram(name: "llvm.experimental.stackmap", scope: !3, file: !3, line: 103, type: !153, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !155) -!153 = !DISubroutineType(types: !154) -!154 = !{null, !5, !47, null} -!155 = !{} -!156 = !DISubprogram(name: "bytecode_call", scope: !3, file: !3, line: 105, type: !115, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !155) -!157 = distinct !DISubprogram(name: "CLASP_STARTUP", scope: !3, file: !3, line: 117, type: !158, scopeLine: 118, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !155) -!158 = !DISubroutineType(types: !159) -!159 = !{null} -!160 = !DILocation(line: 119, column: 3, scope: !157) - -)trampoline";