git/list[1] front-page[2] threads[3] people[4] search[5] about
 

jc/lookup-object-hash from pu crashes on ARM

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 31, 2011, 12:56 UTC
Message-ID
<20111031125648.GA1757@elie.hsd1.il.comcast.net>
In-Reply-To
<7vzkglrnmc.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 7 quoted lines
> * jc/lookup-object-hash (2011-08-11) 6 commits
>  - object hash: replace linear probing with 4-way cuckoo hashing
>  - object hash: we know the table size is a power of two
>  - object hash: next_size() helper for readability
>  - pack-objects --count-only
>  - object.c: remove duplicated code for object hashing
>  - object.c: code movement for readability

The code from the tip commit crashes on ARM for me (and presumably would also misbehave on other platforms that care about alignment):

 $ git branch -av
 Bus error
The following might avoid that:
	static inline unsigned int H(const unsigned char *sha1, int ix)
	{
		unsigned int hash;
		memcpy(&hash, sha1 + ix * sizeof(unsigned int),
				sizeof(unsigned int));
		return hash % (obj_hash_size - 1);
	}

Even better could be to start aligning the hashes we pass around, using something like this:

	union object_hash {
		unsigned char sha1[20];
		uint32_t chunk[5];
	};

which could speed up functions like hashcpy(), hashcmp(), and hasheq(). But it's probably not worth the fuss.

Call chain:
	cmd_branch -> print_ref_list -> for_each_rawref ->
	  do_for_each_ref -> do_one_ref(entry=0x175508) ->
	  append_ref(sha1=0x175509) ->
	  lookup_commit_reference_gently -> parse_object ->
	  parse_object_buffer -> lookup_commit -> lookup_object

This is from testing pu (ed7c265e), in case that's relevant. Aside from that, the topic looks neat. :)

Previous: Johannes SixtNext: Junio C Hamano
Message 4 of 5 in “What's cooking in git.git (Oct 2011, #11; Fri, 28)”
  1. Junio C HamanoOct 28, 2011
  2. Erik Faye-LundOct 29, 2011
  3. Johannes SixtOct 30, 2011
  4. jc/lookup-object-hash from pu crashes on ARMJonathan Nieder, Oct 31, 2011
  5. Junio C HamanoOct 31, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.