jhc + emscripten

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
chris@midnight:/tmp/ajhc$ cat > hello.hs
main = putStrLn "Hello, World!"  
chris@midnight:/tmp/ajhc$ ajhc hello.hs -C --tdir .
ajhc hello.hs -C --tdir .
ajhc 0.8.0.1 (46ba77fa0f2ed1fa16acdedae737deab365c9c25)
Finding Dependencies...
Using Ho Cache: '/home/chris/.ajhc/cache'
Main                    [hello.hs] <~/.ajhc/cache/ktj3ljg7r1rt11sd3849lt2uv1.ho>
Fresh: <~/.ajhc/cache/ktj3ljg7r1rt11sd3849lt2uv1.ho>
Typechecking...
Compiling...
Collected Compilation...
-- TypeAnalyzeMethods
-- BoxifyProgram
-- Boxy WorkWrap
-- LambdaLift
Converting to Grin...
Updatable CAFS: 0
Constant CAFS:  0
Recursive CAFS: 0
-- Speculative Execution Optimization
-- Node Usage Analysis
-- Grin Devolution
Writing "main_code.c"
chris@midnight:/tmp/ajhc$ ~/Projects/me/emscripten/emcc /tmp/ajhc/rts/profile.c /tmp/ajhc/rts/rts_support.c /tmp/ajhc/rts/gc_none.c /tmp/ajhc/rts/jhc_rts.c /tmp/ajhc/lib/lib_cbits.c /tmp/ajhc/rts/gc_jgc.c /tmp/ajhc/rts/stableptr.c -I/tmp/ajhc/cbits -I/tmp/ajhc /tmp/ajhc/main_code.c -o main.js '-std=gnu99' -D_GNU_SOURCE '-falign-functions=4' -ffast-math -Wextra -Wall -Wno-unused-parameter -fno-strict-aliasing -O2 -DNDEBUG '-D_JHC_GC=_JHC_GC_JGC'
emcc: warning: -I or -L of an absolute path encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript)
clang: warning: argument unused during compilation: '-falign-functions=4'
clang: warning: argument unused during compilation: '-falign-functions=4'
clang: warning: argument unused during compilation: '-falign-functions=4'
clang: warning: argument unused during compilation: '-falign-functions=4'
clang: warning: argument unused during compilation: '-falign-functions=4'
clang: warning: argument unused during compilation: '-falign-functions=4'
clang: warning: argument unused during compilation: '-falign-functions=4'
clang: warning: argument unused during compilation: '-falign-functions=4'
/tmp/ajhc/main_code.c:14:29: warning: attribute 'aligned' is ignored, place it after "struct" to apply attribute to type declaration [-Wignored-attributes]
struct sCJhc_Prim_Prim_$x3a A_ALIGNED;
                            ^
/tmp/ajhc/rts/cdefs.h:16:36: note: expanded from macro 'A_ALIGNED'
#define A_ALIGNED  __attribute__ ((aligned))
                                   ^
/tmp/ajhc/main_code.c:96:17: warning: expression result unused [-Wunused-value]
                SET_RAW_TAG(CJhc_Prim_Prim_$LR);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ajhc/rts/jhc_rts.h:64:27: note: expanded from macro 'SET_RAW_TAG'
#define SET_RAW_TAG(x)    RAW_SET_16(x)
                          ^~~~~~~~~~~~~
/tmp/ajhc/rts/jhc_rts.h:54:56: note: expanded from macro 'RAW_SET_16'
#define RAW_SET_16(w)  (wptr_t)(((uintptr_t)(w) << 16) | P_VALUE)
                                ~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~
2 warnings generated.
chris@midnight:/tmp/ajhc$ node main.js
Hello, World!

/tmp/ajhc/main.js:1
orts, require, module, __filename, __dirname) { function a(b){throw b}var r=vo
                                                                    ^
exit(0) called, at Error
    at Error (unknown source)
    at Md (/tmp/ajhc/main.js:1:30518)
    at Object.Module._main (/tmp/ajhc/main.js:1:31287)
    at Object.Module.z (/tmp/ajhc/main.js:1:45500)
    at c (/tmp/ajhc/main.js:1:45587)
    at ub (/tmp/ajhc/main.js:1:46197)
    at Object.<anonymous> (/tmp/ajhc/main.js:1:46414)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
chris@midnight:/tmp/ajhc$ ls main.js -hl
-rw-rw-r-- 1 chris chris 46K Mar 19 21:40 main.js
chris@midnight:/tmp/ajhc$