From: Tanaka Akira Date: 2005-06-07T20:06:32+09:00 Subject: Re: Rails on Altix ia64 In article , "Adam P. Jenkins" writes: > Has anyone successfully run a Rails application on an Altix, or other > ia64 machine? I'm getting a segmentation fault in gc.c. More info below. I'd like to know following patch fix your problem or not. Index: eval.c =================================================================== RCS file: /src/ruby/eval.c,v retrieving revision 1.616.2.98 diff -u -r1.616.2.98 eval.c --- eval.c 25 May 2005 23:09:05 -0000 1.616.2.98 +++ eval.c 7 Jun 2005 11:02:32 -0000 @@ -111,7 +111,27 @@ abort(); /* ensure noreturn */ } #define longjmp(env, val) rb_jump_context(env, val) -#define setjmp(j) ((j)->status = 0, getcontext(&(j)->context), (j)->status) +#define callee_save_registers_may_be_breaked_here \ + __asm__ volatile ("" : : : \ + "in0", "in1", "in2", "in3", "in4", "in5", "in6", "in7", \ + "loc0", "loc1", "loc2", "loc3", "loc4", "loc5", "loc6", "loc7", \ + "loc8", "loc9", "loc10","loc11","loc12","loc13","loc14","loc15", \ + "loc16","loc17","loc18","loc19","loc20","loc21","loc22","loc23", \ + "loc24","loc25","loc26","loc27","loc28","loc29","loc30","loc31", \ + "loc32","loc33","loc34","loc35","loc36","loc37","loc38","loc39", \ + "loc40","loc41","loc42","loc43","loc44","loc45","loc46","loc47", \ + "loc48","loc49","loc50","loc51","loc52","loc53","loc54","loc55", \ + "loc56","loc57","loc58","loc59","loc60","loc61","loc62","loc63", \ + "loc64","loc65","loc66","loc67","loc68","loc69","loc70","loc71", \ + "loc72","loc73","loc74","loc75","loc76","loc77","loc78","loc79", \ + "out0", "out1", "out2", "out3", "out4", "out5", "out6", "out7"); +#define setjmp(j) ({ \ + ucontext_t *ucp; \ + (j)->status = 0; \ + ucp = &(j)->context; \ + callee_save_registers_may_be_breaked_here; \ + getcontext(ucp); \ + (j)->status; }) #else typedef jmp_buf rb_jmpbuf_t; #ifndef setjmp @@ -9918,8 +9938,10 @@ { ucontext_t ctx; VALUE *top, *bot; + ucontext_t *ctxp = &ctx; - getcontext(&ctx); + callee_save_registers_may_be_breaked_here; + getcontext(ctxp); bot = (VALUE*)__libc_ia64_register_backing_store_base; #if defined(__FreeBSD__) top = (VALUE*)ctx.uc_mcontext.mc_special.bspstore; I know the patch is very ugly, gcc&IA64 depended, and it tickle gcc-3.3.5 optimization bug. -- Tanaka Akira