From: "jhawthorn (John Hawthorn)" Date: 2021-12-28T05:55:39+00:00 Subject: [ruby-core:106862] [Ruby master Bug#18439] Support YJIT for VC++ Issue #18439 has been updated by jhawthorn (John Hawthorn). > YJIT requires OPT_DIRECT_THREADED_CODE or OPT_CALL_THREADED_CODE in rb_yjit_compile_iseq(). What option do we use under windows? > Maybe ABI differs between VC++ and YJIT's expectation. Yes. We would need to switch to the Windows calling convention, which is different enough to be a non-trivial change. It only passes 4 arguments via registers vs 6 in the System V ABI (and also uses different registers) as well as requiring 32 bytes of reserved stack space from the callee ("shadow space"). I think we could likely do this with minimal (but non-trivial) changes by: * Reserving the 32 bytes of stack "shadow space" in the YJIT entrypoint * Reserving another 16 bytes on the stack in the YJIT entrypoint for the 5th and 6th argument * This could be an opportunity to do the same and support more arguments on SysV as well * Conditionally under Windows defining `C_ARG_REGS` as `RCX, RDX, R8, R9, [RSP+32], [RSP+40]` * Rewriting the two instructions (`gen_toregexp`/`gen_newhash`) whose codegen currently modifies the machine stack (we could use a relative stack location instead of push/pop, a callee-saved register, or introduce runtime helper methods) However I'd like to hear the opinions of YJIT folks when they're back from holidays next week on whether this is the best way to approach this. ---------------------------------------- Bug #18439: Support YJIT for VC++ https://bugs.ruby-lang.org/issues/18439#change-95673 * Author: usa (Usaku NAKAMURA) * Status: Open * Priority: Normal * Assignee: maximecb (Maxime Chevalier-Boisvert) * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- I heard that supporting YJIT for VC++ needs mmap from k0kubun-san, so I implemented tiny mmap emulation on Windows and committed it to master. And, I found we need more changes to actually enabled YJIT for VC++, at least: - YJIT requires `OPT_DIRECT_THREADED_CODE` or `OPT_CALL_THREADED_CODE` in `rb_yjit_compile_iseq()`. Really? - Maybe ABI deffers between VC++ and YJIT's expectation. Can I get support to fix above? -- https://bugs.ruby-lang.org/ Unsubscribe: