Commit Graph

15401 Commits

Author SHA1 Message Date
laytan
9b218a2922 don't need to hang on to the null handle 2025-05-06 19:42:52 +02:00
Laytan
bf5206968a close null_handle 2025-05-06 20:57:26 +02:00
Laytan
2bce446d08 ifs wrong way around 2025-05-06 20:47:51 +02:00
Laytan
814a500e83 Windows was defaulting to the std handles of the current process, which is wrong 2025-05-06 20:43:02 +02:00
gingerBill
0cf5b5984d Merge pull request #5108 from Barinzaya/core-simd-indices-redadd-redmul
Alternate `reduce_add`/`reduce_mul` intrinsics
2025-05-06 15:46:49 +01:00
gingerBill
e074518983 Merge pull request #5124 from Barinzaya/core-simd-bmi-intrinsics
BMI/BMI2 Intrinsics
2025-05-06 15:29:34 +01:00
Jeroen van Rijn
8097b59e30 Also allow comparing SOA pointers against each other
This compares the data pointer *and* the index.

```odin
package scratch

import "core:fmt"

Foo :: struct {a, b: int}

main :: proc() {
    a := new(#soa[dynamic]Foo)
    a^ = make(#soa[dynamic]Foo, 12, 12)

    b := new(#soa[dynamic]Foo)
    b^ = make(#soa[dynamic]Foo, 12, 12)

    fmt.printfln("&a[0]: %p, &b[0]: %p, Same: %v", &a[0], &b[0], &a[0] == &b[0]) // Same: false
    fmt.printfln("&a[0]: %p, &b[0]: %p, Same: %v", &a[0], &b[1], &a[0] == &b[1]) // Same: false
    fmt.printfln("&a[0]: %p, &b[0]: %p, Same: %v", &a[0], &b[2], &a[0] == &b[2]) // Same: false

    fmt.printfln("&a[0]: %p, &a[1]: %p, Same: %v", &a[0], &a[1], &a[0] == &a[1]) // Same: false
    fmt.printfln("&a[1]: %p, &a[2]: %p, Same: %v", &a[1], &a[2], &a[1] == &a[2]) // Same: false
    fmt.printfln("&a[2]: %p, &a[3]: %p, Same: %v", &a[2], &a[3], &a[2] == &a[3]) // Same: false

    fmt.printfln("&a[0]: %p, &a[0]: %p, Same: %v", &a[0], &a[0], &a[0] == &a[0]) // Same: true
    fmt.printfln("&a[1]: %p, &a[1]: %p, Same: %v", &a[1], &a[1], &a[1] == &a[1]) // Same: true
    fmt.printfln("&a[2]: %p, &a[2]: %p, Same: %v", &a[2], &a[2], &a[2] == &a[2]) // Same: true
}
```
2025-05-06 15:10:08 +02:00
Laytan
e228ef221b Merge pull request #5125 from brian-hmn/fix-set-env
[core:os/os2] Fix: Correct value cloning in os2._set_env for POSIX
2025-05-06 12:24:17 +02:00
Jeroen van Rijn
9a8cc2d1e7 Merge pull request #5123 from bogwi/bug/5104
Bug/5104
2025-05-06 11:57:04 +02:00
Brian
27edbc5a76 Fix: Correct value cloning in os2._set_env for POSIX
The _set_env procedure in core/os/os2/env_posix.odin was
incorrectly cloning the 'key' argument for 'cval' instead of
the 'value' argument. This resulted in set_env effectively
setting the environment variable's value to its own key.

This commit corrects the typo to use the 'value' argument.
2025-05-06 17:45:06 +08:00
Barinzaya
41bf1ab6dd Added BMI and BMI2 intrinsics.
The BMI ones mostly aren't particularly interesting--they're mostly
trivially representable in-language--but PDEP and PEXT from BMI2 could
be.
2025-05-06 01:44:10 -04:00
Lucas Perlind
fd05f55691 Fix wasi_wasm 2025-05-06 15:23:44 +10:00
bogwi
904a64a45e Add support for SoaPointer nil comparison in lb_emit_comp_against_nil 2025-05-06 14:21:18 +09:00
Lucas Perlind
83bc2d3c4a Add asan support for various allocators 2025-05-06 14:55:50 +10:00
Jeroen van Rijn
8032db3484 Fix CreateDibSection binding 2025-05-05 23:23:39 +02:00
Barinzaya
dd5b7852ce Added alternate reduce-add/reduce-mul intrinsics.
The new reduce_add/reduce_mul procs perform the corresponding arithmetic
reduction in different orders than sequential order. These alternative
orders can often offer better SIMD hardware utilization.

Two different orders are added: pair-wise (operating on pairs of
adjacent elements) or bisection-wise (operating element-wise on the
first and last N/2 elements of the vector).
2025-05-05 16:38:45 -04:00
Barinzaya
9814370659 Merge branch 'master' into core-simd-indices-redadd-redmul 2025-05-05 16:37:02 -04:00
Vincent Billet
b34a490c02 Corrections, +XAPO 2025-05-05 22:14:20 +02:00
Jeroen van Rijn
2224911aca Fix type_union_tag_offset when all members are zero sized 2025-05-05 18:09:54 +02:00
bogwi
3c0ba5bb55 CHECK 4 done
The original errors:
1. `5024.odin(127:15) Error: Invalid use of a polymorphic type 'List($T)' in variable declaration`
2. `5024.odin(129:17) Error: Cannot determine polymorphic type from parameter: 'invalid type' to 'List($T)'`
Are gone. We now have a single, different error:
`5024.odin(124:28) Error: Unspecialized polymorphic types are not allowed in procedure parameters, got List($T)`

This error points directly to the `list : List($T)` parameter within the `List_Filter` procedure definition. This seems much more relevant to the actual problem (the interaction between the generic `List_Filter` and the concrete `default_filter`) than the original error about the variable declaration.

While this new error message might not be exactly pinpointing the default parameter issue, it correctly identifies the problematic procedure definition (`List_Filter`) as the source of the error, rather than the variable declaration (`my_list`). This seems like a step in the right direction for improving the error reporting for this kind of scenario.
2025-05-05 22:39:03 +09:00
Harold Brenes
14e25c0f2a Fix lb_get_objc_type_encoding missing matrix and simdvec encodings and minor fixes. 2025-05-05 09:07:50 -04:00
gingerBill
c4719e75fd Add simd.indices and docs 2025-05-05 11:43:19 +01:00
gingerBill
36945079f8 Add intrinsics.simd_indices 2025-05-05 11:41:54 +01:00
gingerBill
bc2a4dfe9d Merge pull request #5110 from omark96/feat/get_window_thread_process_id
win/sys: Add GetWindowThreadProcessId
2025-05-05 10:17:29 +01:00
bogwi
af6b763449 CHECK 3 done
Enhance support for polymorphic procedures in type checking

1. In src/check_type.cpp, added special handling for polymorphic procedures used as default parameter values. We now allow a polymorphic procedure to be used as a default parameter value, even when its type parameters can't be immediately determined.

2. In src/check_expr.cpp, we modified the check_is_assignable_to_with_score function to handle the special case of assigning a polymorphic procedure as a default parameter. The function now allows a polymorphic procedure to be assigned to a concrete procedure type in this specific context.
2025-05-05 17:53:32 +09:00
bogwi
af0e067a12 CHECK 2 done
Add support for handling generic types in LLVM backend

- Updated `lb_type_internal` to return a pointer type for unspecialized generics.
- Modified `write_type_to_canonical_string` to handle specialized generics without panicking.
- Enhanced `default_type` to return the default type of specialized generics when applicable.
2025-05-05 16:58:14 +09:00
bogwi
ee8aeea381 CHECK 1 done
Fix panic in LLVM backend when using generic procedure with default arguments

- Fixed panic in `llvm_backend_proc.cpp` when using unspecialized polymorphic procedures as defaults.
- Ensured correct type inference when generic procedures are used as default parameters.
2025-05-05 16:50:40 +09:00
Laytan
93f80f60fb Merge pull request #5112 from blob1807/master
`core:bufio`: Fix typo from `b.w-b.w` to `b.w-b.r`
2025-05-05 03:00:46 +02:00
Jeroen van Rijn
32cef4c11b Fix change_times on Windows and simplify time handling in stat 2025-05-04 22:55:27 +02:00
Jeroen van Rijn
1ce3a9f766 Merge pull request #5114 from Kelimion/os2-fixes
os2: Don't try to translate Windows file attributes to Unix mode flags
2025-05-04 20:21:44 +02:00
Jeroen van Rijn
95923c2059 os2: Don't try to translate Windows file attributes to Unix mode flags
Also, fix `chmod`. It passed the wrong struct size to `SetFileInformationByHandle`.
2025-05-04 20:03:07 +02:00
blob1807
39752faba4 Fix typo from b.w-b.w -> b.w-b.r 2025-05-04 15:48:26 +10:00
Jeroen van Rijn
0f2a4b80ef Proper fix for executable name on Linux. 2025-05-04 01:05:10 +02:00
Jeroen van Rijn
deededfb0a Fix executable_path info on Linux 2025-05-04 00:21:20 +02:00
omark96
1b8a65c327 win/sys: Add GetWindowThreadProcessId 2025-05-03 23:44:55 +02:00
Barinzaya
b0f53a6eaf Implemented suggestions on core:simd helpers.
Adjusted documentation, and renamed the reduce_*_split procs to
reduce_*_bisect.
2025-05-03 17:35:53 -04:00
Jeroen van Rijn
c96d8237ba Clarify error messages for types that aren't simply comparable.
Previously, it implied that these are different types:
```
W:/Scratch/scratch.odin(17:5) Error: Cannot compare expression, operator '==' not defined between the types 'Handle_Map($T=u32, $HT=u32, $Max=10000)' and 'Handle_Map($T=u32, $HT=u32, $Max=10000)'
    if m == {} {
       ^~~~~~^
```
Now:
```
W:/Scratch/scratch.odin(20:5) Error: Cannot compare expression. Type 'Handle_Map($T=u32, $HT=u32, $Max=10000)' is not simply comparable, so operator '==' is not defined for it.
	if m == {} {
	   ^~~~~~^
```
2025-05-03 22:31:01 +02:00
Barinzaya
6ebd30033f Removed an extra character that slipped into a comment. 2025-05-03 13:24:22 -04:00
Harold Brenes
be2e4dec7d Resolve other TODOs 2025-05-03 13:06:57 -04:00
Barinzaya
8b6436201e Fixed a reduce_add proc doing multiplication instead. 2025-05-03 13:04:11 -04:00
Barinzaya
7e34d707bb core:simd helpers: indices and reduce_add/mul
The indices proc simply creates a vector where each lane contains its
own lane index. This can be useful for use in generating masks for loads
and stores at the beginning/end of slices, among other things.

The new reduce_add/reduce_mul procs perform the corresponding arithmetic
reduction, in different orders than just "in sequential order". These
alternative orders can often be faster to calculate, as they can offer
better SIMD hardware utilization.

Two different orders are added for these: pair-wise (operating on
adjacent pairs of elements) or split-wise (operating element-wise on the
two halves of the vector).

This doesn't actually cover the *fastest* way for arbitrarily-sized
vectors. That would be an ordered reduction across the native vector
width, then reducing the resulting vector to a scalar in an appropriate
parallel fashion. I'd created an implementation of that, but it required
multiple procs and a fair bit more trickery than I was comfortable with
submitting to `core`, so it's not included yet. Maybe in the future.
2025-05-03 11:55:52 -04:00
Jeroen van Rijn
9681d88cd3 Fix #5107
Fixes #5107 by checking whether `result_count` is non-zero before indexing `type->Proc.results->Tuple.variables`.
2025-05-03 14:42:20 +02:00
Harold Brenes
fc082f5ea5 Remove some TODO. Leave important note 2025-05-03 03:21:03 -04:00
Harold Brenes
6d18560ca3 Move unconditionally exporting Objective-C methods to the right location 2025-05-03 03:09:31 -04:00
Harold Brenes
cf3830a6a8 Fix checker errors. 2025-05-03 03:09:31 -04:00
Harold Brenes
33d37c72f9 Register all classes unconditionally 2025-05-03 03:09:31 -04:00
Harold Brenes
a00b91577d Prevent multiple uses of the same Objective-C class name 2025-05-03 03:09:30 -04:00
Harold Brenes
5f0b47c373 Implement all checker specification for Objective-C class implementations and objc_ivar_get intrinsic 2025-05-03 00:59:33 -04:00
Jeroen van Rijn
30c6fea9e9 Allow polymorphic #simd array as return type 2025-05-02 15:38:43 +02:00
gingerBill
19fe75f020 Merge pull request #5098 from laytan/fix-nan-comparisons
fix variable NaN comparisons
2025-05-02 13:00:42 +01:00