Skip to content

Commit 7ab317a

Browse files
drmeisteryitzchak
authored andcommitted
Change USE_MMAP_CODEBLOCK to CLASP_APPLE_SILICON
1 parent 94ca34a commit 7ab317a

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

include/clasp/core/configure_clasp.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ THE SOFTWARE.
7676

7777
#if defined(_TARGET_OS_DARWIN) && defined(__aarch64__)
7878
#define CLASP_APPLE_SILICON 1
79-
#define USE_MMAP_CODEBLOCK 1
8079
#endif
8180

8281
// ----------------------------------------------------------------------------

include/clasp/llvmo/code.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ class CodeBlock_O : public core::CxxObject_O {
240240

241241
public:
242242
template <typename Stage> static CodeBlock_sp make(uintptr_t size) {
243-
#ifdef USE_MMAP_CODEBLOCK
244-
CodeBlock_sp codeblock = gctools::GC<CodeBlock_O>::allocate<Stage>(size);
243+
#ifdef CLASP_APPLE_SILICON
244+
CodeBlock_sp codeblock = gctools::GC<CodeBlock_O>::allocate<Stage>(0);
245245
void* mmappedBlock = mmap(NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE | MAP_JIT, -1, 0);
246246
if (mmappedBlock == MAP_FAILED || !mmappedBlock) {
247247
printf("%s:%d:%s mmap failed\n", __FILE__, __LINE__, __FUNCTION__);
@@ -272,21 +272,21 @@ class CodeBlock_O : public core::CxxObject_O {
272272
* Return false if it won't fit and true if it will and then lock in the allocation
273273
*/
274274
void* dataStart() const {
275-
#ifdef USE_MMAP_CODEBLOCK
275+
#ifdef CLASP_APPLE_SILICON
276276
return (void*)this->_mmapBlock;
277277
#else
278278
return (void*)&this->_DataCode[0];
279279
#endif
280280
};
281281
void* dataEnd() const {
282-
#ifdef USE_MMAP_CODEBLOCK
282+
#ifdef CLASP_APPLE_SILICON
283283
return (void*)((uintptr_t)this->_mmapBlock + this->_HeadOffset);
284284
#else
285285
return (void*)&this->_DataCode[this->_HeadOffset];
286286
#endif
287287
};
288288
unsigned char* address(uintptr_t index) const {
289-
#ifdef USE_MMAP_CODEBLOCK
289+
#ifdef CLASP_APPLE_SILICON
290290
return (unsigned char*)((uintptr_t)this->_mmapBlock + index);
291291
#else
292292
return (unsigned char*)&this->_DataCode[index];
@@ -303,7 +303,7 @@ class CodeBlock_O : public core::CxxObject_O {
303303

304304
CodeBlock_O(uintptr_t totalSize)
305305
: _HeadOffset(0), _TailOffset(totalSize)
306-
#ifdef USE_MMAP_CODEBLOCK
306+
#ifdef CLASP_APPLE_SILICON
307307
,
308308
_mmapBlock(NULL), _mmapSize(totalSize)
309309
#else

src/core/lisp.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,9 @@ CL_DECLARE();
14061406
CL_DOCSTRING(R"dx(exit)dx");
14071407
DOCGROUP(clasp);
14081408
CL_DEFUN void core__exit(int exitValue) {
1409+
#ifdef CLASP_APPLE_SILICON
1410+
exit(exitValue);
1411+
#else
14091412
gctools::global_debuggerOnSIGABRT = false;
14101413
if (exitValue != 0) {
14111414
if (core::_sym_STARexit_backtraceSTAR->symbolValue().notnilp()) {
@@ -1418,6 +1421,7 @@ CL_DEFUN void core__exit(int exitValue) {
14181421
VirtualMachine& vm = my_thread->_VM;
14191422
vm.shutdown();
14201423
throw(ExitProgramException(exitValue));
1424+
#endif
14211425
};
14221426

14231427
CL_LAMBDA(&optional (exit-value 0));

src/gctools/boehmGarbageCollection.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ CL_DEFUN core::T_sp core__gc_base(uint64_t addr)
562562

563563

564564
void clasp_gc_registerRoots(void* rootsStart, size_t numberOfRoots) {
565-
#ifdef USE_MMAP_CODEBLOCK
565+
#ifdef CLASP_APPLE_SILICON
566566
//
567567
// This is experimental for Apple Silicon M1 chip
568568
//
@@ -587,7 +587,7 @@ void clasp_gc_registerRoots(void* rootsStart, size_t numberOfRoots) {
587587
}
588588

589589
void clasp_gc_deregisterRoots(void* rootsStart, size_t numberOfRoots) {
590-
#ifdef USE_MMAP_CODEBLOCK
590+
#ifdef CLASP_APPLE_SILICON
591591
//
592592
// This is experimental for Apple Silicon M1 chip
593593
//

0 commit comments

Comments
 (0)