I have not figured out how to put bytes into rodata.
The current solution calls malloc on every function call, then copies the elements from static memory to the allocated array. I think it also leaking the memory.
I don’t think stdlib figured it out either.
alias UNICODE_ID_START = Span(list=map_list(_UNICODE_ID_START__gen1)).get_immutable()
fn map_list(a: List[(Int, Int)]) -> List[(UInt32, UInt32)]:
return [(UInt32(start), UInt32(end)) for start, end in _UNICODE_ID_START__gen1]
alias _UNICODE_ID_START__gen1 = [
(0x0041, 0x005A),
(0x0061, 0x007A),
(0x00AA, 0x00AA),
(0x00B5, 0x00B5),
(0x00BA, 0x00BA),
(0x00C0, 0x00D6),
....
]
00000000000062c0 <is_unicode_id_start>:
62c0: 41 57 push r15
62c2: 41 56 push r14
62c4: 53 push rbx
62c5: 49 89 fe mov r14, rdi
62c8: bf 04 00 00 00 mov edi, 0x4
62cd: be 00 20 00 00 mov esi, 0x2000
62d2: e8 f9 0c 00 00 call 0x6fd0 <KGEN_CompilerRT_AlignedAlloc@plt>
62d7: 48 89 c3 mov rbx, rax
62da: c5 fc 28 05 7e b7 ff ff vmovaps ymm0, ymmword ptr [rip - 0x4882] # 0x1a60 <write+0x1a60>
62e2: c5 fc 11 00 vmovups ymmword ptr [rax], ymm0
62e6: c5 fc 28 05 12 ad ff ff vmovaps ymm0, ymmword ptr [rip - 0x52ee] # 0x1000 <write+0x1000>
62ee: c5 fc 11 40 20 vmovups ymmword ptr [rax + 0x20], ymm0
62f3: c5 fc 28 05 45 b6 ff ff vmovaps ymm0, ymmword ptr [rip - 0x49bb] # 0x1940 <write+0x1940>
62fb: c5 fc 11 40 40 vmovups ymmword ptr [rax + 0x40], ymm0
6300: c5 fc 28 05 78 ad ff ff vmovaps ymm0, ymmword ptr [rip - 0x5288] # 0x1080 <write+0x1080>
6308: c5 fc 11 40 60 vmovups ymmword ptr [rax + 0x60], ymm0
630d: c5 fc 28 05 2b b3 ff ff vmovaps ymm0, ymmword ptr [rip - 0x4cd5] # 0x1640 <write+0x1640>
6315: c5 fc 11 80 80 00 00 00 vmovups ymmword ptr [rax + 0x80], ymm0
631d: c5 fc 28 05 bb ae ff ff vmovaps ymm0, ymmword ptr [rip - 0x5145] # 0x11e0 <write+0x11e0>
6325: c5 fc 11 80 a0 00 00 00 vmovups ymmword ptr [rax + 0xa0], ymm0
632d: c5 fc 28 05 2b b4 ff ff vmovaps ymm0, ymmword ptr [rip - 0x4bd5] # 0x1760 <write+0x1760>
6335: c5 fc 11 80 c0 00 00 00 vmovups ymmword ptr [rax + 0xc0], ymm0
633d: c5 fc 28 05 9b b7 ff ff vmovaps ymm0, ymmword ptr [rip - 0x4865] # 0x1ae0 <write+0x1ae0>
6345: c5 fc 11 80 e0 00 00 00 vmovups ymmword ptr [rax + 0xe0], ymm0
634d: c5 fc 28 05 ab b1 ff ff vmovaps ymm0, ymmword ptr [rip - 0x4e55] # 0x1500 <write+0x1500>
6355: c5 fc 11 80 00 01 00 00 vmovups ymmword ptr [rax + 0x100], ymm0
...
6d7d: 48 8d b8 60 15 00 00 lea rdi, [rax + 0x1560]
6d84: 45 31 ff xor r15d, r15d
6d87: ba a0 0a 00 00 mov edx, 0xaa0
6d8c: 31 f6 xor esi, esi
6d8e: c5 f8 77 vzeroupper
6d91: e8 4a 02 00 00 call 0x6fe0 <memset@plt>
6d96: 41 8b 06 mov eax, dword ptr [r14]
6d99: eb 11 jmp 0x6dac <is_unicode_id_start+0xaec>
6d9b: 0f 1f 44 00 00 nop dword ptr [rax + rax]
6da0: 49 ff c7 inc r15
6da3: 49 81 ff ac 02 00 00 cmp r15, 0x2ac
6daa: 74 15 je 0x6dc1 <is_unicode_id_start+0xb01>
6dac: 42 39 04 fb cmp dword ptr [rbx + 8*r15], eax
6db0: 77 ee ja 0x6da0 <is_unicode_id_start+0xae0>
6db2: 42 3b 44 fb 04 cmp eax, dword ptr [rbx + 8*r15 + 0x4]
6db7: 77 e7 ja 0x6da0 <is_unicode_id_start+0xae0>
6db9: b0 01 mov al, 0x1
6dbb: 5b pop rbx
6dbc: 41 5e pop r14
6dbe: 41 5f pop r15
6dc0: c3 ret
6dc1: 31 c0 xor eax, eax
6dc3: 5b pop rbx
6dc4: 41 5e pop r14
6dc6: 41 5f pop r15
6dc8: c3 ret
6dc9: 0f 1f 80 00 00 00 00 nop dword ptr [rax]