Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use i64 as array length to support super large array #17958

Closed
2 tasks
kbkpbot opened this issue Apr 14, 2023 · 1 comment
Closed
2 tasks

Use i64 as array length to support super large array #17958

kbkpbot opened this issue Apr 14, 2023 · 1 comment
Labels
Feature Request This issue is made to request a feature.

Comments

@kbkpbot
Copy link
Contributor

kbkpbot commented Apr 14, 2023

Describe the feature

Use datatype i64 instead of int as the array's len, offset and cap.

Use Case

Currently vlang use int as the array length, this will cause problem when try to using vlang in science computation. It does not support super large array.

for example, the following code will hang ...

module main

const (
        num_memory_trace = u64(1073741825)
)

fn main() {

        mut memory_trace := []u64{}
        println('try reading ${int(num_memory_trace)} memory traces')
        unsafe {
                memory_trace.grow_len(int(num_memory_trace))
        }
        println('grow done')
}
try reading 1073741825 memory traces
^C

by changing the 1073741825 to 1073741824, it will work.

try reading 1073741824 memory traces
grow done

Proposed Solution

replace int with i64 in array code.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Version used

0.3.3 524f7c3

Environment details (OS name and version, etc.)

V full version: V 0.3.3 4f532c0.524f7c3
OS: linux, Ubuntu 22.04.2 LTS
Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz

getwd: /home/haha/v
vexe: /HD/github/lang/v/v
vexe mtime: 2023-04-13 09:18:04

vroot: OK, value: /HD/github/lang/v
VMODULES: OK, value: /home/haha/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.34.1
Git vroot status: weekly.2023.15-8-g524f7c3e-dirty (10 commit(s) behind V master)
.git/config present: true

CC version: cc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3-dirty

@kbkpbot kbkpbot added the Feature Request This issue is made to request a feature. label Apr 14, 2023
@ArtemkaKun
Copy link
Contributor

We have something like this on the 0.4 roadmap

 64/32 bit int depending on arch (will remove array.len limitation on 64 bit systems)

@vlang vlang locked and limited conversation to collaborators Jun 27, 2023
@medvednikov medvednikov converted this issue into discussion #18671 Jun 27, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Feature Request This issue is made to request a feature.
Projects
None yet
Development

No branches or pull requests

2 participants