Skip to content

Instantly share code, notes, and snippets.

$ EMCC_FAST_COMPILER=1 ~/develop/opensource/webruby/modules/emscripten/emcc vatest.c
Warning: Variable __init_array_start not referenced
Warning: Variable __init_array_end not referenced
Warning: Variable __fini_array_start not referenced
Warning: Variable __fini_array_end not referenced
false && "Unsupported type"
/Users/rafael/develop/opensource/emscripten-fastcomp/lib/Target/JSBackend/JSBackend.cpp : 683
LLVM ERROR: fail
Traceback (most recent call last):
File "/Users/rafael/develop/opensource/webruby/modules/emscripten/emscripten.py", line 1347, in <module>
@xxuejie
xxuejie / command.sh
Created December 17, 2013 02:43
Compile and link hiredis with webruby
# Suppose the currenct directory is ~/develop
$ git clone https://github.com/redis/hiredis
$ cd hiredis
# Set emscripten compiling target
$ export EMCC_LLVM_TARGET=i386-pc-linux-gnu
# Locale the installation path of webruby, for example, on my mac this is:
# ~/.gem/ruby/2.0.0/gems/webruby-0.2.4/
@xxuejie
xxuejie / gist:6258440
Created August 17, 2013 19:52
workflow
$ git co CABLES-68-dev
(coding...)
$ git fetch
$ git rebase origin/CABLES-68
(fix merging...)
$ git co CABLES-68 && git rebase CABLES-68-dev
$ git push origin CABLES-68
@xxuejie
xxuejie / build.log
Created June 18, 2013 06:31
Build log of webruby using O2 mode
$ EMCC_LLVM_TARGET=i386-pc-linux-gnu EMCC_DEBUG=1 /Users/rafael/develop/webruby/modules/emscripten/emcc /Users/rafael/develop/webruby/build/mrbtest.bc -o /Users/rafael/develop/webruby/build/mrbtest.js -s TOTAL_MEMORY=33554432 --js-library /Users/rafael/develop/webruby/build/gem_test_library.js --pre-js /Users/rafael/develop/webruby/build/gem_test_append.js -s EXPORTED_FUNCTIONS="['_mruby_js_argument_type', '_mruby_js_convert_symbol_to_string', '_mruby_js_get_array_handle', '_mruby_js_get_float', '_mruby_js_get_hash_handle', '_mruby_js_get_integer', '_mruby_js_get_object_handle', '_mruby_js_get_proc', '_mruby_js_get_string_len', '_mruby_js_get_string_ptr', '_mruby_js_invoke_alloc_argv', '_mruby_js_invoke_fetch_argp', '_mruby_js_invoke_proc', '_mruby_js_invoke_release_argv', '_mruby_js_name_error', '_mruby_js_set_array_handle', '_mruby_js_set_boolean', '_mruby_js_set_float', '_mruby_js_set_function_handle', '_mruby_js_set_integer', '_mruby_js_set_nil', '_mruby_js_set_object_handle', '_mruby_js_set_string', '_ma
@xxuejie
xxuejie / rubykaigi.scss
Created May 27, 2013 13:38
Reveal.js template for Rubykaigi 2013. The design credit belongs to Rubykaigi 2013 Team
/**
* A simple theme for reveal.js presentations, similar
* to the default theme. The accent color is darkblue.
*
* This theme is Copyright (C) 2012 Owen Versteeg, https://github.com/StereotypicalApps. It is MIT licensed.
* reveal.js is Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se; so is the theme - beige.css - that this is based off of.
*/
// Default mixins and settings -----------------
@xxuejie
xxuejie / clang.out
Created May 14, 2013 07:00
va_arg bug
$ clang vatest.c
$ ./a.out
Type is 0
Value is 5
Type is 1
Value is 12
Type is 2
Value is 19
Type is 3
Value is 26
Entering: _mrb_run: 104,5521416,5666064,1484
Calling setjmp in run curr: 0x400, prev: (nil)!
Entering: _stack_extend: 5521416,5,5
Exiting: _stack_extend
Entering: _mrb_realloc: 5521416,0,44
Entering: _allocf: 5521416,0,44,0
Entering: _realloc: 0,44
Entering: _malloc: 44
Exiting: _malloc
Exiting: _realloc
@xxuejie
xxuejie / geometries.js
Last active March 17, 2020 13:50
Webruby code vs JavaScript code, both use three.js
// The original JS code for WebGL geometries example in three.js repository
// I only changed the order of the functions for better comparison
// with the Ruby version.
// You can still find the original version inline at http://mrdoob.github.com/three.js/examples/webgl_geometries.html
var container, stats;
var camera, scene, renderer;
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
@xxuejie
xxuejie / clang.out
Created January 18, 2013 02:53
__builtin_bswap64 bug
$ clang swap64.c
$ ./a.out
72057594037927936
@xxuejie
xxuejie / asmjs-test.c
Created January 1, 2013 18:24
Module.ccall also does not work in asm.js
#include <stdio.h>
#include <emscripten/emscripten.h>
int EMSCRIPTEN_KEEPALIVE c_func_calling_from_js() {
printf("This is a c function calling from js!");
return 0;
}