Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Last active November 5, 2019 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dogbert17/b74f1c978a7cf6df2562be3668979b26 to your computer and use it in GitHub Desktop.
Save dogbert17/b74f1c978a7cf6df2562be3668979b26 to your computer and use it in GitHub Desktop.
MultiCache for cas
Have added code dumping the 'cas' cache each time something has been added to it, like this:
MVMCode *code = (MVMCode *)MVM_frame_find_invokee(tc, result, NULL);
char *name = MVM_string_utf8_encode_C_string(tc, code->body.sf->body.name);
if (strcmp(name, "cas") == 0) {
printf("Made new entry for callsite with %d object arguments\n", num_obj_args);
printf("Multi cache for %s reached %d entries\n", name, cache->num_results);
dump_cache(tc, cache);
}
MVM_free(name);
Here are the results from a run which fails:
ok 1 - Lock::Async provides mutual exclusion when doing +=
1..1
Made new entry for callsite with 3 object arguments
Multi cache for cas reached 2 entries
Multi cache at 0x5606b12d1708 (11 nodes, 2 results)
- 0x7f1c158bb580 -> (Y: 8, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- 0x3b920 -> (Y: 9, N: 0)
- 0x3b901 -> (Y: 10, N: 0)
- 0x3b912 -> (Y: -1, N: 0)
Made new entry for callsite with 3 object arguments
Multi cache for cas reached 3 entries
Multi cache at 0x5606b12d1708 (14 nodes, 3 results)
- 0x7f1c158bb580 -> (Y: 8, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- 0x3b920 -> (Y: 9, N: 11)
- 0x3b901 -> (Y: 10, N: 0)
- 0x3b912 -> (Y: -1, N: 0)
- 0x3b930 -> (Y: 12, N: 0)
- 0x3b911 -> (Y: 13, N: 0)
- 0x3b902 -> (Y: -2, N: 0)
Made new entry for callsite with 2 object arguments
Multi cache for cas reached 4 entries
Multi cache at 0x7f1c04069e78 (17 nodes, 4 results)
- 0x7f1c158bb580 -> (Y: 8, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- 0x7f1c158bb5e0 -> (Y: 14, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- 0x3b920 -> (Y: 9, N: 11)
- 0x3b901 -> (Y: 10, N: 0)
- 0x3b912 -> (Y: -1, N: 0)
- 0x3b930 -> (Y: 12, N: 0)
- 0x3b911 -> (Y: 13, N: 0)
- 0x3b902 -> (Y: -2, N: 0)
- 0x20f30 -> (Y: 15, N: 0)
- 0x20411 -> (Y: -3, N: 0)
- (nil) -> (Y: 0, N: 0)
Made new entry for callsite with 3 object arguments
Multi cache for cas reached 5 entries
Multi cache at 0x7f1c04069e78 (18 nodes, 5 results)
- 0x7f1c158bb580 -> (Y: 8, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- 0x7f1c158bb5e0 -> (Y: 14, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- 0x3b920 -> (Y: 9, N: 11)
- 0x3b901 -> (Y: 10, N: 0)
- 0x3b912 -> (Y: -1, N: 0)
- 0x3b930 -> (Y: 12, N: 0)
- 0x3b911 -> (Y: 13, N: 0)
- 0x3b902 -> (Y: -2, N: 17)
- 0x20f30 -> (Y: 15, N: 0)
- 0x20411 -> (Y: -3, N: 0)
- (nil) -> (Y: 0, N: 0)
- 0x3b912 -> (Y: -4, N: 0)
The next time MVM_multi_cache_add is called the corruption is detected. Dumping the cache at that point show that it looks exactly as it does above.
Multi cache for cas reached 5 entries
Multi cache at 0x7f1c04069e78 (18 nodes, 5 results)
- 0x7f1c158bb580 -> (Y: 8, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- 0x7f1c158bb5e0 -> (Y: 14, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- (nil) -> (Y: 0, N: 0)
- 0x3b920 -> (Y: 9, N: 11)
- 0x3b901 -> (Y: 10, N: 0)
- 0x3b912 -> (Y: -1, N: 0)
- 0x3b930 -> (Y: 12, N: 0)
- 0x3b911 -> (Y: 13, N: 0)
- 0x3b902 -> (Y: -2, N: 17)
- 0x20f30 -> (Y: 15, N: 0)
- 0x20411 -> (Y: -3, N: 0)
- (nil) -> (Y: 0, N: 0)
- 0x3b912 -> (Y: -4, N: 0)
MoarVM panic: Corrupt multi dispatch cache: cur_node != 0, re-check == (nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment