I tried two things in 'initRuntime' from compiler/bootstrap.js in 32 bits:
1. Calling an alternative 'initHeap' function which does nothing to see if the bridge calling was ok.
It still crashes.
2. Compare the LIR and ASM code generated for the bridge between the hosted and the bootstrapped version. Here are the findings:
The code is identical after the register allocation. It is almost identical after code generation. One small difference is that the 'moves' right before a function call are not exactly in the same order but are still correct. I guess it comes from the fact that I use an object as a hashMap to order moves and that iterating through object properties doesn't give the same result in tachyon and v8. The other difference is that the bytes listing for each instruction gives undefined values instead of numbers. Therefore the bytes in the CodeBlock might be wrong.
I'll try printing the Code Block content, byte by byte.
For your sheer pleasure, the execution trace follows.
Erick
PS: The bootstrapped call to initHeap is made to initHeap2, which does nothing but has the same signature as initHeap.
time d8 --allow_natives_syntax --nocollect_maps utility/debug.js utility/system.js utility/iterators.js utility/graph.js utility/arrays.js utility/heap.js utility/hashmap.js utility/hashset.js utility/linkedlist.js utility/strings.js utility/modules.js utility/misc.js utility/num.js utility/xml.js utility/html.js compiler/targets.js compiler/params.js compiler/config.js compiler/compiler.js compiler/init.js compiler/bootstrap.js parser/misc.js parser/scanner.js parser/parser.js parser/pp.js parser/ast-passes.js ir/types.js ir/static.js ir/instructions.js ir/constants.js ir/iir.js ir/cfg.js ir/functions.js ir/ast-to-ir.js ir/optpatterns.js ir/constprop.js ir/commelim.js ir/inlining.js ir/lowering.js platform/ffi.js platform/mcb.js runtime/layout.js runtime/context.js runtime/objects.js backend/asm.js backend/regalloc.js backend/linearscan.js backend/backend.js backend/x86/asm.js backend/x86/config.js backend/x86/ir-to-asm.js main.js -- -bootstrap true Initializing config (32bit) bootstrap Creating backend context layout Creating fronted context layout Creating object layouts Initialize FFI functions initFFI Get primitives source code Generate methods for the instantiable layouts Generate wrapper code for the FFI functions Building list of the primitives Returning the primitives Compile primitives source code Parsing Tachyon source: "object layout source" Parsing Tachyon source: "FFI wrapper source" Parsing Tachyon source: "runtime/utility.js" "runtime/utility.js"@95.46-95.47: warning -- use of division operator Parsing Tachyon source: "runtime/primitives.js" Parsing Tachyon source: "runtime/strings.js" "runtime/strings.js"@464.17-464.19: warning -- use of division operator "runtime/strings.js"@487.16-487.18: warning -- use of division operator Parsing Tachyon source: "runtime/ffi.js" Parsing Tachyon source: "runtime/rtinit.js" Generating IR for: "object layout source" Generating IR for: "FFI wrapper source" Generating IR for: "runtime/utility.js" Generating IR for: "runtime/primitives.js" Generating IR for: "runtime/strings.js" Generating IR for: "runtime/ffi.js" Generating IR for: "runtime/rtinit.js" Performing IR lowering for: "object layout source" Performing IR lowering for: "FFI wrapper source" Performing IR lowering for: "runtime/utility.js" Performing IR lowering for: "runtime/primitives.js" Performing IR lowering for: "runtime/strings.js" Performing IR lowering for: "runtime/ffi.js" Performing IR lowering for: "runtime/rtinit.js" Generating machine code for: "object layout source" Generating machine code for: "FFI wrapper source" Generating machine code for: "runtime/utility.js" Generating machine code for: "runtime/primitives.js" Generating machine code for: "runtime/strings.js" Generating machine code for: "runtime/ffi.js" Generating machine code for: "runtime/rtinit.js" Linking machine code for: "object layout source" Linking machine code for: "FFI wrapper source" Linking machine code for: "runtime/utility.js" Linking machine code for: "runtime/primitives.js" Linking machine code for: "runtime/strings.js" Linking machine code for: "runtime/ffi.js" Linking machine code for: "runtime/rtinit.js" Initializing run-time Allocating heap (1073741824 bytes) Retrieving block address Heap address: 0,176,78,180 Get heap initialization function Creating bridge to call the heap init function Translation of function: 'cproxy_initHeap' ******* Before register allocation ****** 2: entry: 4: rptr ctxPtr = arg 0; 6: rptr a0 = arg 1; 8: pint a1 = arg 2; 10: ref ctx = icast_ref ctxPtr; 12: set_ctx_ref ctx; 14: bool $t_6 = ne_rptr ctxPtr, rptr:0; 16: if_bool $t_6 then cond_true else cond_join;
18: cond_true: 20: box $t_10 = load_box ctx, pint:36; 22: jump cond_join;
24: cond_join: 24: box global_1 = phi [undefined entry], [$t_10 cond_true]; 26: pint a1_1 = icast_pint a1; 30: ref r = call <fn "initHeap">, undefined, global_1, a0, a1_1; 32: rptr $t_17 = icast_rptr r; 34: ret_rptr $t_17; ******* After register allocation ******* 2: entry: 4: EDX = arg 0; 6: EBX = arg 1; 8: EAX = arg 2; 10: ESI = icast_ref EDX; 12: set_ctx_ref ESI; 14: EDX = ne_rptr EDX, rptr:0; 16: if_bool EDX then cond_true else ssa_dec;
ssa_dec: null: move undefined, EDX -- SSA Temp: global_1; null: jump cond_join;
18: cond_true: 20: EDX = load_box ESI, pint:36; 22: jump cond_join;
24: cond_join: 24: EDX = phi [undefined ssa_dec], [EDX cond_true]; 26: EAX = icast_pint EAX; 30: EAX = call <fn "initHeap">, undefined, EDX, EBX, EAX; 32: EAX = icast_rptr EAX; 34: ret_rptr EAX; ***************************************** Number of spills: 0
Translation of function: '' ******* Before register allocation ****** 2: entry: 6: box $t_3 = call <fn "makeClos">, undefined, undefined, <fn "cproxy_initHeap">, pint:0; 8: ref $t_4 = get_ctx; 10: box global = load_box $t_4, pint:36; 14: box $t_7 = call <fn "putPropVal">, undefined, undefined, global, "cproxy_initHeap", $t_3; 16: ret undefined; ******* After register allocation ******* 2: entry: 6: EAX = call <fn "makeClos">, undefined, undefined, <fn "cproxy_initHeap">, pint:0; 8: EBX = get_ctx; 10: EBX = load_box EBX, pint:36; 14: null = call <fn "putPropVal">, undefined, undefined, EBX, "cproxy_initHeap", EAX; 16: ret undefined; ***************************************** Number of spills: 0
000000 fn:cproxy_initHeap 000000 53 pushl %ebx 000001 56 pushl %esi 000002 57 pushl %edi 000003 55 pushl %ebp 000004 entry: 000004 8b 54 24 14 movl 20(%esp),%edx 000008 8b 5c 24 18 movl 24(%esp),%ebx 00000c 8b 44 24 1c movl 28(%esp),%eax 000010 89 d6 movl %edx,%esi 000012 89 f1 movl %esi,%ecx 000014 85 d2 testl %edx,%edx 000016 ba 00 00 00 00 movl $0,%edx 00001b 0f 45 d4 cmovnzl %esp,%edx 00001e 85 d2 testl %edx,%edx 000020 74 02 je ssa_dec 000022 eb 07 jmp cond_true 000024 000024 ssa_dec: 000024 ba 19 00 00 00 movl $25,%edx 000029 eb 05 jmp cond_join 00002b 00002b cond_true: 00002b 8b 56 24 movl 36(%esi),%edx 00002e eb 00 jmp cond_join 000030 000030 cond_join: 000030 bf 00 00 00 00 movl <initHeap_fast>,%edi 000035 89 c6 movl %eax,%esi 000037 89 d8 movl %ebx,%eax 000039 89 d3 movl %edx,%ebx 00003b ba 19 00 00 00 movl $25,%edx 000040 ff d7 call *%edi 000042 5d popl %ebp 000043 5f popl %edi 000044 5e popl %esi 000045 5b popl %ebx 000046 c3 ret 000047 000047 fn: 000047 8b 79 04 movl 4(%ecx),%edi 00004a 83 ef 02 subl $2,%edi 00004d 85 ff testl %edi,%edi 00004f 74 40 je L4416 000051 83 ff 00 cmpl $0,%edi 000054 7f 16 jg L4417 000056 bd 19 00 00 00 movl $25,%ebp 00005b 8b 79 04 movl 4(%ecx),%edi 00005e 83 ff 00 cmpl $0,%edi 000061 0f 4e d5 cmovlel %ebp,%edx 000064 83 ff 01 cmpl $1,%edi 000067 0f 4e dd cmovlel %ebp,%ebx 00006a eb 25 jmp L4416 00006c L4417: 00006c 89 41 0c movl %eax,12(%ecx) 00006f 89 e5 movl %esp,%ebp 000071 83 ef 02 subl $2,%edi 000074 83 ff 00 cmpl $0,%edi 000077 7e 18 jle L4416 000079 L4419: 000079 39 e5 cmpl %esp,%ebp 00007b 7c 0c jl L4418 00007d 8b 45 00 movl (%ebp),%eax 000080 89 44 bd 00 movl %eax,(%ebp + %edi*4) 000084 83 ed 04 subl $4,%ebp 000087 eb f0 jmp L4419 000089 L4418: 000089 8b 41 0c movl 12(%ecx),%eax 00008c c1 e7 02 sall $2,%edi 00008f 01 fc addl %edi,%esp 000091 L4416: 000091 entry: 000091 bf 00 00 00 00 movl <makeClos_fast>,%edi 000096 b8 00 00 00 00 movl <cproxy_initHeap_default>,%eax 00009b bb 19 00 00 00 movl $25,%ebx 0000a0 ba 19 00 00 00 movl $25,%edx 0000a5 be 00 00 00 00 movl $0,%esi 0000aa c7 41 04 04 00 00 00 movl $4,4(%ecx) 0000b1 ff d7 call *%edi 0000b3 89 cb movl %ecx,%ebx 0000b5 8b 5b 24 movl 36(%ebx),%ebx 0000b8 bf 00 00 00 00 movl <putPropVal_fast>,%edi 0000bd 83 ec 04 subl $4,%esp 0000c0 89 04 24 movl %eax,(%esp) 0000c3 be 00 00 00 00 movl <"cproxy_initHeap">,%esi 0000c8 89 d8 movl %ebx,%eax 0000ca bb 19 00 00 00 movl $25,%ebx 0000cf ba 19 00 00 00 movl $25,%edx 0000d4 c7 41 04 05 00 00 00 movl $5,4(%ecx) 0000db ff d7 call *%edi 0000dd b8 19 00 00 00 movl $25,%eax 0000e2 c2 00 00 ret $0 0000e5
Calling initHeap 1073741824 0xb44eb000 0xf44eb000 Context pointer: 0,176,78,180 Get the string allocation function Creating bridge to the getStrObj Re-linking primitives After linking Compiling stdlib Parsing Tachyon source: "stdlib/objects.js" Parsing Tachyon source: "stdlib/functions.js" Parsing Tachyon source: "stdlib/arrays.js" Parsing Tachyon source: "stdlib/numbers.js" Parsing Tachyon source: "stdlib/strings.js" Parsing Tachyon source: "stdlib/math.js" Parsing Tachyon source: "stdlib/errors.js" Parsing Tachyon source: "stdlib/extensions.js" Generating IR for: "stdlib/objects.js" Generating IR for: "stdlib/functions.js" Generating IR for: "stdlib/arrays.js" Generating IR for: "stdlib/numbers.js" Generating IR for: "stdlib/strings.js" Generating IR for: "stdlib/math.js" Generating IR for: "stdlib/errors.js" Generating IR for: "stdlib/extensions.js" Performing IR lowering for: "stdlib/objects.js" Performing IR lowering for: "stdlib/functions.js" Performing IR lowering for: "stdlib/arrays.js" Performing IR lowering for: "stdlib/numbers.js" Performing IR lowering for: "stdlib/strings.js" Performing IR lowering for: "stdlib/math.js" Performing IR lowering for: "stdlib/errors.js" Performing IR lowering for: "stdlib/extensions.js" Generating machine code for: "stdlib/objects.js" Generating machine code for: "stdlib/functions.js" Generating machine code for: "stdlib/arrays.js" Generating machine code for: "stdlib/numbers.js" Generating machine code for: "stdlib/strings.js" Generating machine code for: "stdlib/math.js" Generating machine code for: "stdlib/errors.js" Generating machine code for: "stdlib/extensions.js" Linking machine code for: "stdlib/objects.js" Linking machine code for: "stdlib/functions.js" Linking machine code for: "stdlib/arrays.js" Linking machine code for: "stdlib/numbers.js" Linking machine code for: "stdlib/strings.js" Linking machine code for: "stdlib/math.js" Linking machine code for: "stdlib/errors.js" Linking machine code for: "stdlib/extensions.js" Initializing standard library Executing unit for: "stdlib/objects.js" Executing unit for: "stdlib/functions.js" Executing unit for: "stdlib/arrays.js" Executing unit for: "stdlib/numbers.js" Executing unit for: "stdlib/strings.js" Executing unit for: "stdlib/math.js" Executing unit for: "stdlib/errors.js" Executing unit for: "stdlib/extensions.js" Parsing Tachyon source: "utility/debug.js" Parsing Tachyon source: "utility/system.js" Parsing Tachyon source: "utility/iterators.js" Parsing Tachyon source: "utility/graph.js" Parsing Tachyon source: "utility/arrays.js" Parsing Tachyon source: "utility/heap.js" Parsing Tachyon source: "utility/hashmap.js" Parsing Tachyon source: "utility/hashset.js" Parsing Tachyon source: "utility/linkedlist.js" Parsing Tachyon source: "utility/strings.js" Parsing Tachyon source: "utility/modules.js" Parsing Tachyon source: "utility/misc.js" "utility/misc.js"@425.27-425.28: warning -- use of division operator "utility/misc.js"@426.32-426.33: warning -- use of division operator "utility/misc.js"@459.51-459.52: warning -- use of division operator "utility/misc.js"@460.57-460.58: warning -- use of division operator Parsing Tachyon source: "utility/num.js" "utility/num.js"@412.33-412.34: warning -- use of division operator "utility/num.js"@578.41-578.42: warning -- use of division operator Parsing Tachyon source: "utility/xml.js" Parsing Tachyon source: "utility/html.js" Parsing Tachyon source: "compiler/targets.js" Parsing Tachyon source: "compiler/params.js" Parsing Tachyon source: "compiler/config.js" Parsing Tachyon source: "compiler/compiler.js" Parsing Tachyon source: "compiler/init.js" Parsing Tachyon source: "compiler/bootstrap.js" Parsing Tachyon source: "parser/misc.js" Parsing Tachyon source: "parser/scanner.js" "parser/scanner.js"@442.1-442.2: warning -- semicolon was inserted after this token "parser/scanner.js"@465.1-465.2: warning -- semicolon was inserted after this token "parser/scanner.js"@520.17-520.18: warning -- use of division operator Parsing Tachyon source: "parser/parser.js" Parsing Tachyon source: "parser/pp.js" Parsing Tachyon source: "parser/ast-passes.js" "parser/ast-passes.js"@396.1-396.2: warning -- semicolon was inserted after this token "parser/ast-passes.js"@408.1-408.2: warning -- semicolon was inserted after this token Parsing Tachyon source: "ir/types.js" Parsing Tachyon source: "ir/static.js" "ir/static.js"@79.1-79.2: warning -- semicolon was inserted after this token Parsing Tachyon source: "ir/instructions.js" Parsing Tachyon source: "ir/constants.js" Parsing Tachyon source: "ir/iir.js" Parsing Tachyon source: "ir/cfg.js" Parsing Tachyon source: "ir/functions.js" Parsing Tachyon source: "ir/ast-to-ir.js" Parsing Tachyon source: "ir/optpatterns.js" Parsing Tachyon source: "ir/constprop.js" Parsing Tachyon source: "ir/commelim.js" Parsing Tachyon source: "ir/inlining.js" Parsing Tachyon source: "ir/lowering.js" Parsing Tachyon source: "platform/ffi.js" Parsing Tachyon source: "platform/mcb.js" Parsing Tachyon source: "runtime/layout.js" "runtime/layout.js"@277.49-277.51: warning -- use of equality operator "runtime/layout.js"@684.59-684.65: warning -- semicolon was inserted after this token "runtime/layout.js"@752.16-752.25: warning -- semicolon was inserted after this token "runtime/layout.js"@1037.31-1037.33: warning -- use of equality operator "runtime/layout.js"@1037.58-1037.60: warning -- use of equality operator "runtime/layout.js"@1039.35-1039.37: warning -- use of equality operator "runtime/layout.js"@1057.35-1057.37: warning -- use of equality operator "runtime/layout.js"@1089.74-1089.80: warning -- semicolon was inserted after this token "runtime/layout.js"@1155.18-1155.42: warning -- semicolon was inserted after this token "runtime/layout.js"@1156.18-1156.43: warning -- semicolon was inserted after this token Parsing Tachyon source: "runtime/context.js" Parsing Tachyon source: "runtime/objects.js" Parsing Tachyon source: "backend/asm.js" Parsing Tachyon source: "backend/regalloc.js" Parsing Tachyon source: "backend/linearscan.js" Parsing Tachyon source: "backend/backend.js" Parsing Tachyon source: "backend/x86/asm.js" Parsing Tachyon source: "backend/x86/config.js" Parsing Tachyon source: "backend/x86/ir-to-asm.js" Parsing Tachyon source: "bt-fib.js" Parsing Tachyon source: "bt-fib32.js" Generating IR for: "utility/debug.js" Generating IR for: "utility/system.js" Generating IR for: "utility/iterators.js" Generating IR for: "utility/graph.js" Generating IR for: "utility/arrays.js" Generating IR for: "utility/heap.js" Generating IR for: "utility/hashmap.js" Generating IR for: "utility/hashset.js" Generating IR for: "utility/linkedlist.js" Generating IR for: "utility/strings.js" Generating IR for: "utility/modules.js" Generating IR for: "utility/misc.js" Generating IR for: "utility/num.js" Generating IR for: "utility/xml.js" Generating IR for: "utility/html.js" Generating IR for: "compiler/targets.js" Generating IR for: "compiler/params.js" Generating IR for: "compiler/config.js" Generating IR for: "compiler/compiler.js" Generating IR for: "compiler/init.js" Generating IR for: "compiler/bootstrap.js" Generating IR for: "parser/misc.js" Generating IR for: "parser/scanner.js" Generating IR for: "parser/parser.js" Generating IR for: "parser/pp.js" Generating IR for: "parser/ast-passes.js" Generating IR for: "ir/types.js" Generating IR for: "ir/static.js" Generating IR for: "ir/instructions.js" Generating IR for: "ir/constants.js" Generating IR for: "ir/iir.js" Generating IR for: "ir/cfg.js" Generating IR for: "ir/functions.js" Generating IR for: "ir/ast-to-ir.js" Generating IR for: "ir/optpatterns.js" Generating IR for: "ir/constprop.js" Generating IR for: "ir/commelim.js" Generating IR for: "ir/inlining.js" Generating IR for: "ir/lowering.js" Generating IR for: "platform/ffi.js" Generating IR for: "platform/mcb.js" Generating IR for: "runtime/layout.js" Generating IR for: "runtime/context.js" Generating IR for: "runtime/objects.js" Generating IR for: "backend/asm.js" Generating IR for: "backend/regalloc.js" Generating IR for: "backend/linearscan.js" Generating IR for: "backend/backend.js" Generating IR for: "backend/x86/asm.js" Generating IR for: "backend/x86/config.js" Generating IR for: "backend/x86/ir-to-asm.js" Generating IR for: "bt-fib.js" Generating IR for: "bt-fib32.js" Performing IR lowering for: "utility/debug.js" Performing IR lowering for: "utility/system.js" Performing IR lowering for: "utility/iterators.js" Performing IR lowering for: "utility/graph.js" Performing IR lowering for: "utility/arrays.js" Performing IR lowering for: "utility/heap.js" Performing IR lowering for: "utility/hashmap.js" Performing IR lowering for: "utility/hashset.js" Performing IR lowering for: "utility/linkedlist.js" Performing IR lowering for: "utility/strings.js" Performing IR lowering for: "utility/modules.js" Performing IR lowering for: "utility/misc.js" Performing IR lowering for: "utility/num.js" Performing IR lowering for: "utility/xml.js" Performing IR lowering for: "utility/html.js" Performing IR lowering for: "compiler/targets.js" Performing IR lowering for: "compiler/params.js" Performing IR lowering for: "compiler/config.js" Performing IR lowering for: "compiler/compiler.js" Performing IR lowering for: "compiler/init.js" Performing IR lowering for: "compiler/bootstrap.js" Performing IR lowering for: "parser/misc.js" Performing IR lowering for: "parser/scanner.js" Performing IR lowering for: "parser/parser.js" Performing IR lowering for: "parser/pp.js" Performing IR lowering for: "parser/ast-passes.js" Performing IR lowering for: "ir/types.js" Performing IR lowering for: "ir/static.js" Performing IR lowering for: "ir/instructions.js" Performing IR lowering for: "ir/constants.js" Performing IR lowering for: "ir/iir.js" Performing IR lowering for: "ir/cfg.js" Performing IR lowering for: "ir/functions.js" Performing IR lowering for: "ir/ast-to-ir.js" Performing IR lowering for: "ir/optpatterns.js" Performing IR lowering for: "ir/constprop.js" Performing IR lowering for: "ir/commelim.js" Performing IR lowering for: "ir/inlining.js" Performing IR lowering for: "ir/lowering.js" Performing IR lowering for: "platform/ffi.js" Performing IR lowering for: "platform/mcb.js" Performing IR lowering for: "runtime/layout.js" Performing IR lowering for: "runtime/context.js" Performing IR lowering for: "runtime/objects.js" Performing IR lowering for: "backend/asm.js" Performing IR lowering for: "backend/regalloc.js" Performing IR lowering for: "backend/linearscan.js" Performing IR lowering for: "backend/backend.js" Performing IR lowering for: "backend/x86/asm.js" Performing IR lowering for: "backend/x86/config.js" Performing IR lowering for: "backend/x86/ir-to-asm.js" Performing IR lowering for: "bt-fib.js" Performing IR lowering for: "bt-fib32.js" Generating machine code for: "utility/debug.js" Generating machine code for: "utility/system.js" Generating machine code for: "utility/iterators.js" Generating machine code for: "utility/graph.js" Generating machine code for: "utility/arrays.js" Generating machine code for: "utility/heap.js" Generating machine code for: "utility/hashmap.js" Generating machine code for: "utility/hashset.js" Generating machine code for: "utility/linkedlist.js" Generating machine code for: "utility/strings.js" Generating machine code for: "utility/modules.js" Generating machine code for: "utility/misc.js" Generating machine code for: "utility/num.js" Generating machine code for: "utility/xml.js" Generating machine code for: "utility/html.js" Generating machine code for: "compiler/targets.js" Generating machine code for: "compiler/params.js" Generating machine code for: "compiler/config.js" Generating machine code for: "compiler/compiler.js" Generating machine code for: "compiler/init.js" Generating machine code for: "compiler/bootstrap.js" Generating machine code for: "parser/misc.js" Generating machine code for: "parser/scanner.js" Generating machine code for: "parser/parser.js" Generating machine code for: "parser/pp.js" Generating machine code for: "parser/ast-passes.js" Generating machine code for: "ir/types.js" Generating machine code for: "ir/static.js" Generating machine code for: "ir/instructions.js" Generating machine code for: "ir/constants.js" Generating machine code for: "ir/iir.js" Generating machine code for: "ir/cfg.js" Generating machine code for: "ir/functions.js" Generating machine code for: "ir/ast-to-ir.js" Generating machine code for: "ir/optpatterns.js" Generating machine code for: "ir/constprop.js" Generating machine code for: "ir/commelim.js" Generating machine code for: "ir/inlining.js" Generating machine code for: "ir/lowering.js" Generating machine code for: "platform/ffi.js" Generating machine code for: "platform/mcb.js" Generating machine code for: "runtime/layout.js" Generating machine code for: "runtime/context.js" Generating machine code for: "runtime/objects.js" Generating machine code for: "backend/asm.js" Generating machine code for: "backend/regalloc.js" Generating machine code for: "backend/linearscan.js" Generating machine code for: "backend/backend.js" Generating machine code for: "backend/x86/asm.js" Generating machine code for: "backend/x86/config.js" Generating machine code for: "backend/x86/ir-to-asm.js" Generating machine code for: "bt-fib.js" Generating machine code for: "bt-fib32.js" Linking machine code for: "utility/debug.js" Linking machine code for: "utility/system.js" Linking machine code for: "utility/iterators.js" Linking machine code for: "utility/graph.js" Linking machine code for: "utility/arrays.js" Linking machine code for: "utility/heap.js" Linking machine code for: "utility/hashmap.js" Linking machine code for: "utility/hashset.js" Linking machine code for: "utility/linkedlist.js" Linking machine code for: "utility/strings.js" Linking machine code for: "utility/modules.js" Linking machine code for: "utility/misc.js" Linking machine code for: "utility/num.js" Linking machine code for: "utility/xml.js" Linking machine code for: "utility/html.js" Linking machine code for: "compiler/targets.js" Linking machine code for: "compiler/params.js" Linking machine code for: "compiler/config.js" Linking machine code for: "compiler/compiler.js" Linking machine code for: "compiler/init.js" Linking machine code for: "compiler/bootstrap.js" Linking machine code for: "parser/misc.js" Linking machine code for: "parser/scanner.js" Linking machine code for: "parser/parser.js" Linking machine code for: "parser/pp.js" Linking machine code for: "parser/ast-passes.js" Linking machine code for: "ir/types.js" Linking machine code for: "ir/static.js" Linking machine code for: "ir/instructions.js" Linking machine code for: "ir/constants.js" Linking machine code for: "ir/iir.js" Linking machine code for: "ir/cfg.js" Linking machine code for: "ir/functions.js" Linking machine code for: "ir/ast-to-ir.js" Linking machine code for: "ir/optpatterns.js" Linking machine code for: "ir/constprop.js" Linking machine code for: "ir/commelim.js" Linking machine code for: "ir/inlining.js" Linking machine code for: "ir/lowering.js" Linking machine code for: "platform/ffi.js" Linking machine code for: "platform/mcb.js" Linking machine code for: "runtime/layout.js" Linking machine code for: "runtime/context.js" Linking machine code for: "runtime/objects.js" Linking machine code for: "backend/asm.js" Linking machine code for: "backend/regalloc.js" Linking machine code for: "backend/linearscan.js" Linking machine code for: "backend/backend.js" Linking machine code for: "backend/x86/asm.js" Linking machine code for: "backend/x86/config.js" Linking machine code for: "backend/x86/ir-to-asm.js" Linking machine code for: "bt-fib.js" Linking machine code for: "bt-fib32.js" ******************** Performance report
Compiling runtime: 4.71 s, 0 MB allocated time=64% alloc=NaN% -- Machine code generation time=23% alloc=NaN% -- IR to ASM translation time=14% alloc=NaN% -- Linear scan time=10% alloc=NaN% -- Resolution time=5% alloc=NaN% -- Computing live intervals time=3% alloc=NaN% -- Assembly time=2% alloc=NaN% -- Operand assignment time=1% alloc=NaN% -- Number instructions time=0% alloc=NaN% -- Computing fixed intervals time=0% alloc=NaN% -- Order blocks time=26% alloc=NaN% -- IR lowering time=4% alloc=NaN% -- IR generation time=3% alloc=NaN% -- Parsing time=0% alloc=NaN% -- Machine code linking
Order blocks: 0.002 s, 0 MB allocated
Number instructions: 0 s, 0 MB allocated
Computing live intervals: 0.003 s, 0 MB allocated
Computing fixed intervals: 0.001 s, 0 MB allocated
Linear scan: 0.005 s, 0 MB allocated
Operand assignment: 0.001 s, 0 MB allocated
Resolution: 0.003 s, 0 MB allocated
IR to ASM translation: 0.024 s, 0 MB allocated
Assembly: 0.005 s, 0 MB allocated
Compiling stdlib: 5.661 s, 0 MB allocated time=74% alloc=NaN% -- Machine code generation time=22% alloc=NaN% -- Linear scan time=20% alloc=NaN% -- Resolution time=16% alloc=NaN% -- IR to ASM translation time=4% alloc=NaN% -- Computing live intervals time=3% alloc=NaN% -- Assembly time=1% alloc=NaN% -- Operand assignment time=1% alloc=NaN% -- Computing fixed intervals time=0% alloc=NaN% -- Number instructions time=0% alloc=NaN% -- Order blocks time=22% alloc=NaN% -- IR lowering time=2% alloc=NaN% -- IR generation time=0% alloc=NaN% -- Parsing time=0% alloc=NaN% -- Machine code linking
Compiling Tachyon: 389.44 s, 0 MB allocated time=83% alloc=NaN% -- Machine code generation time=45% alloc=NaN% -- Linear scan time=18% alloc=NaN% -- Resolution time=10% alloc=NaN% -- IR to ASM translation time=2% alloc=NaN% -- Computing live intervals time=1% alloc=NaN% -- Operand assignment time=1% alloc=NaN% -- Assembly time=0% alloc=NaN% -- Number instructions time=0% alloc=NaN% -- Computing fixed intervals time=0% alloc=NaN% -- Order blocks time=14% alloc=NaN% -- IR lowering time=1% alloc=NaN% -- IR generation time=0% alloc=NaN% -- Machine code linking time=0% alloc=NaN% -- Parsing
******************** Executing unit for: "utility/debug.js" Executing unit for: "utility/system.js" Executing unit for: "utility/iterators.js" Executing unit for: "utility/graph.js" Executing unit for: "utility/arrays.js" Executing unit for: "utility/heap.js" Executing unit for: "utility/hashmap.js" Executing unit for: "utility/hashset.js" Executing unit for: "utility/linkedlist.js" Executing unit for: "utility/strings.js" Executing unit for: "utility/modules.js" Executing unit for: "utility/misc.js" Executing unit for: "utility/num.js" Executing unit for: "utility/xml.js" Executing unit for: "utility/html.js" Executing unit for: "compiler/targets.js" Executing unit for: "compiler/params.js" Executing unit for: "compiler/config.js" Executing unit for: "compiler/compiler.js" Executing unit for: "compiler/init.js" Executing unit for: "compiler/bootstrap.js" Executing unit for: "parser/misc.js" Executing unit for: "parser/scanner.js" Executing unit for: "parser/parser.js" Executing unit for: "parser/pp.js" Executing unit for: "parser/ast-passes.js" Executing unit for: "ir/types.js" Executing unit for: "ir/static.js" Executing unit for: "ir/instructions.js" Executing unit for: "ir/constants.js" Executing unit for: "ir/iir.js" Executing unit for: "ir/cfg.js" Executing unit for: "ir/functions.js" Executing unit for: "ir/ast-to-ir.js" Executing unit for: "ir/optpatterns.js" Executing unit for: "ir/constprop.js" Executing unit for: "ir/commelim.js" Executing unit for: "ir/inlining.js" Executing unit for: "ir/lowering.js" Executing unit for: "platform/ffi.js" Executing unit for: "platform/mcb.js" Executing unit for: "runtime/layout.js" Executing unit for: "runtime/context.js" Executing unit for: "runtime/objects.js" Executing unit for: "backend/asm.js" Executing unit for: "backend/regalloc.js" Executing unit for: "backend/linearscan.js" Executing unit for: "backend/backend.js" Executing unit for: "backend/x86/asm.js" Executing unit for: "backend/x86/config.js" Executing unit for: "backend/x86/ir-to-asm.js" Executing unit for: "bt-fib.js" Executing unit for: "bt-fib32.js" Heap size : 5083 KB Num strings: 3746 Num globals: 1189 Running after initialization of boostrap code Initializing Tachyon Initializing config (32bit) bootstrap Creating backend context layout Creating fronted context layout Creating object layouts Initialize FFI functions initFFI Get primitives source code Generate methods for the instantiable layouts Generate wrapper code for the FFI functions Building list of the primitives Returning the primitives Compile primitives source code Parsing Tachyon source: "object layout source" Parsing Tachyon source: "FFI wrapper source" Parsing Tachyon source: "runtime/utility.js" "runtime/utility.js"@95.46-95.47: warning -- use of division operator Parsing Tachyon source: "runtime/primitives.js" Parsing Tachyon source: "runtime/strings.js" "runtime/strings.js"@464.17-464.19: warning -- use of division operator "runtime/strings.js"@487.16-487.18: warning -- use of division operator Parsing Tachyon source: "runtime/ffi.js" Parsing Tachyon source: "runtime/rtinit.js" Generating IR for: "object layout source" Generating IR for: "FFI wrapper source" Generating IR for: "runtime/utility.js" Generating IR for: "runtime/primitives.js" Generating IR for: "runtime/strings.js" Generating IR for: "runtime/ffi.js" Generating IR for: "runtime/rtinit.js" Performing IR lowering for: "object layout source" Performing IR lowering for: "FFI wrapper source" Performing IR lowering for: "runtime/utility.js" Performing IR lowering for: "runtime/primitives.js" Performing IR lowering for: "runtime/strings.js" Performing IR lowering for: "runtime/ffi.js" Performing IR lowering for: "runtime/rtinit.js" Generating machine code for: "object layout source" Generating machine code for: "FFI wrapper source" Generating machine code for: "runtime/utility.js" Generating machine code for: "runtime/primitives.js" Generating machine code for: "runtime/strings.js" Generating machine code for: "runtime/ffi.js" Generating machine code for: "runtime/rtinit.js" Linking machine code for: "object layout source" Linking machine code for: "FFI wrapper source" Linking machine code for: "runtime/utility.js" Linking machine code for: "runtime/primitives.js" Linking machine code for: "runtime/strings.js" Linking machine code for: "runtime/ffi.js" Linking machine code for: "runtime/rtinit.js" Initializing run-time Allocating heap (536870911 bytes) Retrieving block address Heap address: 0,240,183,133 Get heap initialization function Creating bridge to call the heap init function Translation of function: 'cproxy_initHeap2' ******* Before register allocation ****** 2: entry: 4: rptr ctxPtr = arg 0; 6: rptr a0 = arg 1; 8: pint a1 = arg 2; 10: ref ctx = icast_ref ctxPtr; 12: set_ctx_ref ctx; 14: bool $t_6 = ne_rptr ctxPtr, rptr:0; 16: if_bool $t_6 then cond_true else cond_join;
18: cond_true: 20: box $t_10 = load_box ctx, pint:36; 22: jump cond_join;
24: cond_join: 24: box global_1 = phi [undefined entry], [$t_10 cond_true]; 26: pint a1_1 = icast_pint a1; 30: ref r = call <fn "initHeap2">, undefined, global_1, a0, a1_1; 32: rptr $t_17 = icast_rptr r; 34: ret_rptr $t_17; ******* After register allocation ******* 2: entry: 4: EDX = arg 0; 6: EBX = arg 1; 8: EAX = arg 2; 10: ESI = icast_ref EDX; 12: set_ctx_ref ESI; 14: EDX = ne_rptr EDX, rptr:0; 16: if_bool EDX then cond_true else ssa_dec;
ssa_dec: null: move undefined, EDX -- SSA Temp: global_1; null: jump cond_join;
18: cond_true: 20: EDX = load_box ESI, pint:36; 22: jump cond_join;
24: cond_join: 24: EDX = phi [undefined ssa_dec], [EDX cond_true]; 26: EAX = icast_pint EAX; 30: EAX = call <fn "initHeap2">, undefined, EDX, EBX, EAX; 32: EAX = icast_rptr EAX; 34: ret_rptr EAX; ***************************************** Number of spills: 0 undefined Translation of function: '' ******* Before register allocation ****** 2: entry: 6: box $t_3 = call <fn "makeClos">, undefined, undefined, <fn "cproxy_initHeap2">, pint:0; 8: ref $t_4 = get_ctx; 10: box global = load_box $t_4, pint:36; 14: box $t_7 = call <fn "putPropVal">, undefined, undefined, global, "cproxy_initHeap2", $t_3; 16: ret undefined; ******* After register allocation ******* 2: entry: 6: EAX = call <fn "makeClos">, undefined, undefined, <fn "cproxy_initHeap2">, pint:0; 8: EBX = get_ctx; 10: EBX = load_box EBX, pint:36; 14: null = call <fn "putPropVal">, undefined, undefined, EBX, "cproxy_initHeap2", EAX; 16: ret undefined; ***************************************** Number of spills: 0 undefined fn:cproxy_initHeap2 undefinedundefined pushl %ebx undefinedundefined pushl %esi undefinedundefined pushl %edi undefinedundefined pushl %ebp entry: undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl 20(%esp),%edx undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl 24(%esp),%ebx undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl 28(%esp),%eax undefinedundefined undefinedundefined movl %edx,%esi undefinedundefined undefinedundefined movl %esi,%ecx undefinedundefined undefinedundefined testl %edx,%edx undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl $0,%edx undefinedundefined undefinedundefined undefinedundefined cmovnzl %esp,%edx undefinedundefined undefinedundefined testl %edx,%edx undefinedundefined undefinedundefined je ssa_dec undefinedundefined undefinedundefined jmp cond_true
ssa_dec: undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl $25,%edx undefinedundefined undefinedundefined jmp cond_join
cond_true: undefinedundefined undefinedundefined undefinedundefined movl 36(%esi),%edx undefinedundefined undefinedundefined jmp cond_join
cond_join: undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl <initHeap2_fast>,%edi undefinedundefined undefinedundefined movl %eax,%esi undefinedundefined undefinedundefined movl %ebx,%eax undefinedundefined undefinedundefined movl %edx,%ebx undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl $25,%edx undefinedundefined undefinedundefined call *%edi undefinedundefined popl %ebp undefinedundefined popl %edi undefinedundefined popl %esi undefinedundefined popl %ebx undefinedundefined ret
fn: undefinedundefined undefinedundefined undefinedundefined movl 4(%ecx),%edi undefinedundefined undefinedundefined undefinedundefined subl $2,%edi undefinedundefined undefinedundefined testl %edi,%edi undefinedundefined undefinedundefined je L4416 undefinedundefined undefinedundefined undefinedundefined cmpl $0,%edi undefinedundefined undefinedundefined jg L4417 undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl $25,%ebp undefinedundefined undefinedundefined undefinedundefined movl 4(%ecx),%edi undefinedundefined undefinedundefined undefinedundefined cmpl $0,%edi undefinedundefined undefinedundefined undefinedundefined cmovlel %ebp,%edx undefinedundefined undefinedundefined undefinedundefined cmpl $1,%edi undefinedundefined undefinedundefined undefinedundefined cmovlel %ebp,%ebx undefinedundefined undefinedundefined jmp L4416 L4417: undefinedundefined undefinedundefined undefinedundefined movl %eax,12(%ecx) undefinedundefined undefinedundefined movl %esp,%ebp undefinedundefined undefinedundefined undefinedundefined subl $2,%edi undefinedundefined undefinedundefined undefinedundefined cmpl $0,%edi undefinedundefined undefinedundefined jle L4416 L4419: undefinedundefined undefinedundefined cmpl %esp,%ebp undefinedundefined undefinedundefined jl L4418 undefinedundefined undefinedundefined undefinedundefined movl (%ebp),%eax undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl %eax,(%ebp + %edi*4) undefinedundefined undefinedundefined undefinedundefined subl $4,%ebp undefinedundefined undefinedundefined jmp L4419 L4418: undefinedundefined undefinedundefined undefinedundefined movl 12(%ecx),%eax undefinedundefined undefinedundefined undefinedundefined sall $2,%edi undefinedundefined undefinedundefined addl %edi,%esp L4416: entry: undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl <makeClos_fast>,%edi undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl $25,%ebx undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl $25,%edx undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl <cproxy_initHeap2_default>,%eax undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl $0,%esi undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl $4,4(%ecx) undefinedundefined undefinedundefined call *%edi undefinedundefined undefinedundefined movl %ecx,%ebx undefinedundefined undefinedundefined undefinedundefined movl 36(%ebx),%ebx undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl <putPropVal_fast>,%edi undefinedundefined undefinedundefined undefinedundefined subl $4,%esp undefinedundefined undefinedundefined undefinedundefined movl %eax,(%esp) undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl $25,%edx undefinedundefined undefinedundefined movl %ebx,%eax undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl $25,%ebx undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl <"cproxy_initHeap2">,%esi undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl $5,4(%ecx) undefinedundefined undefinedundefined call *%edi undefinedundefined undefinedundefined undefinedundefined undefinedundefined undefinedundefined movl $25,%eax undefinedundefined undefinedundefined undefinedundefined ret $0
Calling initHeap2 434.36user 1.98system 7:15.34elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+6152outputs (0major+430204minor)pagefaults 0swaps make: *** [bootstrap] Error 11
Afficher les réponses par date
- Compare the LIR and ASM code generated for the bridge between the
hosted and the bootstrapped version. Here are the findings:
The code is identical after the register allocation. It is almost identical after code generation. One small difference is that the 'moves' right before a function call are not exactly in the same order but are still correct. I guess it comes from the fact that I use an object as a hashMap to order moves and that iterating through object properties doesn't give the same result in tachyon and v8. The other difference is that the bytes listing for each instruction gives undefined values instead of numbers. Therefore the bytes in the CodeBlock might be wrong.
We were retrieving a string value for the bytes this way:
function printDigit(d) { return "0123456789abcdef"[d]; };
I changed it to:
+ const digits = + ["0", "1", "2", "3", "4", "5", "6" , "7", "8", "9", + "a", "b", "c", "d", "e", "f"]; + function printDigit(d) { return digits[d]; };
It is an idiom we should support in the future.
Having fixed that, I can attest that the listing for the generated code is byte-identical. I will now try to list the machine code block (the bytes in memory) and compare them.
Erick
We were retrieving a string value for the bytes this way:
function printDigit(d) { return "0123456789abcdef"[d]; };
It is an idiom we should support in the future.
I implemented it on strings... Cause I'm nice :P
It won't work on string objects created using new String(), however.
- Maxime
Nice.
I checked the byte values in the machine code blocks for the proxy after linking and they are correct. The values are similar to what I get when we are hosted in v8 except for the ordering of moves and for the linked addresses in the code. The generated code is therefore ok for the proxy to initHeap.
The code fails on "calling FFI with rawCallTachyonFFI". I see 2 possibilities from here: 1. The pointer value for making the call is wrong 2. The generated code for callTachyonFFI is wrong
Maxime, could you take a look at this?
The code used to test is now on the master branch and I am bootstrapping in 32 bits.
Erick
Le 11-03-18 23:42 , chevalma@iro.umontreal.ca a écrit :
We were retrieving a string value for the bytes this way:
function printDigit(d) { return "0123456789abcdef"[d]; };
It is an idiom we should support in the future.
I implemented it on strings... Cause I'm nice :P
It won't work on string objects created using new String(), however.
- Maxime
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
The code fails on "calling FFI with rawCallTachyonFFI". I see 2 possibilities from here:
- The pointer value for making the call is wrong
You should look into that. The function pointer points inside the machine code block.
- The generated code for callTachyonFFI is wrong
I tested this on its own in a unit test. It seems to work properly.
Maxime, could you take a look at this? The code used to test is now on the master branch and I am bootstrapping in 32 bits.
I will try a make bootstrap tomorrow if I have time.
- Maxime
I verified that the d8 "callTachyonFFI" is effectively called when we are trying to call 'initHeap'. I also checked the machine code generated for 'initHeap' and there is no code generation issue. As said in a previous mail, iterating through the properties of an object when bootstrapped is not done in the same order as in v8. In initHeap it causes the fields of the context object to be initialized in a different order but the result is still good. As a reference, I include the IR before and after code generation and the code listing for both v8 and tachyon.
If I recapitulate, I verified the following: 1. The test for the bridge works, when calling C code from bootstrapped tachyon 2. When trying to call 'initHeap' from bootstrapped tachyon, the C callTachyonFFI is called 2. The 'initHeap' c proxy code listing is byte identical except for the move ordering issue 3. The 'initHeap' code listing is byte identical except for the initialization order of the context and the move ordering issue
I guess the only possibility left is that the proxy code is not calling the right function, which might happen if the linked value in the machine code block does not correspond to the address of the entry point of the function in memory.
Erick
Le 11-03-19 1:27 , chevalma@iro.umontreal.ca a écrit :
The code fails on "calling FFI with rawCallTachyonFFI". I see 2 possibilities from here:
- The pointer value for making the call is wrong
You should look into that. The function pointer points inside the machine code block.
- The generated code for callTachyonFFI is wrong
I tested this on its own in a unit test. It seems to work properly.
Maxime, could you take a look at this? The code used to test is now on the master branch and I am bootstrapping in 32 bits.
I will try a make bootstrap tomorrow if I have time.
- Maxime
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
Well if the generated code is valid, that's good news. We should be pretty close to having it working. I suspect the same thing as you, that the linked values may be incorrect. The c proxy has the address of initHeap linked into it. It's also possible that whatever code gets the address of a given offset in the block gives the wrong result. I have implemented a separate getBlockAddr for Tachyon, so I should probably check that the result of that is correct. Finally, it's also possible the executable flag isn't set properly... Something I should look into as well.
- Maxime
On 11-03-19 12:43 PM, Erick Lavoie wrote:
I verified that the d8 "callTachyonFFI" is effectively called when we are trying to call 'initHeap'. I also checked the machine code generated for 'initHeap' and there is no code generation issue. As said in a previous mail, iterating through the properties of an object when bootstrapped is not done in the same order as in v8. In initHeap it causes the fields of the context object to be initialized in a different order but the result is still good. As a reference, I include the IR before and after code generation and the code listing for both v8 and tachyon.
If I recapitulate, I verified the following:
- The test for the bridge works, when calling C code from
bootstrapped tachyon 2. When trying to call 'initHeap' from bootstrapped tachyon, the C callTachyonFFI is called 2. The 'initHeap' c proxy code listing is byte identical except for the move ordering issue 3. The 'initHeap' code listing is byte identical except for the initialization order of the context and the move ordering issue
I guess the only possibility left is that the proxy code is not calling the right function, which might happen if the linked value in the machine code block does not correspond to the address of the entry point of the function in memory.
Erick
Le 11-03-19 1:27 , chevalma@iro.umontreal.ca a écrit :
The code fails on "calling FFI with rawCallTachyonFFI". I see 2 possibilities from here:
- The pointer value for making the call is wrong
You should look into that. The function pointer points inside the machine code block.
- The generated code for callTachyonFFI is wrong
I tested this on its own in a unit test. It seems to work properly.
Maxime, could you take a look at this? The code used to test is now on the master branch and I am bootstrapping in 32 bits.
I will try a make bootstrap tomorrow if I have time.
- Maxime
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
I found the issue. The linked address was wrong because the base address was off by 6 which corresponds to the numerical value of undefined. In the bootstrapped getBlockAddr(blockObj, index), the index was never tested for undefined and in the linking code I was retrieving the address without an explicit index. I'll commit the fix.
We now get to compiling the stdlib but we run out of memory again.
Erick
Le 11-03-19 13:32 , Maxime Chevalier-Boisvert a écrit :
Well if the generated code is valid, that's good news. We should be pretty close to having it working. I suspect the same thing as you, that the linked values may be incorrect. The c proxy has the address of initHeap linked into it. It's also possible that whatever code gets the address of a given offset in the block gives the wrong result. I have implemented a separate getBlockAddr for Tachyon, so I should probably check that the result of that is correct. Finally, it's also possible the executable flag isn't set properly... Something I should look into as well.
- Maxime
On 11-03-19 12:43 PM, Erick Lavoie wrote:
I verified that the d8 "callTachyonFFI" is effectively called when we are trying to call 'initHeap'. I also checked the machine code generated for 'initHeap' and there is no code generation issue. As said in a previous mail, iterating through the properties of an object when bootstrapped is not done in the same order as in v8. In initHeap it causes the fields of the context object to be initialized in a different order but the result is still good. As a reference, I include the IR before and after code generation and the code listing for both v8 and tachyon.
If I recapitulate, I verified the following:
- The test for the bridge works, when calling C code from
bootstrapped tachyon 2. When trying to call 'initHeap' from bootstrapped tachyon, the C callTachyonFFI is called 2. The 'initHeap' c proxy code listing is byte identical except for the move ordering issue 3. The 'initHeap' code listing is byte identical except for the initialization order of the context and the move ordering issue
I guess the only possibility left is that the proxy code is not calling the right function, which might happen if the linked value in the machine code block does not correspond to the address of the entry point of the function in memory.
Erick
Le 11-03-19 1:27 , chevalma@iro.umontreal.ca a écrit :
The code fails on "calling FFI with rawCallTachyonFFI". I see 2 possibilities from here:
- The pointer value for making the call is wrong
You should look into that. The function pointer points inside the machine code block.
- The generated code for callTachyonFFI is wrong
I tested this on its own in a unit test. It seems to work properly.
Maxime, could you take a look at this? The code used to test is now on the master branch and I am bootstrapping in 32 bits.
I will try a make bootstrap tomorrow if I have time.
- Maxime
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
Running out of memory in the bootstrapped Tachyon, with the 512MB heap? How far into the stdlib compilation?
- Maxime
On 11-03-19 03:29 PM, Erick Lavoie wrote:
I found the issue. The linked address was wrong because the base address was off by 6 which corresponds to the numerical value of undefined. In the bootstrapped getBlockAddr(blockObj, index), the index was never tested for undefined and in the linking code I was retrieving the address without an explicit index. I'll commit the fix.
We now get to compiling the stdlib but we run out of memory again.
Erick
Le 11-03-19 13:32 , Maxime Chevalier-Boisvert a écrit :
Well if the generated code is valid, that's good news. We should be pretty close to having it working. I suspect the same thing as you, that the linked values may be incorrect. The c proxy has the address of initHeap linked into it. It's also possible that whatever code gets the address of a given offset in the block gives the wrong result. I have implemented a separate getBlockAddr for Tachyon, so I should probably check that the result of that is correct. Finally, it's also possible the executable flag isn't set properly... Something I should look into as well.
- Maxime
On 11-03-19 12:43 PM, Erick Lavoie wrote:
I verified that the d8 "callTachyonFFI" is effectively called when we are trying to call 'initHeap'. I also checked the machine code generated for 'initHeap' and there is no code generation issue. As said in a previous mail, iterating through the properties of an object when bootstrapped is not done in the same order as in v8. In initHeap it causes the fields of the context object to be initialized in a different order but the result is still good. As a reference, I include the IR before and after code generation and the code listing for both v8 and tachyon.
If I recapitulate, I verified the following:
- The test for the bridge works, when calling C code from
bootstrapped tachyon 2. When trying to call 'initHeap' from bootstrapped tachyon, the C callTachyonFFI is called 2. The 'initHeap' c proxy code listing is byte identical except for the move ordering issue 3. The 'initHeap' code listing is byte identical except for the initialization order of the context and the move ordering issue
I guess the only possibility left is that the proxy code is not calling the right function, which might happen if the linked value in the machine code block does not correspond to the address of the entry point of the function in memory.
Erick
Le 11-03-19 1:27 , chevalma@iro.umontreal.ca a écrit :
The code fails on "calling FFI with rawCallTachyonFFI". I see 2 possibilities from here:
- The pointer value for making the call is wrong
You should look into that. The function pointer points inside the machine code block.
- The generated code for callTachyonFFI is wrong
I tested this on its own in a unit test. It seems to work properly.
Maxime, could you take a look at this? The code used to test is now on the master branch and I am bootstrapping in 32 bits.
I will try a make bootstrap tomorrow if I have time.
- Maxime
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
The bootstrapped Tachyon has 1 GB of memory for compiling and we run out of memory during the lowering of one of the standard library file.
If I have time today, I'll fix the 64 bit issue so that we have enough room for bootstrapping.
Erick
Le 11-03-19 15:40 , Maxime Chevalier-Boisvert a écrit :
Running out of memory in the bootstrapped Tachyon, with the 512MB heap? How far into the stdlib compilation?
- Maxime
On 11-03-19 03:29 PM, Erick Lavoie wrote:
I found the issue. The linked address was wrong because the base address was off by 6 which corresponds to the numerical value of undefined. In the bootstrapped getBlockAddr(blockObj, index), the index was never tested for undefined and in the linking code I was retrieving the address without an explicit index. I'll commit the fix.
We now get to compiling the stdlib but we run out of memory again.
Erick
Le 11-03-19 13:32 , Maxime Chevalier-Boisvert a écrit :
Well if the generated code is valid, that's good news. We should be pretty close to having it working. I suspect the same thing as you, that the linked values may be incorrect. The c proxy has the address of initHeap linked into it. It's also possible that whatever code gets the address of a given offset in the block gives the wrong result. I have implemented a separate getBlockAddr for Tachyon, so I should probably check that the result of that is correct. Finally, it's also possible the executable flag isn't set properly... Something I should look into as well.
- Maxime
On 11-03-19 12:43 PM, Erick Lavoie wrote:
I verified that the d8 "callTachyonFFI" is effectively called when we are trying to call 'initHeap'. I also checked the machine code generated for 'initHeap' and there is no code generation issue. As said in a previous mail, iterating through the properties of an object when bootstrapped is not done in the same order as in v8. In initHeap it causes the fields of the context object to be initialized in a different order but the result is still good. As a reference, I include the IR before and after code generation and the code listing for both v8 and tachyon.
If I recapitulate, I verified the following:
- The test for the bridge works, when calling C code from
bootstrapped tachyon 2. When trying to call 'initHeap' from bootstrapped tachyon, the C callTachyonFFI is called 2. The 'initHeap' c proxy code listing is byte identical except for the move ordering issue 3. The 'initHeap' code listing is byte identical except for the initialization order of the context and the move ordering issue
I guess the only possibility left is that the proxy code is not calling the right function, which might happen if the linked value in the machine code block does not correspond to the address of the entry point of the function in memory.
Erick
Le 11-03-19 1:27 , chevalma@iro.umontreal.ca a écrit :
The code fails on "calling FFI with rawCallTachyonFFI". I see 2 possibilities from here:
- The pointer value for making the call is wrong
You should look into that. The function pointer points inside the machine code block.
- The generated code for callTachyonFFI is wrong
I tested this on its own in a unit test. It seems to work properly.
Maxime, could you take a look at this? The code used to test is now on the master branch and I am bootstrapping in 32 bits.
I will try a make bootstrap tomorrow if I have time.
- Maxime
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list