1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: architecture/ia64/package/*/ia64.patch
3 # Copyright (C) 2024 The T2 SDE Project
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
8 # This patch file is dual-licensed. It is available under the license the
9 # patched project is licensed under, as long as it is an OpenSource license
10 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
11 # of the GNU General Public License version 2 as used by the T2 SDE.
12 # --- T2-COPYRIGHT-NOTE-END ---
14 Revert ia64 removal d17344cfc56edc4599252041b3ec0d46af0851fd
16 miniruby crashes though, except when run in gdb, yay, likely
17 native fiber related: 6c6bf9ffcbfeb8be9d9c342e7604b74ec819e88a
19 diff -urN --exclude '*orig' ruby-3.1.5/common.mk ruby-3.1.5-ia64/common.mk
20 --- ruby-3.1.5/common.mk 2024-04-23 12:20:59.000000000 +0200
21 +++ ruby-3.1.5-ia64/common.mk 2024-05-30 11:24:24.908189690 +0200
23 strlcpy.$(OBJEXT): {$(VPATH)}strlcpy.c
24 strstr.$(OBJEXT): {$(VPATH)}strstr.c
25 tgamma.$(OBJEXT): {$(VPATH)}tgamma.c
26 +ia64.$(OBJEXT): {$(VPATH)}ia64.s
27 + $(CC) $(CFLAGS) -c $<
29 .coroutine_obj $(COROUTINE_OBJ): \
30 {$(VPATH)}$(COROUTINE_SRC) \
31 diff -urN --exclude '*orig' ruby-3.1.5/configure.ac ruby-3.1.5-ia64/configure.ac
32 --- ruby-3.1.5/configure.ac 2024-04-23 12:20:59.000000000 +0200
33 +++ ruby-3.1.5-ia64/configure.ac 2024-05-30 11:18:37.540127727 +0200
34 @@ -1935,6 +1935,24 @@
38 +# http://sources.redhat.com/ml/libc-hacker/2005-08/msg00008.html
39 +# Debian GNU/Linux Etch's libc6.1 2.3.6.ds1-13etch5 has this problem.
40 +# Debian GNU/Linux Lenny's libc6.1 2.7-10 has no problem.
41 +AC_CACHE_CHECK(for broken erfc of glibc-2.3.6 on IA64, rb_cv_broken_glibc_ia64_erfc,
51 + rb_cv_broken_glibc_ia64_erfc=no,
52 + rb_cv_broken_glibc_ia64_erfc=yes,
53 + rb_cv_broken_glibc_ia64_erfc=no)])
54 +AS_CASE([$rb_cv_broken_glibc_ia64_erfc],[yes],[ac_cv_func_erf=no])
56 AS_CASE(["$target_os"],[freebsd*],[
57 AC_DEFINE(BROKEN_CLOSE)
58 AC_REPLACE_FUNCS(close)
59 @@ -2452,6 +2470,21 @@
63 +AS_IF([test x"$target_cpu" = xia64], [
65 + AC_CACHE_CHECK(for __libc_ia64_register_backing_store_base,
66 + rb_cv___libc_ia64_register_backing_store_base,
67 + [rb_cv___libc_ia64_register_backing_store_base=no
69 + [extern unsigned long __libc_ia64_register_backing_store_base;],
70 + [unsigned long p = __libc_ia64_register_backing_store_base;
71 + printf("%ld\n", p);],
72 + [rb_cv___libc_ia64_register_backing_store_base=yes])])
73 + AS_IF([test $rb_cv___libc_ia64_register_backing_store_base = yes], [
74 + AC_DEFINE(HAVE___LIBC_IA64_REGISTER_BACKING_STORE_BASE)
78 AC_CACHE_CHECK(whether right shift preserve sign bit, rb_cv_rshift_sign,
79 [AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([], [(-1==(-1>>1))])],
80 rb_cv_rshift_sign=yes,
81 diff -urN --exclude '*orig' ruby-3.1.5/cont.c ruby-3.1.5-ia64/cont.c
82 --- ruby-3.1.5/cont.c 2024-04-23 12:20:59.000000000 +0200
83 +++ ruby-3.1.5-ia64/cont.c 2024-05-30 11:28:52.676237454 +0200
89 + VALUE *register_stack;
90 + VALUE *register_stack_src;
91 + int register_stack_size;
94 rb_execution_context_t saved_ec;
98 fiber_pool_vacancy_remove(vacancy);
101 + if (cont->machine.register_stack) {
102 + rb_gc_mark_locations(cont->machine.register_stack,
103 + cont->machine.register_stack + cont->machine.register_stack_size);
110 sec->machine.stack_start = fiber->stack.current;
111 sec->machine.stack_maxsize = fiber->stack.available;
114 + sec->machine.register_stack_maxsize = sec->machine.stack_maxsize;
117 fiber->context.argument = (void*)fiber;
121 fiber_stack_release(fiber);
125 + RUBY_FREE_UNLESS_NULL(cont->machine.register_stack);
127 RUBY_FREE_UNLESS_NULL(cont->saved_vm_stack.ptr);
130 @@ -1018,7 +1036,11 @@
131 if (cont->machine.stack) {
132 size += cont->machine.stack_size * sizeof(*cont->machine.stack);
136 + if (cont->machine.register_stack) {
137 + size += cont->machine.register_stack_size * sizeof(*cont->machine.register_stack);
143 @@ -1114,6 +1136,9 @@
146 SET_MACHINE_STACK_END(&th->ec->machine.stack_end);
148 + th->ec->machine.register_stack_end = rb_ia64_bsp();
151 if (th->ec->machine.stack_start > th->ec->machine.stack_end) {
152 size = cont->machine.stack_size = th->ec->machine.stack_start - th->ec->machine.stack_end;
153 @@ -1133,6 +1158,20 @@
155 FLUSH_REGISTER_WINDOWS;
156 MEMCPY(cont->machine.stack, cont->machine.stack_src, VALUE, size);
160 + size = cont->machine.register_stack_size = th->ec->machine.register_stack_end - th->ec->machine.register_stack_start;
161 + cont->machine.register_stack_src = th->ec->machine.register_stack_start;
162 + if (cont->machine.register_stack) {
163 + REALLOC_N(cont->machine.register_stack, VALUE, size);
166 + cont->machine.register_stack = ALLOC_N(VALUE, size);
169 + MEMCPY(cont->machine.register_stack, cont->machine.register_stack_src, VALUE, size);
173 static const rb_data_type_t cont_data_type = {
174 @@ -1154,6 +1193,10 @@
175 /* saved_ec->machine.stack_end should be NULL */
176 /* because it may happen GC afterward */
177 sec->machine.stack_end = NULL;
180 + sec->machine.register_stack_end = NULL;
185 @@ -1428,11 +1471,53 @@
186 VALUE, cont->machine.stack_size);
190 + if (cont->machine.register_stack_src) {
191 + MEMCPY(cont->machine.register_stack_src, cont->machine.register_stack,
192 + VALUE, cont->machine.register_stack_size);
196 ruby_longjmp(cont->jmpbuf, 1);
199 NORETURN(NOINLINE(static void cont_restore_0(rb_context_t *, VALUE *)));
202 +#define C(a) rse_##a##0, rse_##a##1, rse_##a##2, rse_##a##3, rse_##a##4
203 +#define E(a) rse_##a##0= rse_##a##1= rse_##a##2= rse_##a##3= rse_##a##4
204 +static volatile int C(a), C(b), C(c), C(d), C(e);
205 +static volatile int C(f), C(g), C(h), C(i), C(j);
206 +static volatile int C(k), C(l), C(m), C(n), C(o);
207 +static volatile int C(p), C(q), C(r), C(s), C(t);
209 +{/* the above lines make cc-mode.el confused so much */}
211 +int rb_dummy_false = 0;
212 +NORETURN(NOINLINE(static void register_stack_extend(rb_context_t *, VALUE *, VALUE *)));
214 +register_stack_extend(rb_context_t *cont, VALUE *vp, VALUE *curr_bsp)
216 + if (rb_dummy_false) {
217 + /* use registers as much as possible */
218 + E(a) = E(b) = E(c) = E(d) = E(e) =
219 + E(f) = E(g) = E(h) = E(i) = E(j) =
220 + E(k) = E(l) = E(m) = E(n) = E(o) =
221 + E(p) = E(q) = E(r) = E(s) = E(t) = 0;
222 + E(a) = E(b) = E(c) = E(d) = E(e) =
223 + E(f) = E(g) = E(h) = E(i) = E(j) =
224 + E(k) = E(l) = E(m) = E(n) = E(o) =
225 + E(p) = E(q) = E(r) = E(s) = E(t) = 0;
227 + if (curr_bsp < cont->machine.register_stack_src+cont->machine.register_stack_size) {
228 + register_stack_extend(cont, vp, (VALUE*)rb_ia64_bsp());
230 + cont_restore_0(cont, vp);
237 cont_restore_0(rb_context_t *cont, VALUE *addr_in_prev_frame)
239 @@ -1481,6 +1566,9 @@
241 cont_restore_1(cont);
244 +#define cont_restore_0(cont, vp) register_stack_extend((cont), (vp), (VALUE*)rb_ia64_bsp())
248 * Document-class: Continuation
249 diff -urN --exclude '*orig' ruby-3.1.5/dln.c ruby-3.1.5-ia64/dln.c
250 --- ruby-3.1.5/dln.c 2024-04-23 12:20:59.000000000 +0200
251 +++ ruby-3.1.5-ia64/dln.c 2024-05-30 11:18:37.568127732 +0200
257 +#if defined(_AIX) && ! defined(_IA64)
259 aix_loaderror(const char *pathname)
266 +#if defined(_AIX) && ! defined(_IA64)
269 void (*init_fct)(void);
270 diff -urN --exclude '*orig' ruby-3.1.5/ext/etc/etc.c ruby-3.1.5-ia64/ext/etc/etc.c
271 --- ruby-3.1.5/ext/etc/etc.c 2024-04-23 12:20:59.000000000 +0200
272 +++ ruby-3.1.5-ia64/ext/etc/etc.c 2024-05-30 11:18:37.576127733 +0200
274 # ifndef PROCESSOR_ARCHITECTURE_AMD64
275 # define PROCESSOR_ARCHITECTURE_AMD64 9
277 +# ifndef PROCESSOR_ARCHITECTURE_IA64
278 +# define PROCESSOR_ARCHITECTURE_IA64 6
280 # ifndef PROCESSOR_ARCHITECTURE_INTEL
281 # define PROCESSOR_ARCHITECTURE_INTEL 0
284 case PROCESSOR_ARCHITECTURE_ARM:
287 + case PROCESSOR_ARCHITECTURE_IA64:
290 case PROCESSOR_ARCHITECTURE_INTEL:
293 diff -urN --exclude '*orig' ruby-3.1.5/gc.c ruby-3.1.5-ia64/gc.c
294 --- ruby-3.1.5/gc.c 2024-04-23 12:20:59.000000000 +0200
295 +++ ruby-3.1.5-ia64/gc.c 2024-05-30 11:36:51.936322945 +0200
296 @@ -6110,7 +6110,11 @@
301 +#define SET_STACK_END (SET_MACHINE_STACK_END(&ec->machine.stack_end), ec->machine.register_stack_end = rb_ia64_bsp())
303 #define SET_STACK_END SET_MACHINE_STACK_END(&ec->machine.stack_end)
306 #define STACK_START (ec->machine.stack_start)
307 #define STACK_END (ec->machine.stack_end)
308 @@ -6158,12 +6162,20 @@
310 stack_check(rb_execution_context_t *ec, int water_mark)
315 size_t length = STACK_LENGTH;
316 size_t maximum_length = STACK_LEVEL_MAX - water_mark;
318 - return length > maximum_length;
319 + ret = length > maximum_length;
322 + ret = (VALUE*)rb_ia64_bsp() - ec->machine.register_stack_start >
323 + ec->machine.register_stack_maxsize/sizeof(VALUE) - water_mark;
329 #define stack_check(ec, water_mark) FALSE
330 @@ -6545,6 +6557,11 @@
332 gc_mark_locations(objspace, stack_start, stack_end, cb);
335 + gc_mark_locations(objspace,
336 + ec->machine.register_stack_start,
337 + ec->machine.register_stack_end, cb);
339 #if defined(__mc68000__)
340 gc_mark_locations(objspace,
341 (VALUE*)((char*)stack_start + 2),
342 @@ -7697,6 +7714,14 @@
343 return remembered_old_objects;
349 +Init_stack(volatile VALUE *addr)
351 + ruby_init_stack(addr);
356 * GC.verify_internal_consistency -> nil
357 diff -urN --exclude '*orig' ruby-3.1.5/gc.h ruby-3.1.5-ia64/gc.h
358 --- ruby-3.1.5/gc.h 2024-04-23 12:20:59.000000000 +0200
359 +++ ruby-3.1.5-ia64/gc.h 2024-05-30 11:40:09.200358132 +0200
361 #define USE_CONSERVATIVE_STACK_END
365 +#define RB_GC_SAVE_MACHINE_REGISTER_STACK(th) \
366 + do{(th)->ec->machine.register_stack_end = rb_ia64_bsp();}while(0)
368 +#define RB_GC_SAVE_MACHINE_REGISTER_STACK(th)
370 #define RB_GC_SAVE_MACHINE_CONTEXT(th) \
372 FLUSH_REGISTER_WINDOWS; \
373 + RB_GC_SAVE_MACHINE_REGISTER_STACK(th); \
374 setjmp((th)->ec->machine.regs); \
375 SET_MACHINE_STACK_END(&(th)->ec->machine.stack_end); \
377 diff -urN --exclude '*orig' ruby-3.1.5/ia64.S ruby-3.1.5-ia64/ia64.S
378 --- ruby-3.1.5/ia64.S 1970-01-01 01:00:00.000000000 +0100
379 +++ ruby-3.1.5-ia64/ia64.S 2024-05-30 11:18:37.592127736 +0200
381 +// rb_ia64_flushrs and rb_ia64_bsp is written in IA64 assembly language
382 +// because Intel Compiler for IA64 doesn't support inline assembly.
384 +// This file is based on following C program compiled by gcc.
386 +// void rb_ia64_flushrs(void) { __builtin_ia64_flushrs(); }
387 +// void *rb_ia64_bsp(void) { return __builtin_ia64_bsp(); }
389 +// Note that rb_ia64_flushrs and rb_ia64_bsp works in its own stack frame.
390 +// It's because BSP is updated by br.call/brl.call (not alloc instruction).
391 +// So rb_ia64_flushrs flushes stack frames including caller's one.
392 +// rb_ia64_bsp returns the address next to caller's register stack frame.
395 +// Intel Itanium Architecture Software Developer's Manual
396 +// Volume 2: System Architecture.
401 + .global rb_ia64_flushrs#
402 + .proc rb_ia64_flushrs#
409 + br.ret.sptk.many b0
410 + .endp rb_ia64_flushrs#
412 + .global rb_ia64_bsp#
420 + br.ret.sptk.many b0
422 + .ident "GCC: (GNU) 3.3.5 (Debian 1:3.3.5-13)"
423 diff -urN --exclude '*orig' ruby-3.1.5/include/ruby/defines.h ruby-3.1.5-ia64/include/ruby/defines.h
424 --- ruby-3.1.5/include/ruby/defines.h 2024-04-23 12:20:59.000000000 +0200
425 +++ ruby-3.1.5-ia64/include/ruby/defines.h 2024-05-30 11:19:49.568140575 +0200
427 void rb_sparc_flush_register_windows(void);
428 RBIMPL_SYMBOL_EXPORT_END()
429 # define FLUSH_REGISTER_WINDOWS rb_sparc_flush_register_windows()
430 +#elif defined(__ia64)
431 +void *rb_ia64_bsp(void);
432 +void rb_ia64_flushrs(void);
433 +# define FLUSH_REGISTER_WINDOWS rb_ia64_flushrs()
435 # define FLUSH_REGISTER_WINDOWS ((void)0)
437 diff -urN --exclude '*orig' ruby-3.1.5/include/ruby/internal/interpreter.h ruby-3.1.5-ia64/include/ruby/internal/interpreter.h
438 --- ruby-3.1.5/include/ruby/internal/interpreter.h 2024-04-23 12:20:59.000000000 +0200
439 +++ ruby-3.1.5-ia64/include/ruby/internal/interpreter.h 2024-05-30 11:22:22.408167838 +0200
442 void ruby_sysinit(int *argc, char ***argv);
447 * Calls ruby_setup() and check error.
451 * @param[in] addr A pointer somewhere on the stack, near its bottom.
453 -void ruby_init_stack(volatile VALUE *addr);
455 +void ruby_init_stack(volatile VALUE* addr, void* bsp);
456 +#define ruby_init_stack(addr) ruby_init_stack((addr), rb_ia64_bsp())
458 +void ruby_init_stack(volatile VALUE* addr);
460 +#define Init_stack(addr) ruby_init_stack(addr)
463 * Initializes the VM and builtin libraries.
464 diff -urN --exclude '*orig' ruby-3.1.5/thread.c ruby-3.1.5-ia64/thread.c
465 --- ruby-3.1.5/thread.c 2024-04-23 12:20:59.000000000 +0200
466 +++ ruby-3.1.5-ia64/thread.c 2024-05-30 11:43:47.988397160 +0200
468 # define PRI_THREAD_ID "p"
471 -NOINLINE(static int thread_start_func_2(rb_thread_t *th, VALUE *stack_start));
473 +#define thread_start_func_2(th, st, rst) thread_start_func_2(th, st)
475 +NOINLINE(static int thread_start_func_2(rb_thread_t *th, VALUE *stack_start,
476 + VALUE *register_stack_start));
478 void ruby_sigchld_handler(rb_vm_t *); /* signal.c */
483 // The thread stack doesn't exist in the forked process:
484 th->ec->machine.stack_start = th->ec->machine.stack_end = NULL;
486 + th->ec->machine.register_stack_start = th->ec->machine.register_stack_end = NULL;
489 rb_threadptr_root_fiber_terminate(th);
492 void rb_ec_clear_current_thread_trace_func(const rb_execution_context_t *ec);
495 -thread_start_func_2(rb_thread_t *th, VALUE *stack_start)
496 +thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_start)
498 STACK_GROW_DIR_DETECTION;
499 enum ruby_tag_type state;
501 rb_ec_initialize_vm_stack(th->ec, vm_stack, size);
502 th->ec->machine.stack_start = STACK_DIR_UPPER(vm_stack + size, vm_stack);
503 th->ec->machine.stack_maxsize -= size * sizeof(VALUE);
505 + th->ec->machine.register_stack_start = register_stack_start;
508 thread_debug("thread start (get lock): %p\n", (void *)th);
510 diff -urN --exclude '*orig' ruby-3.1.5/thread_pthread.c ruby-3.1.5-ia64/thread_pthread.c
511 --- ruby-3.1.5/thread_pthread.c 2024-04-23 12:20:59.000000000 +0200
512 +++ ruby-3.1.5-ia64/thread_pthread.c 2024-05-30 12:03:15.048605340 +0200
514 #define STACKADDR_AVAILABLE 1
515 #elif defined __HAIKU__
516 #define STACKADDR_AVAILABLE 1
517 +#elif defined __ia64 && defined _HPUX_SOURCE
518 +#include <sys/dyntune.h>
520 +#define STACKADDR_AVAILABLE 1
523 + * Do not lower the thread's stack to PTHREAD_STACK_MIN,
524 + * otherwise one would receive a 'sendsig: useracc failed.'
527 +#undef PTHREAD_STACK_MIN
529 +#define HAVE_PTHREAD_ATTR_GET_NP 1
530 +#undef HAVE_PTHREAD_ATTR_GETSTACK
533 + * As the PTHREAD_STACK_MIN is undefined and
534 + * no one touches the default stacksize,
535 + * it is just fine to use the default.
537 +#define pthread_attr_get_np(thid, attr) 0
540 + * Using value of sp is very rough... To make it more real,
541 + * addr would need to be aligned to vps_pagesize.
542 + * The vps_pagesize is 'Default user page size (kBytes)'
543 + * and could be retrieved by gettune().
546 +hpux_attr_getstackaddr(const pthread_attr_t *attr, void **addr)
548 + static uint64_t pagesize;
552 + if (gettune("vps_pagesize", &pagesize)) {
557 + pthread_attr_getstacksize(attr, &size);
558 + *addr = (void *)((size_t)((char *)_Asm_get_sp() - size) & ~(pagesize - 1));
561 +#define pthread_attr_getstackaddr(attr, addr) hpux_attr_getstackaddr(attr, addr)
564 #ifndef MAINSTACKADDR_AVAILABLE
566 rb_nativethread_id_t id;
567 size_t stack_maxsize;
570 + VALUE *register_stack_start;
572 } native_main_thread;
574 #ifdef STACK_END_ADDRESS
575 @@ -909,10 +957,19 @@
577 #undef ruby_init_stack
579 -ruby_init_stack(volatile VALUE *addr)
580 +ruby_init_stack(volatile VALUE *addr
586 native_main_thread.id = pthread_self();
589 + if (!native_main_thread.register_stack_start ||
590 + (VALUE*)bsp < native_main_thread.register_stack_start) {
591 + native_main_thread.register_stack_start = (VALUE*)bsp;
594 #if MAINSTACKADDR_AVAILABLE
595 if (native_main_thread.stack_maxsize) return;
597 @@ -1016,7 +1073,11 @@
598 rb_raise(rb_eNotImpError, "ruby engine can initialize only in the main thread");
603 + th->ec->machine.register_stack_start = native_main_thread.register_stack_start;
604 + th->ec->machine.stack_maxsize /= 2;
605 + th->ec->machine.register_stack_maxsize = th->ec->machine.stack_maxsize;
610 @@ -1044,9 +1105,9 @@
611 native_thread_init(th);
613 #if defined USE_NATIVE_THREAD_INIT
614 - thread_start_func_2(th, th->ec->machine.stack_start);
615 + thread_start_func_2(th, th->ec->machine.stack_start, rb_ia64_bsp());
617 - thread_start_func_2(th, &stack_start);
618 + thread_start_func_2(th, &stack_start, rb_ia64_bsp());
622 @@ -1181,6 +1242,10 @@
623 th->altstack = rb_allocate_sigaltstack();
625 th->ec->machine.stack_maxsize = stack_size - space;
627 + th->ec->machine.stack_maxsize /= 2;
628 + th->ec->machine.register_stack_maxsize = th->ec->machine.stack_maxsize;
631 CHECK_ERR(pthread_attr_init(&attr));
633 diff -urN --exclude '*orig' ruby-3.1.5/thread_win32.c ruby-3.1.5-ia64/thread_win32.c
634 --- ruby-3.1.5/thread_win32.c 2024-04-23 12:20:59.000000000 +0200
635 +++ ruby-3.1.5-ia64/thread_win32.c 2024-05-30 11:18:37.632127743 +0200
637 thread_debug("thread created (th: %p, thid: %p, event: %p)\n", th,
638 th->thread_id, th->native_thread_data.interrupt_event);
640 - thread_start_func_2(th, th->ec->machine.stack_start);
641 + thread_start_func_2(th, th->ec->machine.stack_start, rb_ia64_bsp());
643 w32_close_handle(thread_id);
644 thread_debug("thread deleted (th: %p)\n", th);
645 diff -urN --exclude '*orig' ruby-3.1.5/tool/m4/ruby_stack_grow_direction.m4 ruby-3.1.5-ia64/tool/m4/ruby_stack_grow_direction.m4
646 --- ruby-3.1.5/tool/m4/ruby_stack_grow_direction.m4 2024-04-23 12:20:59.000000000 +0200
647 +++ ruby-3.1.5-ia64/tool/m4/ruby_stack_grow_direction.m4 2024-05-30 11:18:37.636127744 +0200
649 AS_VAR_PUSHDEF([stack_grow_dir], [rb_cv_stack_grow_dir_$1])
650 AC_CACHE_CHECK(stack growing direction on $1, stack_grow_dir, [
652 -[m68*|x86*|x64|i?86|ppc*|sparc*|alpha*], [ $2=-1],
653 +[m68*|x86*|x64|i?86|ia64|ppc*|sparc*|alpha*], [ $2=-1],
656 AC_RUN_IFELSE([AC_LANG_SOURCE([[
657 diff -urN --exclude '*orig' ruby-3.1.5/vm.c ruby-3.1.5-ia64/vm.c
658 --- ruby-3.1.5/vm.c 2024-04-23 12:20:59.000000000 +0200
659 +++ ruby-3.1.5-ia64/vm.c 2024-05-30 11:18:37.644127745 +0200
660 @@ -3305,6 +3305,9 @@
662 extern VALUE *rb_gc_stack_start;
663 extern size_t rb_gc_stack_maxsize;
665 +extern VALUE *rb_gc_register_stack_start;
668 /* debug functions */
670 diff -urN --exclude '*orig' ruby-3.1.5/vm_core.h ruby-3.1.5-ia64/vm_core.h
671 --- ruby-3.1.5/vm_core.h 2024-04-23 12:20:59.000000000 +0200
672 +++ ruby-3.1.5-ia64/vm_core.h 2024-05-30 11:18:37.652127746 +0200
676 size_t stack_maxsize;
678 + VALUE *register_stack_start;
679 + VALUE *register_stack_end;
680 + size_t register_stack_maxsize;
682 RUBY_ALIGNAS(SIZEOF_VALUE) jmp_buf regs;
685 diff -urN --exclude '*orig' ruby-3.1.5/vm_dump.c ruby-3.1.5-ia64/vm_dump.c
686 --- ruby-3.1.5/vm_dump.c 2024-04-23 12:20:59.000000000 +0200
687 +++ ruby-3.1.5-ia64/vm_dump.c 2024-05-30 11:18:37.656127747 +0200
689 frame.AddrFrame.Offset = context.Rbp;
690 frame.AddrStack.Mode = AddrModeFlat;
691 frame.AddrStack.Offset = context.Rsp;
692 +#elif defined(_M_IA64) || defined(__ia64__)
693 + mac = IMAGE_FILE_MACHINE_IA64;
694 + frame.AddrPC.Mode = AddrModeFlat;
695 + frame.AddrPC.Offset = context.StIIP;
696 + frame.AddrBStore.Mode = AddrModeFlat;
697 + frame.AddrBStore.Offset = context.RsBSP;
698 + frame.AddrStack.Mode = AddrModeFlat;
699 + frame.AddrStack.Offset = context.IntSp;
701 mac = IMAGE_FILE_MACHINE_I386;
702 frame.AddrPC.Mode = AddrModeFlat;
703 diff -urN --exclude '*orig' ruby-3.1.5/win32/Makefile.sub ruby-3.1.5-ia64/win32/Makefile.sub
704 --- ruby-3.1.5/win32/Makefile.sub 2024-04-23 12:20:59.000000000 +0200
705 +++ ruby-3.1.5-ia64/win32/Makefile.sub 2024-05-30 11:37:57.340334611 +0200
710 -!if "$(ARCH)" == "x64"
711 +!if "$(ARCH)" == "x64" || "$(ARCH)" == "ia64"
716 #define NUM2CLOCKID(v) NUM2INT(v)
717 #define SIZEOF_CLOCK_T 4
718 #define SIZEOF_RLIM_T 0
719 -!if "$(ARCH)" == "x64"
720 +!if "$(ARCH)" == "x64" || "$(ARCH)" == "ia64" || "$(ARCH)" == "ia64"
721 #define SIZEOF_SIZE_T 8
722 #define SIZEOF_PTRDIFF_T 8
723 #define SIZEOF_INTPTR_T 8
726 #define PACKED_STRUCT(x) x
728 -!if "$(MACHINE)" == "x86" || "$(ARCH)" == "x64"
729 +!if "$(MACHINE)" == "x86" || "$(ARCH)" == "x64" || "$(ARCH)" == "ia64"
730 #define PACKED_STRUCT_UNALIGNED(x) PACKED_STRUCT(x)
732 #define PACKED_STRUCT_UNALIGNED(x) x
734 #define HAVE_INTPTR_T 1
735 #define HAVE_UINTPTR_T 1
736 #define HAVE_SSIZE_T 1
737 -!if "$(ARCH)" == "x64"
738 +!if "$(ARCH)" == "x64" || "$(ARCH)" == "ia64"
739 #define ssize_t __int64
740 #define PRI_PTR_PREFIX "I64"
745 #define NEED_IO_SEEK_BETWEEN_RW 1
746 -!if "$(MACHINE)" == "x86" || "$(ARCH)" == "x64"
747 +!if "$(MACHINE)" == "x86" || "$(ARCH)" == "x64" || "$(ARCH)" == "ia64"
748 #define STACK_GROW_DIRECTION -1
750 #define COROUTINE_H "$(COROUTINE_H)"
751 diff -urN --exclude '*orig' ruby-3.1.5/win32/README.win32 ruby-3.1.5-ia64/win32/README.win32
752 --- ruby-3.1.5/win32/README.win32 2024-04-23 12:20:59.000000000 +0200
753 +++ ruby-3.1.5-ia64/win32/README.win32 2024-05-30 11:18:37.668127749 +0200
756 2. Visual C++ 12.0 (2013) or later.
758 - [Note] if you want to build x64 version, use native compiler for
760 + [Note] if you want to build x64 or ia64 version, use native compiler for
763 3. Please set environment variable +INCLUDE+, +LIB+, +PATH+
764 to run required commands properly from the command line.
765 diff -urN --exclude '*orig' ruby-3.1.5/win32/configure.bat ruby-3.1.5-ia64/win32/configure.bat
766 --- ruby-3.1.5/win32/configure.bat 2024-04-23 12:20:59.000000000 +0200
767 +++ ruby-3.1.5-ia64/win32/configure.bat 2024-05-30 11:18:37.668127749 +0200
770 echo>> ~tmp~.mak "%~2" \
771 echo>>confargs.tmp --target=%2 \
772 - if NOT "%~2" == "x64-mswin64" goto target3
773 + if "%~2" == "x64-mswin64" goto target2
774 + if NOT "%~2" == "ia64-mswin64" goto target3
776 echo>> ~tmp~.mak "TARGET_OS=mswin64" \
778 diff -urN --exclude '*orig' ruby-3.1.5/win32/setup.mak ruby-3.1.5-ia64/win32/setup.mak
779 --- ruby-3.1.5/win32/setup.mak 2024-04-23 12:20:59.000000000 +0200
780 +++ ruby-3.1.5-ia64/win32/setup.mak 2024-05-30 11:18:37.668127749 +0200
782 i686-mswin32: -prologue- -i686- -epilogue-
783 alpha-mswin32: -prologue- -alpha- -epilogue-
784 x64-mswin64: -prologue- -x64- -epilogue-
785 +ia64-mswin64: -prologue- -ia64- -epilogue-
787 -prologue-: -basic-vars-
790 @$(CPP) <<conftest.c 2>nul | findstr = >>$(MAKEFILE)
793 +#elif defined _M_IA64
799 @echo MACHINE = alpha>>$(MAKEFILE)
801 @echo MACHINE = x64>>$(MAKEFILE)
803 + @echo MACHINE = ia64>>$(MAKEFILE)
805 @echo MACHINE = x86>>$(MAKEFILE)