Skip to content

Conversation

@ptersilie
Copy link
Contributor

These changes add yk to ruby and allow us to run this very simple program:

x = 2000000
puts "while"
while x >= 1111
  #print "."
  x = x - 1
end
puts "end"

On top of these changes we also have to edit the Makefile generates by the configure script. I'm unsure how we should version control this right now. We might need to edit the configure script directly to output the correct Makefile.

So to build we need to do:

Configure Ruby with:

mkdir build
cd build
../configure --disable-yjit optflags="-O0 -fno-omit-frame-pointer"

Adjust the build/Makefile as follows:

YKPATH = /home/lukasd/research/yk
YKBUILDTYPE = debug
ARCH_FLAG = -flto
CC = `yk-config ${YKBUILDTYPE} --cc` -gdwarf-4 -g
CFLAGS = $(CFLAGS_NO_ARCH) $(ARCH_FLAG) -I$(YKPATH)/ykcapi
LDFLAGS =  $(CFLAGS) -L. -rdynamic -Wl,-export-dynamic -fuse-ld=lld -Wl,-mllvm=--yk-embed-ir -Wl,--wrap=pthread_create -Wl,--mllvm=--disable-branch-fold -Wl,--mllvm=--disable-block-placement -Wl,--mllvm=--disable-early-taildup -Wl,--mllvm=--disable-tail-duplicate -Wl,--mllvm=--yk-disable-tail-call-codegen -Wl,--mllvm=--yk-no-fallthrough -Wl,--mllvm=--yk-patch-control-point -Wl,--mllvm=--yk-insert-stackmaps -Wl,--mllvm=--yk-split-blocks-after-calls -Wl,--mllvm=--yk-block-disambiguate -Wl,--mllvm=--yk-basicblock-tracer -Wl,--mllvm=--yk-no-calls-in-entryblocks -Wl,--mllvm=--yk-stackmap-spillreloads-fix -Wl,--mllvm=--yk-shadow-stack -Wl,--mllvm=--yk-stackmap-add-locs -Wl,--mllvm=--yk-dont-opt-func-abi -Wl,--mllvm=--yk-optnone-after-ir-passes -Wl,--lto-basic-block-sections=labels -Wl,--export-dynamic -Wl,--mllvm=--yk-linkage -L${YKPATH}/bin/../target/${YKBUILDTYPE}/deps -Wl,-rpath=${YKPATH}/bin/../target/${YKBUILDTYPE}/deps -Wl,-rpath=${YKPATH}/target/${YKBUILDTYPE}/ykllvm/lib

Then run make miniruby to build miniruby.

@ptersilie
Copy link
Contributor Author

This depends on ykjit/yk#1858.

@vext01
Copy link
Contributor

vext01 commented Sep 15, 2025

We discussed this on the sync and @ptersilie is going to try and minimise the amount of manual patching required (where possible without large changes to the build system).

@ptersilie
Copy link
Contributor Author

Added a commit to make building easier. Needs squashing.

@ltratt
Copy link
Contributor

ltratt commented Sep 18, 2025

Please squash.

@ptersilie
Copy link
Contributor Author

Squashed.

@ltratt ltratt added this pull request to the merge queue Sep 18, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 18, 2025
@ptersilie
Copy link
Contributor Author

Ah this also needs the new clang. Ok to squash?

@ltratt
Copy link
Contributor

ltratt commented Sep 18, 2025

Please squash.

@ptersilie
Copy link
Contributor Author

Squashed.

@ltratt ltratt added this pull request to the merge queue Sep 18, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 18, 2025
@ptersilie
Copy link
Contributor Author

This went through with tryci now. Ok to squash?

@vext01
Copy link
Contributor

vext01 commented Sep 18, 2025

Please squash

@ptersilie
Copy link
Contributor Author

Squashed.

@vext01 vext01 added this pull request to the merge queue Sep 18, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 18, 2025
@ptersilie
Copy link
Contributor Author

Force pushed a change. Try again.

The problem was that docker copies in the build directory, so we need to remove it, if it was created. Sadly docker's COPY can't exclude folders, at least not the version we are using.

@ltratt ltratt added this pull request to the merge queue Sep 18, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 18, 2025
@ltratt ltratt added this pull request to the merge queue Sep 18, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 18, 2025
Co-authored-by: Jake Hughes <[email protected]>
@ptersilie
Copy link
Contributor Author

Okay, fixed and trycied on a fresh checkout. Hopefully this will go through now.

@vext01 vext01 added this pull request to the merge queue Sep 18, 2025
Merged via the queue into ykjit:master with commit 03beed8 Sep 18, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants