This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compile me with: clang -c mul.c -o mul.o | |
int mul (int a, int b) { | |
return a * b; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gobjdump -j .text -d mul.o -M intel | |
Disassembly of section .text: | |
0000000000000000 <_mul>: | |
0: 55 push rbp | |
1: 48 89 e5 mov rbp,rsp | |
4: 89 7d fc mov DWORD PTR [rbp-0x4],edi | |
7: 89 75 f8 mov DWORD PTR [rbp-0x8],esi | |
a: 8b 75 fc mov esi,DWORD PTR [rbp-0x4] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> // printf | |
#include <string.h> // memcpy | |
#include <sys/mman.h> // mmap, munmap | |
int main () { | |
// Hexadecimal x86_64 machine code for: int mul (int a, int b) { return a * b; } | |
unsigned char code [] = { | |
0x55, // push rbp | |
0x48, 0x89, 0xe5, // mov rbp, rsp | |
0x89, 0x7d, 0xfc, // mov DWORD PTR [rbp-0x4],edi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n add_three (x: int) -> int { | |
3 + x | |
} | |
fn double (x: int) -> int { | |
2 * x | |
} | |
#[no_mangle] | |
pub extern fn meaning_of_life () -> int { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
undefined:175 | |
return typeData.flatSize*8; | |
^ | |
TypeError: Cannot read property 'flatSize' of undefined | |
at getBits (eval at globalEval (/Users/Nicholas/mozilla/emscripten/src/compiler.js:105:8), <anonymous>:175:20) | |
at isIllegalType (eval at globalEval (/Users/Nicholas/mozilla/emscripten/src/compiler.js:105:8), <anonymous>:181:14) | |
at parseNumerical (eval at globalEval (/Users/Nicholas/mozilla/emscripten/src/compiler.js:105:8), <anonymous>:809:39) | |
at parseParamTokens (eval at globalEval (/Users/Nicholas/mozilla/emscripten/src/compiler.js:105:8), <anonymous>:391:28) | |
at Object.substrate.addActor.processItem (eval at globalEval (/Users/Nicholas/mozilla/emscripten/src/compiler.js:105:8), <anonymous>:553:20) | |
at Object._lineSplitter [as processItem] (eval at globalEval (/Users/Nicholas/mozilla/emscripten/src/compiler.js:105:8), <anonymous>:118:35) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; ModuleID = 'hello_world.bc' | |
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" | |
target triple = "x86_64-apple-darwin" | |
%tydesc = type { i64, i64, void ({}*, %tydesc**, i8*)*, void ({}*, %tydesc**, i8*)*, void ({}*, %tydesc**, i8*)*, void ({}*, %tydesc**, i8*)*, i8*, i8* } | |
@_rust_crate_map_toplevel = global { i32, i8*, i64, [2 x i64] } { i32 1, i8* bitcast ({} ({ i64, %tydesc*, i8*, i8*, i8 } addrspace(1)*)* @_ZN7cleanup10annihilate17_c17425bfbdabf8296_07preE to i8*), i64 ptrtoint ([1 x { i64, i64 }]* @_rust_mod_map to i64), [2 x i64] [i64 ptrtoint (i64* @_rust_crate_map_std_0.7-pre_c3ca5d77d81b46c1 to i64), i64 0] } | |
@_rust_crate_map_std_0.7-pre_c3ca5d77d81b46c1 = external global i64 | |
@_rust_mod_map = internal global [1 x { i64, i64 }] zeroinitializer | |
@rust_abi_version = constant i64 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EMCC_DEBUG=1 emcc hello_world.bc -s EXPORTED_FUNCTIONS="['_meaning_of_life']" | |
DEBUG emcc: invocation: /usr/local/bin/emcc hello_world.bc -s EXPORTED_FUNCTIONS=['_meaning_of_life'] | |
WARNING root: LLVM version appears incorrect (seeing "Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn)", expected "clang version 3.2") | |
INFO root: (Emscripten: Running sanity checks) | |
DEBUG emcc: compiling to bitcode | |
DEBUG emcc: copying bitcode file: hello_world.bc | |
DEBUG emcc: will generate JavaScript | |
DEBUG emcc: considering libcxx: we need set([]) and have set([]) | |
DEBUG emcc: considering libcextra: we need set([]) and have set([]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http = require 'http' | |
csv = require 'csv' | |
if process.argv.length is 2 | |
url = 'http://ichart.finance.yahoo.com/table.csv?s=TSLA&a=07&b=28&c=2013&d=07&e=29&f=2013&g=d' | |
else if process.argv.length is 5 | |
[_, _, symbol, start, end] = process.argv | |
[[a, b, c], [d, e, f]] = [start.split('-'), end.split('-')] | |
console.log a, b, c, d, e, f | |
url = "http://ichart.finance.yahoo.com/table.csv?s=#{symbol}&a=#{--a}&b=#{b}&c=#{c}&d=#{--d}&e=#{e}&f=#{f}&g=d" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; ModuleID = 'Crystal' | |
%String.0 = type { i32, i8 } | |
%MatchData = type { %String.0*, %String.0*, i32, i32*, i32 } | |
%StringBuilder.1 = type { i32, %"Array(String).2"* } | |
%"Array(String).2" = type { i32, i32, %String.0** } | |
%"struct.ABI::UnwindException" = type { i64, i64, i64, i64, i64, i32 } | |
%"Nil | UInt64" = type <{ i32, [2 x i32] }> | |
@symbol_table = internal global [0 x %String.0*] zeroinitializer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lastKnownLanguage = navigator.language; | |
document.addEventListener("visibilitychange", function () { | |
if (document.visibilityState === "visible" && | |
navigator.language !== lastKnownLanguage) { | |
// retranslate | |
} | |
}); |