Skip to content

Commit

Permalink
Upgrade to Crystal 1.10.1 and fix CI build.
Browse files Browse the repository at this point in the history
  • Loading branch information
jemc committed Apr 21, 2024
1 parent 72f4ab3 commit 73835d0
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 26 deletions.
10 changes: 7 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ task:
MAKE: make
CC: clang
CXX: clang++
CRYSTAL_VERSION: "1.8.0"
CRYSTAL_VERSION: "1.10.1"

matrix:
- name: x86_64-unknown-linux-gnu
Expand Down Expand Up @@ -44,7 +44,7 @@ task:
# in the triple, where we'd otherwise use `x86_64-unknown-linux-musl`.
MAKE_EXTRA_ARGS: CLANG_TARGET_PLATFORM=x86_64-alpine-linux-musl
container:
image: alpine:3.18
image: alpine:3.19
cpu: 2
memory: 8G

Expand All @@ -61,7 +61,7 @@ task:
# We also need to use `aarch64` instead of `arm64` here...
MAKE_EXTRA_ARGS: CLANG_TARGET_PLATFORM=aarch64-alpine-linux-musl
arm_container:
image: alpine:3.18
image: alpine:3.19
cpu: 2
memory: 8G

Expand All @@ -88,6 +88,8 @@ task:
DEPS_INSTALL: "
brew update --preinstall && brew install libiconv libgc libevent pcre && brew cleanup && \
curl -L --fail --retry 10 https://github.com/crystal-lang/crystal/releases/download/${CRYSTAL_VERSION}/crystal-${CRYSTAL_VERSION}-1-darwin-universal.tar.gz | tar -xvzf - -C /tmp && \
echo $PATH && \
sudo mkdir -p /usr/local/bin && \
sudo ln -s /tmp/crystal-${CRYSTAL_VERSION}-1/bin/crystal /usr/local/bin/crystal && \
crystal --version"
# Set up the SDKROOT path specific to the present XCode version.
Expand All @@ -111,6 +113,8 @@ task:
DEPS_INSTALL: "
brew update --preinstall && brew cleanup && \
curl -L --fail --retry 10 https://github.com/crystal-lang/crystal/releases/download/${CRYSTAL_VERSION}/crystal-${CRYSTAL_VERSION}-1-darwin-universal.tar.gz | tar -xvzf - -C /tmp && \
echo $PATH && \
sudo mkdir -p /usr/local/bin && \
sudo ln -s /tmp/crystal-${CRYSTAL_VERSION}-1/bin/crystal /usr/local/bin/crystal && \
crystal --version && \
mkdir /tmp/x86_64 && \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
fail-fast: false
matrix:
include:
- crystal: "1.8.0"
- crystal: "1.10.1"
os: ubuntu-20.04
deps: sudo apt-get install -y capnproto libgc-dev
- crystal: "1.8.0"
- crystal: "1.10.1"
os: macos-12 # upgrade to macos-13 when available
deps: brew install libgc capnp
runs-on: ${{matrix.os}}
Expand Down
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ dependencies:
github: at-grandpa/clim
version: 0.13.0

crystal: 1.8.0
crystal: 1.10.1

license: MPLv2
39 changes: 19 additions & 20 deletions src/savi/compiler/code_gen/debug_info.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ class Savi::Compiler::CodeGen
filename = "(main)"
dirname = ""

@di.create_compile_unit(LANGUAGE_ID, filename, dirname, "Savi", false, "", 0)
@di.create_compile_unit(
LLVM::DwarfSourceLanguage.new(LANGUAGE_ID - 1),
filename, dirname, "Savi", false, "", 0
)
end

def finish
Expand Down Expand Up @@ -87,7 +90,8 @@ class Savi::Compiler::CodeGen
)
expr = @di.create_expression(nil, 0)

@di.insert_declare_at_end(storage, info, expr, @builder.current_debug_location, @builder.insert_block.not_nil!)
dl = LibLLVM.value_as_metadata(@builder.current_debug_location)
@di.insert_declare_at_end(storage, info, expr, dl, @builder.insert_block.not_nil!)
end

def metadata(args)
Expand Down Expand Up @@ -234,17 +238,15 @@ class Savi::Compiler::CodeGen
@target_data.abi_alignment(llvm_type) * 8,
LLVM::DIFlags::Zero,
nil,
@di.get_or_create_type_array(
member_infos.map do |index, (member_name, member_llvm_type, member_di_type)|
@di.create_member_type(nil, member_name, nil, 1,
@target_data.abi_size(member_llvm_type) * 8,
@target_data.abi_alignment(member_llvm_type) * 8,
@target_data.offset_of_element(llvm_type, index) * 8,
LLVM::DIFlags::Zero,
member_di_type,
)
end.compact
)
member_infos.map do |index, (member_name, member_llvm_type, member_di_type)|
@di.create_member_type(nil, member_name, nil, 1,
@target_data.abi_size(member_llvm_type) * 8,
@target_data.abi_alignment(member_llvm_type) * 8,
@target_data.offset_of_element(llvm_type, index) * 8,
LLVM::DIFlags::Zero,
member_di_type,
)
end.compact
)
end

Expand All @@ -259,11 +261,9 @@ class Savi::Compiler::CodeGen
di_create_basic_type(t, llvm_type, LLVM::DwarfTypeEncoding::Unsigned)
end

di_members = @di.get_or_create_array(
t.find_enum_members!(ctx).map { |member|
@di.create_enumerator(member.ident.value, member.value)
}
)
di_members = t.find_enum_members!(ctx).map { |member|
@di.create_enumerator(member.ident.value, member.value)
}

@di.create_enumeration_type(
pos.try { |pos| di_file(pos.source) },
Expand Down Expand Up @@ -320,8 +320,7 @@ class Savi::Compiler::CodeGen
def di_func_type(gfunc : GenFunc, file : LibLLVM::MetadataRef)
# This is just a stub that pretends there is just one int parameter.
int = @di.create_basic_type("int", 32, 32, LLVM::DwarfTypeEncoding::Signed)
param_types = @di.get_or_create_type_array([int])
@di.create_subroutine_type(file, param_types)
@di.create_subroutine_type(file, [int])
end
end
end

0 comments on commit 73835d0

Please sign in to comment.