Skip to content

Instantly share code, notes, and snippets.

View chriswailes's full-sized avatar

Chris Wailes chriswailes

View GitHub Profile
@chriswailes
chriswailes / sumOfMembers.cpp
Created June 22, 2016 21:01
An example usage of the points-to-member access operator in C++
#include <iostream>
#include <vector>
template <typename MemberType0, typename MemberType1>
struct S {
MemberType0 m0;
MemberType1 m1;
S(MemberType0 arg_m0, MemberType1 arg_m1) : m0(arg_m0), m1(arg_m1) {}
};
@chriswailes
chriswailes / cmake_command.txt
Created April 21, 2016 17:46
LLVM CMake Invocation
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=On -DLINK_POLLY_INTO_TOOLS=On -DLLVM_OPTIMIZED_TABLEGEN=On -DLLVM_TOOL_COMPILER_RT_BUILD=On -DLLVM_TOOL_LLVM_GO_BUILD=Off -DLLVM_TOOL_XCODE_TOOLCHAIN_BUILD=Off -DLLVM_BINUTILS_INCDIR=/usr/include -DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=Off -DLLVM_TOOL_LLD_BUILD=On -DLLVM_TOOL_LLDB_BUILD=Off ../../
@chriswailes
chriswailes / error.txt
Created April 21, 2016 16:40
LLD Build Failure
[1558/1647] Linking CXX shared library lib/liblldReaderWriter.so
FAILED: : && /usr/local/bin/clang++ -fPIC -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -std=c++11 -fcolor-diagnostics -ffunction-sections -fdata-sections -O3 -DNDEBUG -Wl,-z,defs -Wl,-O3 -Wl,--gc-sections -shared -Wl,-soname,liblldReaderWriter.so -o lib/liblldReaderWriter.so tools/lld/lib/ReaderWriter/CMakeFiles/lldReaderWriter.dir/CoreLinkingContext.cpp.o tools/lld/lib/ReaderWriter/CMakeFiles/lldReaderWriter.dir/FileArchive.cpp.o tools/lld/lib/ReaderWriter/CMakeFiles/lldReaderWriter.dir/LinkerScript.cpp.o lib/liblldCore.so lib/liblldYAML.so lib/libLLVMObject.so lib/libLLVMSupport.so -Wl,-rpath,"\$ORIGIN/../lib" && :
tools/lld/lib/ReaderWriter/CMakeFiles/lldReaderWriter.dir/FileArchive.cpp.o:../../tools/lld/lib/ReaderWriter/FileArchive.cpp:function std::thread::thread<lld
@chriswailes
chriswailes / pagesize.c
Created March 11, 2016 20:46
Calculate the size of a memory page on your system.
#define _GNU_SOURCE
#include <signal.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <ucontext.h>
volatile int done;
(CallExpr .v
(SymExpr 'chpl__followIdx:(_ref(real(64)),_ref(int(64)))')
(SymExpr 'x2:_ref(int(64))')))
@chriswailes
chriswailes / gist:7374121
Created November 8, 2013 17:00
Error message from `git svn dcommit`
Committing to http://svn.code.sf.net/p//code/trunk ...
ERROR from SVN:
URL access forbidden for unknown reason: Access to '/p/chapel/code/!svn/me' forbidden
W: 05cce810ea190016cfbf010cf3ae4a65a48d3dc0 and refs/remotes/trunk differ, using rebase:
:040000 040000 f09de67b4ac43c434a41fdc411996dd41a048a7e a163882d878563c75d45913fb0dffd29d9eb1d2b M util
Current branch master is up to date.
ERROR: Not all changes have been committed into SVN, however the committed
ones (if any) seem to be successfully integrated into the working tree.
Please see the above messages for details.
@chriswailes
chriswailes / gist:7220312
Created October 29, 2013 18:43
LValue written as RValue
#include <utility>
class Foo {
public:
void operator=(Foo&& other);
};
int main(void) {
Foo a, b;
#!/usr/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
@chriswailes
chriswailes / gist:7200825
Created October 28, 2013 17:17
Gem::LoadError output from Ruby
[me@dhalgren ~]$ rake
/usr/share/rubygems/rubygems/dependency.rb:296:in `to_specs': Could not find 'rake' (>= 0) among 5 total gem(s) (Gem::LoadError)
from /usr/share/rubygems/rubygems/dependency.rb:307:in `to_spec'
from /usr/share/rubygems/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /home/me/.gem/bin/rake:22:in `<main>'
@chriswailes
chriswailes / Atomics.chpl Snippet
Last active December 10, 2015 20:28
A set of chpl_defaultHash implementations for atomic types.
inline proc chpl__defaultHash(ref aflag:atomic_flag):int(64) {
if (atomic_load_explicit_flag(aflag, memory_order_consume)) then
return 0;
else
return 1;
}
inline proc chpl__defaultHash(ref auint:atomic_uint_least8_t):int(64) {
return _gen_key(atomic_load_explicit_uint_least8_t(auint, memory_order_consume):int(64));
}