ruby-changes:68591
From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:10:17 +0900 (JST)
Subject: [ruby-changes:68591] 7d1546ece5 (master): Try to fix Windows build
https://git.ruby-lang.org/ruby.git/commit/?id=7d1546ece5 From 7d1546ece5e3678a8b8eb196c81c3f4972c51f0a Mon Sep 17 00:00:00 2001 From: Alan Wu <XrXr@u...> Date: Mon, 5 Oct 2020 07:41:46 -0400 Subject: Try to fix Windows build --- iseq.c | 1 - ujit_asm.c | 6 ++++++ ujit_compile.c | 8 +++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/iseq.c b/iseq.c index 19fd8fcb18..19ac0e0d43 100644 --- a/iseq.c +++ b/iseq.c @@ -42,7 +42,6 @@ https://github.com/ruby/ruby/blob/trunk/iseq.c#L42 #include "builtin.h" #include "insns.inc" #include "insns_info.inc" -#include <sys/mman.h> VALUE rb_cISeq; static VALUE iseqw_new(const rb_iseq_t *iseq); diff --git a/ujit_asm.c b/ujit_asm.c index 8efbee3f79..e8aee15fab 100644 --- a/ujit_asm.c +++ b/ujit_asm.c @@ -3,8 +3,10 @@ https://github.com/ruby/ruby/blob/trunk/ujit_asm.c#L3 #include <stdarg.h> #include <assert.h> +#ifndef _WIN32 // For mmapp() #include <sys/mman.h> +#endif #include "ujit_asm.h" @@ -82,6 +84,7 @@ x86opnd_t const_ptr_opnd(void* ptr) https://github.com/ruby/ruby/blob/trunk/ujit_asm.c#L84 // Allocate a block of executable memory uint8_t* alloc_exec_mem(size_t mem_size) { +#ifndef _WIN32 // Map the memory as executable uint8_t* mem_block = (uint8_t*)mmap( &alloc_exec_mem, @@ -100,6 +103,9 @@ uint8_t* alloc_exec_mem(size_t mem_size) https://github.com/ruby/ruby/blob/trunk/ujit_asm.c#L103 } return mem_block; +#else + return NULL; +#endif } // Initialize a code block object diff --git a/ujit_compile.c b/ujit_compile.c index cee9e383e7..6740a80765 100644 --- a/ujit_compile.c +++ b/ujit_compile.c @@ -13,6 +13,12 @@ https://github.com/ruby/ruby/blob/trunk/ujit_compile.c#L13 // eg ujit_hook.h #include "ujit_examples.inc" +#ifdef _WIN32 +#define PLATFORM_SUPPORTED_P 0 +#else +#define PLATFORM_SUPPORTED_P 1 +#endif + // Hash table of encoded instructions extern st_table *rb_encoded_insn_data; @@ -505,7 +511,7 @@ rb_ujit_enabled_p(void) https://github.com/ruby/ruby/blob/trunk/ujit_compile.c#L511 void rb_ujit_init(void) { - if (!ujit_scrape_successful) { + if (!ujit_scrape_successful && PLATFORM_SUPPORTED_P) { return; } // Initialize the code blocks -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/