Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Sep 2018 13:37:37 +0000 (UTC)
From:      Niclas Zeising <zeising@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r480907 - head/x11/alacritty/files
Message-ID:  <201809291337.w8TDbb4M003874@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: zeising
Date: Sat Sep 29 13:37:37 2018
New Revision: 480907
URL: https://svnweb.freebsd.org/changeset/ports/480907

Log:
  x11/alacritty: Fix build on 32bit architectures
  
  Pull in commit a769e80 from upstream (with some fixes to make it apply) to
  fix build on 32bit architectures.

Added:
  head/x11/alacritty/files/
  head/x11/alacritty/files/patch-src_grid_storage.rs   (contents, props changed)

Added: head/x11/alacritty/files/patch-src_grid_storage.rs
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/x11/alacritty/files/patch-src_grid_storage.rs	Sat Sep 29 13:37:37 2018	(r480907)
@@ -0,0 +1,41 @@
+From a769e80eb4383b4c4a274c5ad192958961122d09 Mon Sep 17 00:00:00 2001
+From: Johannes <jnbr_github@jnbr.me>
+Date: Thu, 20 Sep 2018 02:04:07 +0200
+Subject: [PATCH] Fix build failure on 32-bit machines
+
+Alacritty has some checks in place to make sure that unsafe
+code would not fail because of invalid struct sizes. This managed
+to successfully catch an incorrect unsafe block on 32-bit machines.
+
+To make sure this block works on both 32-bit and 64-bit systems,
+it has been altered to make use of the platform-dependent `usize`
+type. This will always make use of correct sizes without having to
+rely on conditional compilation.
+--- src/grid/storage.rs.orig	2018-09-29 13:21:20 UTC
++++ src/grid/storage.rs
+@@ -223,7 +223,7 @@ impl<T> Storage<T> {
+     /// instructions. This implementation achieves the swap in only 8 movups
+     /// instructions.
+     pub fn swap(&mut self, a: usize, b: usize) {
+-        assert_eq_size!(Row<T>, [u32; 8]);
++        assert_eq_size!(Row<T>, [usize; 4]);
+ 
+         let a = self.compute_index(a);
+         let b = self.compute_index(b);
+@@ -232,13 +232,13 @@ impl<T> Storage<T> {
+             // Cast to a qword array to opt out of copy restrictions and avoid
+             // drop hazards. Byte array is no good here since for whatever
+             // reason LLVM won't optimized it.
+-            let a_ptr = self.inner.as_mut_ptr().offset(a as isize) as *mut u64;
+-            let b_ptr = self.inner.as_mut_ptr().offset(b as isize) as *mut u64;
++            let a_ptr = self.inner.as_mut_ptr().add(a) as *mut usize;
++            let b_ptr = self.inner.as_mut_ptr().add(b) as *mut usize;
+ 
+             // Copy 1 qword at a time
+             //
+             // The optimizer unrolls this loop and vectorizes it.
+-            let mut tmp: u64;
++            let mut tmp: usize;
+             for i in 0..4 {
+                 tmp = *a_ptr.offset(i);
+                 *a_ptr.offset(i) = *b_ptr.offset(i);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201809291337.w8TDbb4M003874>