aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/container/intrusive/list/intrusive_list.odin46
-rw-r--r--core/encoding/json/marshal.odin12
-rw-r--r--core/fmt/doc.odin3
-rw-r--r--core/fmt/fmt.odin61
-rw-r--r--core/mem/doc.odin2
-rw-r--r--core/mem/mem.odin2
-rw-r--r--core/odin/ast/ast.odin28
-rw-r--r--core/odin/parser/parser.odin5
-rw-r--r--core/os/os_linux.odin4
-rw-r--r--core/runtime/core.odin2
-rw-r--r--core/sys/windows/kernel32.odin15
-rw-r--r--src/llvm_backend_const.cpp8
-rw-r--r--src/tilde/tb.h305
-rw-r--r--src/tilde/tb.libbin4229318 -> 4265424 bytes
-rw-r--r--src/tilde/tb_arena.h6
-rw-r--r--src/tilde_builtin.cpp6
-rw-r--r--src/tilde_expr.cpp3
-rw-r--r--src/tilde_proc.cpp8
-rw-r--r--src/tilde_stmt.cpp20
-rw-r--r--src/tilde_type_info.cpp7
-rw-r--r--tests/core/Makefile6
-rw-r--r--tests/core/fmt/test_core_fmt.odin59
-rw-r--r--vendor/darwin/Foundation/NSBlock.odin101
-rw-r--r--vendor/directx/d3d11/d3d11.odin5
-rw-r--r--vendor/directx/dxc/dxcapi.odin261
-rw-r--r--vendor/directx/dxc/dxcdef_unix.odin37
-rw-r--r--vendor/directx/dxc/dxcdef_windows.odin16
-rw-r--r--vendor/raylib/raylib.odin2
28 files changed, 712 insertions, 318 deletions
diff --git a/core/container/intrusive/list/intrusive_list.odin b/core/container/intrusive/list/intrusive_list.odin
index 88e21edc5..7302f24f5 100644
--- a/core/container/intrusive/list/intrusive_list.odin
+++ b/core/container/intrusive/list/intrusive_list.odin
@@ -20,10 +20,10 @@ List :: struct {
Node :: struct {
- next, prev: ^Node,
+ prev, next: ^Node,
}
-push_front :: proc(list: ^List, node: ^Node) {
+push_front :: proc "contextless" (list: ^List, node: ^Node) {
if list.head != nil {
list.head.prev = node
node.prev, node.next = nil, list.head
@@ -34,7 +34,7 @@ push_front :: proc(list: ^List, node: ^Node) {
}
}
-push_back :: proc(list: ^List, node: ^Node) {
+push_back :: proc "contextless" (list: ^List, node: ^Node) {
if list.tail != nil {
list.tail.next = node
node.prev, node.next = list.tail, nil
@@ -45,7 +45,7 @@ push_back :: proc(list: ^List, node: ^Node) {
}
}
-remove :: proc(list: ^List, node: ^Node) {
+remove :: proc "contextless" (list: ^List, node: ^Node) {
if node != nil {
if node.next != nil {
node.next.prev = node.prev
@@ -83,12 +83,34 @@ remove_by_proc :: proc(list: ^List, to_erase: proc(^Node) -> bool) {
}
}
+remove_by_proc_contextless :: proc(list: ^List, to_erase: proc "contextless" (^Node) -> bool) {
+ for node := list.head; node != nil; {
+ next := node.next
+ if to_erase(node) {
+ if node.next != nil {
+ node.next.prev = node.prev
+ }
+ if node.prev != nil {
+ node.prev.next = node.next
+ }
+ if list.head == node {
+ list.head = node.next
+ }
+ if list.tail == node {
+ list.tail = node.prev
+ }
+ }
+ node = next
+ }
+}
+
+
-is_empty :: proc(list: ^List) -> bool {
+is_empty :: proc "contextless" (list: ^List) -> bool {
return list.head == nil
}
-pop_front :: proc(list: ^List) -> ^Node {
+pop_front :: proc "contextless" (list: ^List) -> ^Node {
link := list.head
if link == nil {
return nil
@@ -108,7 +130,7 @@ pop_front :: proc(list: ^List) -> ^Node {
return link
}
-pop_back :: proc(list: ^List) -> ^Node {
+pop_back :: proc "contextless" (list: ^List) -> ^Node {
link := list.tail
if link == nil {
return nil
@@ -134,25 +156,25 @@ Iterator :: struct($T: typeid) {
offset: uintptr,
}
-iterator_head :: proc(list: List, $T: typeid, $field_name: string) -> Iterator(T)
+iterator_head :: proc "contextless" (list: List, $T: typeid, $field_name: string) -> Iterator(T)
where intrinsics.type_has_field(T, field_name),
intrinsics.type_field_type(T, field_name) == Node {
return {list.head, offset_of_by_string(T, field_name)}
}
-iterator_tail :: proc(list: List, $T: typeid, $field_name: string) -> Iterator(T)
+iterator_tail :: proc "contextless" (list: List, $T: typeid, $field_name: string) -> Iterator(T)
where intrinsics.type_has_field(T, field_name),
intrinsics.type_field_type(T, field_name) == Node {
return {list.tail, offset_of_by_string(T, field_name)}
}
-iterator_from_node :: proc(node: ^Node, $T: typeid, $field_name: string) -> Iterator(T)
+iterator_from_node :: proc "contextless" (node: ^Node, $T: typeid, $field_name: string) -> Iterator(T)
where intrinsics.type_has_field(T, field_name),
intrinsics.type_field_type(T, field_name) == Node {
return {node, offset_of_by_string(T, field_name)}
}
-iterate_next :: proc(it: ^Iterator($T)) -> (ptr: ^T, ok: bool) {
+iterate_next :: proc "contextless" (it: ^Iterator($T)) -> (ptr: ^T, ok: bool) {
node := it.curr
if node == nil {
return nil, false
@@ -162,7 +184,7 @@ iterate_next :: proc(it: ^Iterator($T)) -> (ptr: ^T, ok: bool) {
return (^T)(uintptr(node) - it.offset), true
}
-iterate_prev :: proc(it: ^Iterator($T)) -> (ptr: ^T, ok: bool) {
+iterate_prev :: proc "contextless" (it: ^Iterator($T)) -> (ptr: ^T, ok: bool) {
node := it.curr
if node == nil {
return nil, false
diff --git a/core/encoding/json/marshal.odin b/core/encoding/json/marshal.odin
index 77a5bf8df..43f464bdb 100644
--- a/core/encoding/json/marshal.odin
+++ b/core/encoding/json/marshal.odin
@@ -404,7 +404,7 @@ opt_write_key :: proc(w: io.Writer, opt: ^Marshal_Options, name: string) -> (err
switch opt.spec {
case .JSON, .JSON5:
io.write_quoted_string(w, name) or_return
- io.write_string(w, ": ") or_return
+ io.write_string(w, ": " if opt.pretty else ":") or_return
case .MJSON:
if opt.mjson_keys_use_quotes {
@@ -412,11 +412,11 @@ opt_write_key :: proc(w: io.Writer, opt: ^Marshal_Options, name: string) -> (err
} else {
io.write_string(w, name) or_return
}
-
+
if opt.mjson_keys_use_equal_sign {
- io.write_string(w, " = ") or_return
+ io.write_string(w, " = " if opt.pretty else "=") or_return
} else {
- io.write_string(w, ": ") or_return
+ io.write_string(w, ": " if opt.pretty else ":") or_return
}
}
@@ -446,7 +446,7 @@ opt_write_iteration :: proc(w: io.Writer, opt: ^Marshal_Options, iteration: int)
switch opt.spec {
case .JSON, .JSON5:
if iteration > 0 {
- io.write_string(w, ", ") or_return
+ io.write_byte(w, ',') or_return
if opt.pretty {
io.write_byte(w, '\n') or_return
@@ -462,7 +462,7 @@ opt_write_iteration :: proc(w: io.Writer, opt: ^Marshal_Options, iteration: int)
io.write_byte(w, '\n') or_return
} else {
// comma separation necessary for non pretty output!
- io.write_string(w, ", ") or_return
+ io.write_byte(w, ',') or_return
}
}
diff --git a/core/fmt/doc.odin b/core/fmt/doc.odin
index 991058661..597342e76 100644
--- a/core/fmt/doc.odin
+++ b/core/fmt/doc.odin
@@ -35,6 +35,8 @@ Floating-point, complex numbers, and quaternions:
%F synonym for %f
%h hexadecimal (lower-case) representation with 0h prefix (0h01234abcd)
%H hexadecimal (upper-case) representation with 0H prefix (0h01234ABCD)
+ %m number of bytes in the best unit of measurement, e.g. 123.45mib
+ %M number of bytes in the best unit of measurement, e.g. 123.45MiB
String and slice of bytes
%s the uninterpreted bytes of the string or slice
%q a double-quoted string safely escaped with Odin syntax
@@ -85,6 +87,7 @@ Other flags:
add leading 0z for dozenal (%#z)
add leading 0x or 0X for hexadecimal (%#x or %#X)
remove leading 0x for %p (%#p)
+ add a space between bytes and the unit of measurement (%#m or %#M)
' ' (space) leave a space for elided sign in numbers (% d)
0 pad with leading zeros rather than spaces
diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin
index b3b8067e8..ab57209c3 100644
--- a/core/fmt/fmt.odin
+++ b/core/fmt/fmt.odin
@@ -1048,6 +1048,65 @@ _fmt_int_128 :: proc(fi: ^Info, u: u128, base: int, is_signed: bool, bit_size: i
fi.zero = false
_pad(fi, s)
}
+// Units of measurements:
+__MEMORY_LOWER := " b kib mib gib tib pib eib"
+__MEMORY_UPPER := " B KiB MiB GiB TiB PiB EiB"
+// Formats an integer value as bytes with the best representation.
+//
+// Inputs:
+// - fi: A pointer to an Info structure
+// - u: The integer value to format
+// - is_signed: A boolean indicating if the integer is signed
+// - bit_size: The bit size of the integer
+// - digits: A string containing the digits for formatting
+//
+_fmt_memory :: proc(fi: ^Info, u: u64, is_signed: bool, bit_size: int, units: string) {
+ abs, neg := strconv.is_integer_negative(u, is_signed, bit_size)
+
+ // Default to a precision of 2, but if less than a kb, 0
+ prec := fi.prec if (fi.prec_set || abs < mem.Kilobyte) else 2
+
+ div, off, unit_len := 1, 0, 1
+ for n := abs; n >= mem.Kilobyte; n /= mem.Kilobyte {
+ div *= mem.Kilobyte
+ off += 4
+
+ // First iteration is slightly different because you go from
+ // units of length 1 to units of length 2.
+ if unit_len == 1 {
+ off = 2
+ unit_len = 3
+ }
+ }
+
+ // If hash, we add a space between the value and the suffix.
+ if fi.hash {
+ unit_len += 1
+ } else {
+ off += 1
+ }
+
+ amt := f64(abs) / f64(div)
+ if neg {
+ amt = -amt
+ }
+
+ buf: [256]byte
+ str := strconv.append_float(buf[:], amt, 'f', prec, 64)
+
+ // Add the unit at the end.
+ copy(buf[len(str):], units[off:off+unit_len])
+ str = string(buf[:len(str)+unit_len])
+
+ if !fi.plus {
+ // Strip sign from "+<value>" but not "+Inf".
+ if str[0] == '+' && str[1] != 'I' {
+ str = str[1:]
+ }
+ }
+
+ _pad(fi, str)
+}
// Hex Values:
__DIGITS_LOWER := "0123456789abcdefx"
__DIGITS_UPPER := "0123456789ABCDEFX"
@@ -1096,6 +1155,8 @@ fmt_int :: proc(fi: ^Info, u: u64, is_signed: bool, bit_size: int, verb: rune) {
io.write_string(fi.writer, "U+", &fi.n)
_fmt_int(fi, u, 16, false, bit_size, __DIGITS_UPPER)
}
+ case 'm': _fmt_memory(fi, u, is_signed, bit_size, __MEMORY_LOWER)
+ case 'M': _fmt_memory(fi, u, is_signed, bit_size, __MEMORY_UPPER)
case:
fmt_bad_verb(fi, verb)
diff --git a/core/mem/doc.odin b/core/mem/doc.odin
index 295a69e96..e232428c2 100644
--- a/core/mem/doc.odin
+++ b/core/mem/doc.odin
@@ -24,7 +24,7 @@ main :: proc() {
_main()
for _, leak in track.allocation_map {
- fmt.printf("%v leaked %v bytes\n", leak.location, leak.size)
+ fmt.printf("%v leaked %m\n", leak.location, leak.size)
}
for bad_free in track.bad_free_array {
fmt.printf("%v allocation %p was freed badly\n", bad_free.location, bad_free.memory)
diff --git a/core/mem/mem.odin b/core/mem/mem.odin
index a06579d71..dd985d5dd 100644
--- a/core/mem/mem.odin
+++ b/core/mem/mem.odin
@@ -8,6 +8,8 @@ Kilobyte :: runtime.Kilobyte
Megabyte :: runtime.Megabyte
Gigabyte :: runtime.Gigabyte
Terabyte :: runtime.Terabyte
+Petabyte :: runtime.Petabyte
+Exabyte :: runtime.Exabyte
set :: proc "contextless" (data: rawptr, value: byte, len: int) -> rawptr {
return runtime.memset(data, i32(value), len)
diff --git a/core/odin/ast/ast.odin b/core/odin/ast/ast.odin
index f2c3e029b..b462a3107 100644
--- a/core/odin/ast/ast.odin
+++ b/core/odin/ast/ast.odin
@@ -553,6 +553,27 @@ unparen_expr :: proc(expr: ^Expr) -> (val: ^Expr) {
return
}
+strip_or_return_expr :: proc(expr: ^Expr) -> (val: ^Expr) {
+ val = expr
+ if expr == nil {
+ return
+ }
+ for {
+ inner: ^Expr
+ #partial switch e in val.derived {
+ case ^Or_Return_Expr:
+ inner = e.expr
+ case ^Paren_Expr:
+ inner = e.expr
+ }
+ if inner == nil {
+ break
+ }
+ val = inner
+ }
+ return
+}
+
Field_Flags :: distinct bit_set[Field_Flag]
Field_Flag :: enum {
@@ -563,7 +584,7 @@ Field_Flag :: enum {
Using,
No_Alias,
C_Vararg,
- Auto_Cast,
+ Const,
Any_Int,
Subtype,
By_Ptr,
@@ -582,7 +603,7 @@ field_flag_strings := [Field_Flag]string{
.Using = "using",
.No_Alias = "#no_alias",
.C_Vararg = "#c_vararg",
- .Auto_Cast = "auto_cast",
+ .Const = "#const",
.Any_Int = "#any_int",
.Subtype = "#subtype",
.By_Ptr = "#by_ptr",
@@ -596,6 +617,7 @@ field_flag_strings := [Field_Flag]string{
field_hash_flag_strings := []struct{key: string, flag: Field_Flag}{
{"no_alias", .No_Alias},
{"c_vararg", .C_Vararg},
+ {"const", .Const},
{"any_int", .Any_Int},
{"subtype", .Subtype},
{"by_ptr", .By_Ptr},
@@ -616,7 +638,7 @@ Field_Flags_Signature :: Field_Flags{
.Using,
.No_Alias,
.C_Vararg,
- .Auto_Cast,
+ .Const,
.Any_Int,
.By_Ptr,
.Default_Parameters,
diff --git a/core/odin/parser/parser.odin b/core/odin/parser/parser.odin
index da6530911..39280061f 100644
--- a/core/odin/parser/parser.odin
+++ b/core/odin/parser/parser.odin
@@ -1666,9 +1666,6 @@ is_token_field_prefix :: proc(p: ^Parser) -> ast.Field_Flag {
case .Using:
advance_token(p)
return .Using
- case .Auto_Cast:
- advance_token(p)
- return .Auto_Cast
case .Hash:
tok: tokenizer.Token
advance_token(p)
@@ -2153,7 +2150,7 @@ parse_inlining_operand :: proc(p: ^Parser, lhs: bool, tok: tokenizer.Token) -> ^
}
}
- #partial switch e in ast.unparen_expr(expr).derived_expr {
+ #partial switch e in ast.strip_or_return_expr(expr).derived_expr {
case ^ast.Proc_Lit:
if e.inlining != .None && e.inlining != pi {
error(p, expr.pos, "both 'inline' and 'no_inline' cannot be applied to a procedure literal")
diff --git a/core/os/os_linux.odin b/core/os/os_linux.odin
index 1a4c1fddb..51a14ab44 100644
--- a/core/os/os_linux.odin
+++ b/core/os/os_linux.odin
@@ -441,7 +441,7 @@ pollfd :: struct {
sigset_t :: distinct u64
foreign libc {
- @(link_name="__errno_location") __errno_location :: proc() -> ^int ---
+ @(link_name="__errno_location") __errno_location :: proc() -> ^c.int ---
@(link_name="getpagesize") _unix_getpagesize :: proc() -> c.int ---
@(link_name="get_nprocs") _unix_get_nprocs :: proc() -> c.int ---
@@ -488,7 +488,7 @@ _get_errno :: proc(res: int) -> Errno {
// get errno from libc
get_last_error :: proc "contextless" () -> int {
- return __errno_location()^
+ return int(__errno_location()^)
}
personality :: proc(persona: u64) -> (Errno) {
diff --git a/core/runtime/core.odin b/core/runtime/core.odin
index 4f85cf50e..0634f573a 100644
--- a/core/runtime/core.odin
+++ b/core/runtime/core.odin
@@ -337,6 +337,8 @@ Kilobyte :: 1024 * Byte
Megabyte :: 1024 * Kilobyte
Gigabyte :: 1024 * Megabyte
Terabyte :: 1024 * Gigabyte
+Petabyte :: 1024 * Terabyte
+Exabyte :: 1024 * Petabyte
// Logging stuff
diff --git a/core/sys/windows/kernel32.odin b/core/sys/windows/kernel32.odin
index 2b63595a4..0c612a974 100644
--- a/core/sys/windows/kernel32.odin
+++ b/core/sys/windows/kernel32.odin
@@ -132,6 +132,21 @@ foreign kernel32 {
SetThreadPriority :: proc(thread: HANDLE, priority: c_int) -> BOOL ---
GetExitCodeThread :: proc(thread: HANDLE, exit_code: ^DWORD) -> BOOL ---
TerminateThread :: proc(thread: HANDLE, exit_code: DWORD) -> BOOL ---
+ SuspendThread :: proc(hThread: HANDLE) -> DWORD ---
+
+ GetProcessAffinityMask :: proc(
+ hProcess: HANDLE,
+ lpProcessAffinityMask: PDWORD_PTR,
+ lpSystemAffinityMask: PDWORD_PTR,
+ ) -> BOOL ---
+ SetProcessAffinityMask :: proc(
+ hProcess: HANDLE,
+ dwProcessAffinityMask: DWORD_PTR,
+ ) -> BOOL ---
+ SetThreadAffinityMask :: proc(
+ hThread: HANDLE,
+ dwThreadAffinityMask: DWORD_PTR,
+ ) -> DWORD_PTR ---
CreateSemaphoreW :: proc(attributes: LPSECURITY_ATTRIBUTES, initial_count, maximum_count: LONG, name: LPCWSTR) -> HANDLE ---
ReleaseSemaphore :: proc(semaphore: HANDLE, release_count: LONG, previous_count: ^LONG) -> BOOL ---
diff --git a/src/llvm_backend_const.cpp b/src/llvm_backend_const.cpp
index 01b0528d0..fc7d4e2f7 100644
--- a/src/llvm_backend_const.cpp
+++ b/src/llvm_backend_const.cpp
@@ -467,7 +467,7 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bo
}
if (value.kind == ExactValue_Invalid) {
- return lb_const_nil(m, type);
+ return lb_const_nil(m, original_type);
}
if (value.kind == ExactValue_Procedure) {
@@ -1052,13 +1052,14 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bo
i32 index = field_remapping[f->Variable.field_index];
if (elem_type_can_be_constant(f->type)) {
if (sel.index.count == 1) {
- values[index] = lb_const_value(m, f->type, tav.value, allow_local).value;
+ values[index] = lb_const_value(m, f->type, tav.value, allow_local).value;
visited[index] = true;
} else {
if (!visited[index]) {
- values[index] = lb_const_value(m, f->type, {}, false).value;
+ values[index] = lb_const_value(m, f->type, {}, false).value;
visited[index] = true;
}
+
unsigned idx_list_len = cast(unsigned)sel.index.count-1;
unsigned *idx_list = gb_alloc_array(temporary_allocator(), unsigned, idx_list_len);
@@ -1171,7 +1172,6 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bo
}
}
return lb_addr_load(p, v);
-
}
} else if (is_type_bit_set(type)) {
ast_node(cl, CompoundLit, value.value_compound);
diff --git a/src/tilde/tb.h b/src/tilde/tb.h
index 081a84995..5bb98fe70 100644
--- a/src/tilde/tb.h
+++ b/src/tilde/tb.h
@@ -1,3 +1,12 @@
+// Glossary (because i don't know where else to put it)
+// IR - intermediate representation
+// SoN - sea of nodes (https://www.oracle.com/technetwork/java/javase/tech/c2-ir95-150110.pdf)
+// SSA - single static assignment
+// GVN - global value numbering
+// CSE - common subexpression elimination
+// DSE - dead store elimination
+// GCM - global code motion
+// SROA - scalar replacement of aggregates
#ifndef TB_CORE_H
#define TB_CORE_H
@@ -150,18 +159,19 @@ typedef enum TB_ISelMode {
typedef enum TB_DataTypeEnum {
// Integers, note void is an i0 and bool is an i1
- // i(0-2047)
+ // i(0-64)
TB_INT,
// Floating point numbers
// f{32,64}
TB_FLOAT,
// Pointers
- // ptr(0-2047)
TB_PTR,
// Tuples, these cannot be used in memory ops, just accessed via projections
TB_TUPLE,
- // represents control flow as a kind of data
+ // represents control flow for REGION, BRANCH
TB_CONTROL,
+ // represents memory (and I/O)
+ TB_MEMORY,
} TB_DataTypeEnum;
typedef enum TB_FloatFormat {
@@ -179,6 +189,7 @@ typedef union TB_DataType {
};
uint32_t raw;
} TB_DataType;
+static_assert(sizeof(TB_DataType) == 4, "im expecting this to be a uint32_t");
// classify data types
#define TB_IS_VOID_TYPE(x) ((x).type == TB_INT && (x).data == 0)
@@ -192,75 +203,136 @@ typedef union TB_DataType {
#define TB_GET_FLOAT_FORMAT(x) ((x).data)
#define TB_GET_PTR_ADDRSPACE(x) ((x).data)
+////////////////////////////////
+// ANNOTATIONS
+////////////////////////////////
+//
+// (A, B) -> (C, D)
+//
+// node takes A and B, produces C, D. if there's multiple
+// results we need to use projections and the indices are
+// based on the order seen here, proj0 is C, proj1 is D.
+//
+// (A, B) & C -> Int
+//
+// nodes takes A and B along with C in it's extra data. this is
+// where non-node inputs fit.
+//
typedef enum TB_NodeTypeEnum {
TB_NULL = 0,
- // Immediates
+ ////////////////////////////////
+ // CONSTANTS
+ ////////////////////////////////
TB_INTEGER_CONST,
TB_FLOAT32_CONST,
TB_FLOAT64_CONST,
- // only one per function
- TB_START, // fn()
-
- // regions represent the begining of BBs
- TB_REGION, // fn(preds: []region)
-
- // projection
- TB_PROJ,
-
- TB_CALL, // normal call
- TB_SYSCALL, // system call
-
- // Managed ops
- TB_SAFEPOINT,
-
- // Memory operations
- TB_STORE, // fn(r: control, addr: data, src: data)
- TB_MEMCPY,
- TB_MEMSET,
-
- // Atomics
- TB_ATOMIC_TEST_AND_SET,
- TB_ATOMIC_CLEAR,
-
- TB_ATOMIC_LOAD,
- TB_ATOMIC_XCHG,
- TB_ATOMIC_ADD,
- TB_ATOMIC_SUB,
- TB_ATOMIC_AND,
- TB_ATOMIC_XOR,
- TB_ATOMIC_OR,
-
- TB_ATOMIC_CMPXCHG,
- TB_DEBUGBREAK,
-
- // Terminators
- TB_BRANCH,
- TB_RET,
- TB_UNREACHABLE,
- TB_TRAP,
-
- TB_POISON,
-
- // Load
- TB_LOAD,
-
- // Pointers
- TB_LOCAL,
-
- TB_GET_SYMBOL_ADDRESS,
-
- TB_MEMBER_ACCESS,
- TB_ARRAY_ACCESS,
+ ////////////////////////////////
+ // MISCELLANEOUS
+ ////////////////////////////////
+ // this is an unspecified value, usually generated by the optimizer
+ // when malformed input is folded into an operation.
+ TB_POISON, // () -> Any
+ // projections just extract a single field of a tuple
+ TB_PROJ, // Tuple & Int -> Any
+ // this is a simple way to embed machine code into the code
+ TB_MACHINE_OP, // (Control, Memory) & Buffer -> (Control, Memory)
+ // reads the TSC on x64
+ TB_CYCLE_COUNTER, // (Control) -> Int64
+
+ ////////////////////////////////
+ // CONTROL
+ ////////////////////////////////
+ // there's only one START and STOP per function
+ TB_START, // () -> (Control, Memory, Data...)
+ TB_END, // (Control, Memory, Data?) -> ()
+ // regions are used to represent paths which have multiple entries.
+ // each input is a predecessor.
+ TB_REGION, // (Control...) -> (Control)
+ // phi nodes work the same as in SSA CFG, the value is based on which predecessor was taken.
+ // each input lines up with the regions such that region.in[i] will use phi.in[i+1] as the
+ // subsequent data.
+ TB_PHI, // (Control, Data...) -> Data
+ // branch is used to implement most control flow, it acts like a switch
+ // statement in C usually. they take a key and match against some cases,
+ // if they match, it'll jump to that successor, if none match it'll take
+ // the default successor.
+ //
+ // if (cond) { A; } else { B; } is just switch (cond) { case 0: B; default: A; }
+ //
+ // it's possible to not pass a key and the default successor is always called, this is
+ // a GOTO. tb_inst_goto, tb_inst_if can handle common cases for you.
+ TB_BRANCH, // (Control, Data?) -> (Control...)
+ // debugbreak will trap in a continuable manner.
+ TB_DEBUGBREAK, // (Control, Memory) -> (Control)
+ // trap will not be continuable but will stop execution.
+ TB_TRAP, // (Control) -> (Control)
+ // unreachable means it won't trap or be continuable.
+ TB_UNREACHABLE, // (Control) -> (Control)
+
+ ////////////////////////////////
+ // CONTROL + MEMORY
+ ////////////////////////////////
+ // nothing special, it's just a function call, 3rd argument here is the
+ // target pointer (or syscall number) and the rest are just data args.
+ TB_CALL, // (Control, Memory, Data, Data...) -> (Control, Memory, Data)
+ TB_SYSCALL, // (Control, Memory, Data, Data...) -> (Control, Memory, Data)
+ // safepoint polls are the same except they only trigger if the poll site
+ // says to (platform specific but almost always just the page being made
+ // unmapped/guard), 3rd argument is the poll site.
+ TB_SAFEPOINT_POLL, // (Control, Memory, Ptr, Data...) -> (Control)
+
+ ////////////////////////////////
+ // MEMORY
+ ////////////////////////////////
+ // LOAD and STORE are standard memory accesses, they can be folded away.
+ TB_LOAD, // (Memory, Ptr) -> Data
+ TB_STORE, // (Memory, Ptr, Data) -> Memory
+ // bulk memory ops.
+ TB_MEMCPY, // (Memory, Ptr, Ptr, Size) -> Memory
+ TB_MEMSET, // (Memory, Ptr, Int8, Size) -> Memory
+ // these memory accesses represent "volatile" which means
+ // they may produce side effects and thus cannot be eliminated.
+ TB_READ, // (Memory, Ptr) -> (Memory, Data)
+ TB_WRITE, // (Memory, Ptr, Data) -> (Memory, Data)
+ // atomics have multiple observers (if not they wouldn't need to
+ // be atomic) and thus produce side effects everywhere just like
+ // volatiles except they have synchronization guarentees. the atomic
+ // data ops will return the value before the operation is performed.
+ // Atomic CAS return the old value and a boolean for success (true if
+ // the value was changed)
+ TB_ATOMIC_LOAD, // (Memory, Ptr) -> (Memory, Data)
+ TB_ATOMIC_XCHG, // (Memory, Ptr, Data) -> (Memory, Data)
+ TB_ATOMIC_ADD, // (Memory, Ptr, Data) -> (Memory, Data)
+ TB_ATOMIC_SUB, // (Memory, Ptr, Data) -> (Memory, Data)
+ TB_ATOMIC_AND, // (Memory, Ptr, Data) -> (Memory, Data)
+ TB_ATOMIC_XOR, // (Memory, Ptr, Data) -> (Memory, Data)
+ TB_ATOMIC_OR, // (Memory, Ptr, Data) -> (Memory, Data)
+ TB_ATOMIC_CAS, // (Memory, Data, Data) -> (Memory, Data, Bool)
+
+ ////////////////////////////////
+ // POINTERS
+ ////////////////////////////////
+ // LOCAL will statically allocate stack space
+ TB_LOCAL, // () & (Int, Int) -> Ptr
+ // SYMBOL will return a pointer to a TB_Symbol
+ TB_SYMBOL, // () & TB_Symbol* -> Ptr
+ // offsets pointer by constant value
+ TB_MEMBER_ACCESS, // Ptr & Int -> Ptr
+ // arguments represent base, index, and stride respectively
+ // and will perform `base + index*stride`
+ TB_ARRAY_ACCESS, // (Ptr, Int) & Int -> Ptr
+ // converts an integer to a pointer
+ TB_INT2PTR, // Int -> Ptr
+ // converts a pointer to an integer
+ TB_PTR2INT, // Ptr -> Int
// Conversions
TB_TRUNCATE,
TB_FLOAT_EXT,
TB_SIGN_EXT,
TB_ZERO_EXT,
- TB_INT2PTR,
- TB_PTR2INT,
TB_UINT2FLOAT,
TB_FLOAT2UINT,
TB_INT2FLOAT,
@@ -315,18 +387,17 @@ typedef enum TB_NodeTypeEnum {
TB_CMP_FLE,
// Special ops
- // does full multiplication (64x64=128 and so on) returning
- // the low and high values in separate projections
+ // adds two paired integers to two other paired integers and returns
+ // a low and high value
+ TB_ADDPAIR,
+ // does full multiplication (64x64=128 and so on) returning
+ // the low and high values in separate projections
TB_MULPAIR,
- // PHI
- TB_PHI, // fn(r: region, x: []data)
-
// variadic
TB_VA_START,
// x86 intrinsics
- TB_X86INTRIN_RDTSC,
TB_X86INTRIN_LDMXCSR,
TB_X86INTRIN_STMXCSR,
TB_X86INTRIN_SQRT,
@@ -372,6 +443,9 @@ typedef struct TB_FunctionPrototype TB_FunctionPrototype;
typedef struct TB_Attrib TB_Attrib;
+// target-specific, just a unique ID for the registers
+typedef int TB_PhysicalReg;
+
// Refers generically to objects within a module
//
// TB_Function, TB_Global, and TB_External are all subtypes of TB_Symbol
@@ -412,12 +486,11 @@ typedef struct TB_Symbol {
typedef struct TB_Node TB_Node;
struct TB_Node {
TB_NodeType type;
+ uint16_t input_count; // number of node inputs.
TB_DataType dt;
- uint16_t input_count; // number of node inputs
- uint16_t extra_count; // number of bytes for extra operand data
- // local to the TB_Passes
- uint32_t lattice_id;
+ // makes it easier to track in graph walks
+ size_t gvn;
TB_Attrib* attribs;
TB_Node** inputs;
@@ -442,9 +515,8 @@ typedef struct { // TB_PROJ
int index;
} TB_NodeProj;
-typedef struct { // TB_INT
- uint64_t num_words;
- uint64_t words[];
+typedef struct { // TB_INTEGER_CONST
+ uint64_t value;
} TB_NodeInt;
typedef struct { // any compare operator
@@ -457,11 +529,10 @@ typedef struct { // any integer binary operator
typedef struct { // TB_MULPAIR
TB_Node *lo, *hi;
-} TB_NodeMulPair;
+} TB_NodeArithPair;
typedef struct {
TB_CharUnits align;
- bool is_volatile;
} TB_NodeMemAccess;
typedef struct {
@@ -469,6 +540,16 @@ typedef struct {
} TB_NodeLocal;
typedef struct {
+ // this is the raw buffer
+ size_t length;
+ const uint8_t* data;
+
+ // represents the outputs, inputs and temporaries in that order
+ size_t outs, ins, tmps;
+ TB_PhysicalReg regs[];
+} TB_NodeMachineOp;
+
+typedef struct {
float value;
} TB_NodeFloat32;
@@ -491,6 +572,8 @@ typedef struct {
typedef struct {
TB_MemoryOrder order;
TB_MemoryOrder order2;
+ TB_Node* proj0;
+ TB_Node* proj1;
} TB_NodeAtomic;
typedef struct {
@@ -506,9 +589,18 @@ typedef struct {
TB_Node* end;
const char* tag;
+ // position in a postorder walk
+ int postorder_id;
// immediate dominator (can be approximate)
int dom_depth;
TB_Node* dom;
+
+ // used for IR building only, stale after that.
+ //
+ // this represents the first and last memory values within a region,
+ // if a region ever has multiple predecessors we apply a join on these
+ // memory.
+ TB_Node *mem_in, *mem_out;
} TB_NodeRegion;
typedef struct TB_MultiOutput {
@@ -558,7 +650,7 @@ typedef struct {
#define TB_TYPE_F64 TB_DataType{ { TB_FLOAT, 0, TB_FLT_64 } }
#define TB_TYPE_BOOL TB_DataType{ { TB_INT, 0, 1 } }
#define TB_TYPE_PTR TB_DataType{ { TB_PTR, 0, 0 } }
-
+#define TB_TYPE_MEMORY TB_DataType{ { TB_MEMORY,0, 0 } }
#define TB_TYPE_INTN(N) TB_DataType{ { TB_INT, 0, (N) } }
#define TB_TYPE_PTRN(N) TB_DataType{ { TB_PTR, 0, (N) } }
@@ -575,8 +667,9 @@ typedef struct {
#define TB_TYPE_F64 (TB_DataType){ { TB_FLOAT, 0, TB_FLT_64 } }
#define TB_TYPE_BOOL (TB_DataType){ { TB_INT, 0, 1 } }
#define TB_TYPE_PTR (TB_DataType){ { TB_PTR, 0, 0 } }
-#define TB_TYPE_INTN(N) (TB_DataType){ { TB_INT, 0, (N) } }
-#define TB_TYPE_PTRN(N) (TB_DataType){ { TB_PTR, 0, (N) } }
+#define TB_TYPE_MEMORY (TB_DataType){ { TB_MEMORY,0, 0 } }
+#define TB_TYPE_INTN(N) (TB_DataType){ { TB_INT, 0, (N) } }
+#define TB_TYPE_PTRN(N) (TB_DataType){ { TB_PTR, 0, (N) } }
#endif
@@ -737,7 +830,7 @@ TB_API TB_External* tb_next_external(TB_External* e);
// this is used JIT scenarios to tell the compiler what externals map to
TB_API TB_ExternalType tb_extern_get_type(TB_External* e);
-TB_Global* tb_extern_transmute(TB_External* e, TB_DebugType* dbg_type, TB_Linkage linkage);
+TB_API TB_Global* tb_extern_transmute(TB_External* e, TB_DebugType* dbg_type, TB_Linkage linkage);
TB_API TB_External* tb_extern_create(TB_Module* m, ptrdiff_t len, const char* name, TB_ExternalType type);
@@ -884,6 +977,11 @@ TB_API void tb_default_print_callback(void* user_data, const char* fmt, ...);
TB_API void tb_inst_set_location(TB_Function* f, TB_SourceFile* file, int line, int column);
TB_API void tb_inst_reset_location(TB_Function* f);
+// this is where the STOP will be
+TB_API void tb_inst_set_exit_location(TB_Function* f, TB_SourceFile* file, int line, int column);
+
+TB_API bool tb_has_effects(TB_Node* n);
+
// if section is NULL, default to .text
TB_API TB_Function* tb_function_create(TB_Module* m, ptrdiff_t len, const char* name, TB_Linkage linkage, TB_ComdatType comdat);
@@ -927,9 +1025,12 @@ TB_API TB_Node* tb_inst_float2int(TB_Function* f, TB_Node* src, TB_DataType dt,
TB_API TB_Node* tb_inst_bitcast(TB_Function* f, TB_Node* src, TB_DataType dt);
TB_API TB_Node* tb_inst_local(TB_Function* f, TB_CharUnits size, TB_CharUnits align);
+
TB_API TB_Node* tb_inst_load(TB_Function* f, TB_DataType dt, TB_Node* addr, TB_CharUnits align, bool is_volatile);
TB_API void tb_inst_store(TB_Function* f, TB_DataType dt, TB_Node* addr, TB_Node* val, TB_CharUnits align, bool is_volatile);
+TB_API void tb_inst_safepoint_poll(TB_Function* f, TB_Node* addr, int input_count, TB_Node** inputs);
+
TB_API TB_Node* tb_inst_bool(TB_Function* f, bool imm);
TB_API TB_Node* tb_inst_sint(TB_Function* f, TB_DataType dt, int64_t imm);
TB_API TB_Node* tb_inst_uint(TB_Function* f, TB_DataType dt, uint64_t imm);
@@ -939,14 +1040,14 @@ TB_API TB_Node* tb_inst_cstring(TB_Function* f, const char* str);
TB_API TB_Node* tb_inst_string(TB_Function* f, size_t len, const char* str);
// write 'val' over 'count' bytes on 'dst'
-TB_API void tb_inst_memset(TB_Function* f, TB_Node* dst, TB_Node* val, TB_Node* count, TB_CharUnits align, bool is_volatile);
+TB_API void tb_inst_memset(TB_Function* f, TB_Node* dst, TB_Node* val, TB_Node* count, TB_CharUnits align);
// zero 'count' bytes on 'dst'
-TB_API void tb_inst_memzero(TB_Function* f, TB_Node* dst, TB_Node* count, TB_CharUnits align, bool is_volatile);
+TB_API void tb_inst_memzero(TB_Function* f, TB_Node* dst, TB_Node* count, TB_CharUnits align);
// performs a copy of 'count' elements from one memory location to another
// both locations cannot overlap.
-TB_API void tb_inst_memcpy(TB_Function* f, TB_Node* dst, TB_Node* src, TB_Node* count, TB_CharUnits align, bool is_volatile);
+TB_API void tb_inst_memcpy(TB_Function* f, TB_Node* dst, TB_Node* src, TB_Node* count, TB_CharUnits align);
// result = base + (index * stride)
TB_API TB_Node* tb_inst_array_access(TB_Function* f, TB_Node* base, TB_Node* index, int64_t stride);
@@ -1033,9 +1134,9 @@ TB_API TB_Node* tb_inst_cmp_fge(TB_Function* f, TB_Node* a, TB_Node* b);
// General intrinsics
TB_API TB_Node* tb_inst_va_start(TB_Function* f, TB_Node* a);
+TB_API TB_Node* tb_inst_cycle_counter(TB_Function* f);
// x86 Intrinsics
-TB_API TB_Node* tb_inst_x86_rdtsc(TB_Function* f);
TB_API TB_Node* tb_inst_x86_ldmxcsr(TB_Function* f, TB_Node* a);
TB_API TB_Node* tb_inst_x86_stmxcsr(TB_Function* f);
TB_API TB_Node* tb_inst_x86_sqrt(TB_Function* f, TB_Node* a);
@@ -1061,6 +1162,19 @@ TB_API void tb_inst_ret(TB_Function* f, size_t count, TB_Node** values);
////////////////////////////////
// Passes
////////////////////////////////
+typedef enum {
+ // allowed to remove PHIs nodes, this is
+ // helpful because the default IR building
+ // will produce tons of useless memory PHIs.
+ TB_PEEPHOLE_PHI = 1,
+
+ // it's allowed to fold memory operations (store or load elimination)
+ TB_PEEPHOLE_MEMORY = 2,
+
+ // just do every reduction rule i can provide you
+ TB_PEEPHOLE_ALL = 7,
+} TB_PeepholeFlags;
+
// Function analysis, optimizations, and codegen are all part of this
typedef struct TB_Passes TB_Passes;
@@ -1069,35 +1183,32 @@ TB_API TB_Passes* tb_pass_enter(TB_Function* f, TB_Arena* arena);
TB_API void tb_pass_exit(TB_Passes* opt);
// transformation passes:
-// peephole: runs most simple reductions on the code,
-// should be run after any bigger passes (it's incremental
-// so it's not that bad)
+// peephole: 99% of the optimizer, i'm sea of nodes pilled so i
+// break down most optimizations into local rewrites, it's
+// incremental and recommended to run after any non-peephole
+// pass.
//
-// mem2reg: lowers TB_LOCALs into SSA values, this makes more
+// mem2reg: lowers TB_LOCALs into SoN values, this makes more
// data flow analysis possible on the code and allows to codegen
// to place variables into registers.
//
-// cfg: performs simplifications on the CFG like `a && b => select(a, b, 0)`
-// or removing redundant branches.
-//
-// loop: NOT READY
-//
-TB_API bool tb_pass_peephole(TB_Passes* opt);
+// SROA: splits LOCALs into multiple to allow for more dataflow
+// analysis later on.
+TB_API void tb_pass_peephole(TB_Passes* opt, TB_PeepholeFlags flags);
+TB_API void tb_pass_sroa(TB_Passes* opt);
TB_API bool tb_pass_mem2reg(TB_Passes* opt);
-TB_API bool tb_pass_loop(TB_Passes* opt);
-TB_API bool tb_pass_cfg(TB_Passes* opt);
+
+TB_API void tb_pass_schedule(TB_Passes* opt);
// analysis
// print: prints IR in a flattened text form.
TB_API bool tb_pass_print(TB_Passes* opt);
-TB_API void tb_pass_schedule(TB_Passes* opt);
-
// codegen
TB_API TB_FunctionOutput* tb_pass_codegen(TB_Passes* opt, bool emit_asm);
TB_API void tb_pass_kill_node(TB_Passes* opt, TB_Node* n);
-TB_API bool tb_pass_mark(TB_Passes* opt, TB_Node* n);
+TB_API void tb_pass_mark(TB_Passes* opt, TB_Node* n);
TB_API void tb_pass_mark_users(TB_Passes* opt, TB_Node* n);
////////////////////////////////
diff --git a/src/tilde/tb.lib b/src/tilde/tb.lib
index 2ec6ae708..4b3cdb9b0 100644
--- a/src/tilde/tb.lib
+++ b/src/tilde/tb.lib
Binary files differ
diff --git a/src/tilde/tb_arena.h b/src/tilde/tb_arena.h
index 548427139..67ec0e181 100644
--- a/src/tilde/tb_arena.h
+++ b/src/tilde/tb_arena.h
@@ -20,9 +20,9 @@
#endif
enum {
- TB_ARENA_SMALL_CHUNK_SIZE = 4 * 1024,
- TB_ARENA_MEDIUM_CHUNK_SIZE = 512 * 1024,
- TB_ARENA_LARGE_CHUNK_SIZE = 2 * 1024 * 1024,
+ TB_ARENA_SMALL_CHUNK_SIZE = 4 * 1024,
+ TB_ARENA_MEDIUM_CHUNK_SIZE = 512 * 1024,
+ TB_ARENA_LARGE_CHUNK_SIZE = 16 * 1024 * 1024,
TB_ARENA_ALIGNMENT = 16,
};
diff --git a/src/tilde_builtin.cpp b/src/tilde_builtin.cpp
index 012e2c1b9..3b4e4f900 100644
--- a/src/tilde_builtin.cpp
+++ b/src/tilde_builtin.cpp
@@ -230,7 +230,7 @@ gb_internal cgValue cg_builtin_clamp(cgProcedure *p, Type *t, cgValue const &x,
gb_internal cgValue cg_builtin_mem_zero(cgProcedure *p, cgValue const &ptr, cgValue const &len) {
GB_ASSERT(ptr.kind == cgValue_Value);
GB_ASSERT(len.kind == cgValue_Value);
- tb_inst_memzero(p->func, ptr.node, len.node, 1, false);
+ tb_inst_memzero(p->func, ptr.node, len.node, 1);
return ptr;
}
@@ -239,7 +239,7 @@ gb_internal cgValue cg_builtin_mem_copy(cgProcedure *p, cgValue const &dst, cgVa
GB_ASSERT(src.kind == cgValue_Value);
GB_ASSERT(len.kind == cgValue_Value);
// TODO(bill): This needs to be memmove
- tb_inst_memcpy(p->func, dst.node, src.node, len.node, 1, false);
+ tb_inst_memcpy(p->func, dst.node, src.node, len.node, 1);
return dst;
}
@@ -247,7 +247,7 @@ gb_internal cgValue cg_builtin_mem_copy_non_overlapping(cgProcedure *p, cgValue
GB_ASSERT(dst.kind == cgValue_Value);
GB_ASSERT(src.kind == cgValue_Value);
GB_ASSERT(len.kind == cgValue_Value);
- tb_inst_memcpy(p->func, dst.node, src.node, len.node, 1, false);
+ tb_inst_memcpy(p->func, dst.node, src.node, len.node, 1);
return dst;
}
diff --git a/src/tilde_expr.cpp b/src/tilde_expr.cpp
index cd4e9f2d3..867b761d4 100644
--- a/src/tilde_expr.cpp
+++ b/src/tilde_expr.cpp
@@ -1193,6 +1193,9 @@ gb_internal cgValue cg_emit_conv(cgProcedure *p, cgValue value, Type *t) {
GB_ASSERT(is_type_typed(st));
data = cg_emit_conv(p, data, t_rawptr);
+ if (p->name == "main@main") {
+ GB_PANIC("HERE %s %llu", type_to_string(st), cg_typeid_as_u64(p->module, value.type));
+ }
cgValue id = cg_typeid(p, st);
cgValue data_ptr = cg_emit_struct_ep(p, result.addr, 0);
diff --git a/src/tilde_proc.cpp b/src/tilde_proc.cpp
index e12357c0e..f5f37d73e 100644
--- a/src/tilde_proc.cpp
+++ b/src/tilde_proc.cpp
@@ -373,9 +373,9 @@ gb_internal WORKER_TASK_PROC(cg_procedure_compile_worker_proc) {
// optimization passes
if (false) {
- tb_pass_peephole(opt);
+ tb_pass_peephole(opt, TB_PEEPHOLE_ALL);
tb_pass_mem2reg(opt);
- tb_pass_peephole(opt);
+ tb_pass_peephole(opt, TB_PEEPHOLE_ALL);
}
bool emit_asm = false;
@@ -572,7 +572,7 @@ gb_internal cgValue cg_emit_call(cgProcedure * p, cgValue value, Slice<cgValue>
TB_CharUnits size = cast(TB_CharUnits)type_size_of(return_type);
TB_CharUnits align = cast(TB_CharUnits)gb_max(type_align_of(return_type), 16);
TB_Node *local = tb_inst_local(p->func, size, align);
- tb_inst_memzero(p->func, local, tb_inst_uint(p->func, TB_TYPE_INT, size), align, false);
+ tb_inst_memzero(p->func, local, tb_inst_uint(p->func, TB_TYPE_INT, size), align);
params[param_index++] = local;
}
}
@@ -626,7 +626,7 @@ gb_internal cgValue cg_emit_call(cgProcedure * p, cgValue value, Slice<cgValue>
TB_CharUnits align = cast(TB_CharUnits)gb_max(type_align_of(result), 16);
TB_Node *local = tb_inst_local(p->func, size, align);
// TODO(bill): Should this need to be zeroed any way?
- tb_inst_memzero(p->func, local, tb_inst_uint(p->func, TB_TYPE_INT, size), align, false);
+ tb_inst_memzero(p->func, local, tb_inst_uint(p->func, TB_TYPE_INT, size), align);
params[param_index++] = local;
}
}
diff --git a/src/tilde_stmt.cpp b/src/tilde_stmt.cpp
index 7dca2b671..f45dda0bc 100644
--- a/src/tilde_stmt.cpp
+++ b/src/tilde_stmt.cpp
@@ -42,6 +42,8 @@ gb_internal cgValue cg_emit_load(cgProcedure *p, cgValue const &ptr, bool is_vol
return cg_lvalue_addr(tb_inst_get_symbol_address(p->func, ptr.symbol), type);
}
}
+ GB_ASSERT(dt.type != TB_MEMORY);
+ GB_ASSERT(dt.type != TB_TUPLE);
// use the natural alignment
// if people need a special alignment, they can use `intrinsics.unaligned_load`
@@ -118,7 +120,7 @@ gb_internal void cg_emit_store(cgProcedure *p, cgValue dst, cgValue src, bool is
// IMPORTANT TODO(bill): needs to be memmove
i64 sz = type_size_of(dst_type);
TB_Node *count = tb_inst_uint(p->func, TB_TYPE_INT, cast(u64)sz);
- tb_inst_memcpy(p->func, dst_ptr, src_ptr, count, alignment, is_volatile);
+ tb_inst_memcpy(p->func, dst_ptr, src_ptr, count, alignment/*, is_volatile*/);
return;
}
@@ -159,7 +161,7 @@ gb_internal cgValue cg_address_from_load(cgProcedure *p, cgValue value) {
{
TB_Node *load_inst = value.node;
GB_ASSERT_MSG(load_inst->type == TB_LOAD, "expected a load instruction");
- TB_Node *ptr = load_inst->inputs[1];
+ TB_Node *ptr = load_inst->inputs[2];
return cg_value(ptr, alloc_type_pointer(value.type));
}
case cgValue_Addr:
@@ -813,9 +815,10 @@ gb_internal cgAddr cg_add_local(cgProcedure *p, Type *type, Entity *e, bool zero
if (zero_init) {
bool is_volatile = false;
+ gb_unused(is_volatile);
TB_Node *zero = tb_inst_uint(p->func, TB_TYPE_I8, 0);
TB_Node *count = tb_inst_uint(p->func, TB_TYPE_I32, cast(u64)size);
- tb_inst_memset(p->func, local, zero, count, alignment, is_volatile);
+ tb_inst_memset(p->func, local, zero, count, alignment/*, is_volatile*/);
}
cgAddr addr = cg_addr(cg_value(local, alloc_type_pointer(type)));
@@ -861,7 +864,7 @@ gb_internal cgValue cg_copy_value_to_ptr(cgProcedure *p, cgValue value, Type *or
tb_inst_store(p->func, cg_data_type(original_type), copy, value.node, align, false);
} else {
GB_ASSERT(value.kind == cgValue_Addr);
- tb_inst_memcpy(p->func, copy, value.node, tb_inst_uint(p->func, TB_TYPE_INT, size), align, false);
+ tb_inst_memcpy(p->func, copy, value.node, tb_inst_uint(p->func, TB_TYPE_INT, size), align);
}
return cg_value(copy, alloc_type_pointer(original_type));
@@ -871,7 +874,7 @@ gb_internal cgValue cg_address_from_load_or_generate_local(cgProcedure *p, cgVal
switch (value.kind) {
case cgValue_Value:
if (value.node->type == TB_LOAD) {
- TB_Node *ptr = value.node->inputs[1];
+ TB_Node *ptr = value.node->inputs[2];
return cg_value(ptr, alloc_type_pointer(value.type));
}
break;
@@ -1042,7 +1045,7 @@ gb_internal void cg_build_assignment(cgProcedure *p, Array<cgAddr> const &lvals,
TB_CharUnits size = cast(TB_CharUnits)type_size_of(type);
TB_CharUnits align = cast(TB_CharUnits)type_align_of(type);
TB_Node *copy = tb_inst_local(p->func, size, align);
- tb_inst_memcpy(p->func, copy, init.node, tb_inst_uint(p->func, TB_TYPE_INT, size), align, false);
+ tb_inst_memcpy(p->func, copy, init.node, tb_inst_uint(p->func, TB_TYPE_INT, size), align);
// use the copy instead
init.node = copy;
}
@@ -2399,8 +2402,7 @@ gb_internal void cg_build_type_switch_stmt(cgProcedure *p, Ast *node) {
backing_ptr, // dst
data.node, // src
tb_inst_uint(p->func, TB_TYPE_INT, size),
- cast(TB_CharUnits)align,
- false
+ cast(TB_CharUnits)align
);
ptr = cg_value(backing_ptr, ct_ptr);
@@ -2522,6 +2524,8 @@ gb_internal void cg_build_mutable_value_decl(cgProcedure *p, Ast *node) {
TEMPORARY_ALLOCATOR_GUARD();
+
+
auto inits = array_make<cgValue>(temporary_allocator(), 0, vd->values.count != 0 ? vd->names.count : 0);
for (Ast *rhs : vd->values) {
cgValue init = cg_build_expr(p, rhs);
diff --git a/src/tilde_type_info.cpp b/src/tilde_type_info.cpp
index e1a26a26b..ad219071f 100644
--- a/src/tilde_type_info.cpp
+++ b/src/tilde_type_info.cpp
@@ -118,6 +118,11 @@ gb_internal u64 cg_typeid_as_u64(cgModule *m, Type *type) {
data |= (special &~ (1ull<<1)) << 62ull; // special
data |= (reserved &~ (1ull<<1)) << 63ull; // reserved
}
+
+ if (type == t_string) {
+ gb_printf_err("%llu\n", data);
+ }
+
return data;
}
@@ -449,7 +454,7 @@ gb_internal void cg_setup_type_info_data(cgModule *m) {
u32 flags = type_info_flags_of_type(t);
u64 id = cg_typeid_as_u64(m, t);
- void *size_ptr = tb_global_add_region(m->mod, global, offset+size_offset, build_context.int_size);
+ void *size_ptr = tb_global_add_region(m->mod, global, offset+size_offset, build_context.int_size);
void *align_ptr = tb_global_add_region(m->mod, global, offset+align_offset, build_context.int_size);
void *flags_ptr = tb_global_add_region(m->mod, global, offset+flags_offset, 4);
void *id_ptr = tb_global_add_region(m->mod, global, offset+id_offset, build_context.ptr_size);
diff --git a/tests/core/Makefile b/tests/core/Makefile
index 77d4b85a0..919262f85 100644
--- a/tests/core/Makefile
+++ b/tests/core/Makefile
@@ -2,7 +2,8 @@ ODIN=../../odin
PYTHON=$(shell which python3)
all: download_test_assets image_test compress_test strings_test hash_test crypto_test noise_test encoding_test \
- math_test linalg_glsl_math_test filepath_test reflect_test os_exit_test i18n_test match_test c_libc_test net_test
+ math_test linalg_glsl_math_test filepath_test reflect_test os_exit_test i18n_test match_test c_libc_test net_test \
+ fmt_test
download_test_assets:
$(PYTHON) download_assets.py
@@ -57,3 +58,6 @@ c_libc_test:
net_test:
$(ODIN) run net -out:test_core_net
+
+fmt_test:
+ $(ODIN) run fmt -out:test_core_fmt
diff --git a/tests/core/fmt/test_core_fmt.odin b/tests/core/fmt/test_core_fmt.odin
new file mode 100644
index 000000000..4459af609
--- /dev/null
+++ b/tests/core/fmt/test_core_fmt.odin
@@ -0,0 +1,59 @@
+package test_core_fmt
+
+import "core:fmt"
+import "core:os"
+import "core:testing"
+import "core:mem"
+
+TEST_count := 0
+TEST_fail := 0
+
+when ODIN_TEST {
+ expect :: testing.expect
+ log :: testing.log
+} else {
+ expect :: proc(t: ^testing.T, condition: bool, message: string, loc := #caller_location) {
+ TEST_count += 1
+ if !condition {
+ TEST_fail += 1
+ fmt.printf("[%v] %v\n", loc, message)
+ return
+ }
+ }
+ log :: proc(t: ^testing.T, v: any, loc := #caller_location) {
+ fmt.printf("[%v] ", loc)
+ fmt.printf("log: %v\n", v)
+ }
+}
+
+main :: proc() {
+ t := testing.T{}
+ test_fmt_memory(&t)
+
+ fmt.printf("%v/%v tests successful.\n", TEST_count - TEST_fail, TEST_count)
+ if TEST_fail > 0 {
+ os.exit(1)
+ }
+}
+
+test_fmt_memory :: proc(t: ^testing.T) {
+ check :: proc(t: ^testing.T, exp: string, format: string, args: ..any, loc := #caller_location) {
+ got := fmt.tprintf(format, ..args)
+ expect(t, got == exp, fmt.tprintf("(%q, %v): %q != %q", format, args, got, exp), loc)
+ }
+
+ check(t, "5b", "%m", 5)
+ check(t, "5B", "%M", 5)
+ check(t, "-5B", "%M", -5)
+ check(t, "3.00kib", "%m", mem.Kilobyte * 3)
+ check(t, "3kib", "%.0m", mem.Kilobyte * 3)
+ check(t, "3KiB", "%.0M", mem.Kilobyte * 3)
+ check(t, "3.000 mib", "%#.3m", mem.Megabyte * 3)
+ check(t, "3.50 gib", "%#m", u32(mem.Gigabyte * 3.5))
+ check(t, "01tib", "%5.0m", mem.Terabyte)
+ check(t, "-1tib", "%5.0m", -mem.Terabyte)
+ check(t, "2.50 pib", "%#5.m", uint(mem.Petabyte * 2.5))
+ check(t, "1.00 EiB", "%#M", mem.Exabyte)
+ check(t, "255 B", "%#M", u8(255))
+ check(t, "0b", "%m", u8(0))
+}
diff --git a/vendor/darwin/Foundation/NSBlock.odin b/vendor/darwin/Foundation/NSBlock.odin
index 9cc58da71..ecb31bcfb 100644
--- a/vendor/darwin/Foundation/NSBlock.odin
+++ b/vendor/darwin/Foundation/NSBlock.odin
@@ -1,27 +1,37 @@
package objc_Foundation
import "core:intrinsics"
+import "core:builtin"
+import "core:mem"
-@(objc_class="NSConcreteGlobalBlock")
+@(objc_class="NSBlock")
Block :: struct {using _: Object}
@(objc_type=Block, objc_name="createGlobal", objc_is_class_method=true)
-Block_createGlobal :: proc "c" (user_data: rawptr, user_proc: proc "c" (user_data: rawptr)) -> ^Block {
- return Block_createInternal(true, user_data, user_proc)
+Block_createGlobal :: proc (user_data: rawptr, user_proc: proc "c" (user_data: rawptr), allocator := context.allocator) -> (^Block, mem.Allocator_Error) #optional_allocator_error {
+ return Block_createInternal(true, user_data, user_proc, allocator)
}
-
@(objc_type=Block, objc_name="createLocal", objc_is_class_method=true)
-Block_createLocal :: proc "c" (user_data: rawptr, user_proc: proc "c" (user_data: rawptr)) -> ^Block {
- return Block_createInternal(false, user_data, user_proc)
+Block_createLocal :: proc (user_data: rawptr, user_proc: proc "c" (user_data: rawptr)) -> ^Block {
+ b, _ := Block_createInternal(false, user_data, user_proc, {})
+ return b
+}
+@(objc_type=Block, objc_name="createGlobalWithParam", objc_is_class_method=true)
+Block_createGlobalWithParam :: proc (user_data: rawptr, user_proc: proc "c" (user_data: rawptr, t: $T), allocator := context.allocator) -> (^Block, mem.Allocator_Error) #optional_allocator_error {
+ return Block_createInternalWithParam(true, user_data, user_proc, allocator)
+}
+@(objc_type=Block, objc_name="createLocalWithParam", objc_is_class_method=true)
+Block_createLocalWithParam :: proc (user_data: rawptr, user_proc: proc "c" (user_data: rawptr, t: $T)) -> ^Block {
+ b, _ := Block_createInternalWithParam(false, user_data, user_proc, {})
+ return b
}
-
@(private)
Internal_Block_Literal_Base :: struct {
isa: ^intrinsics.objc_class,
flags: u32,
reserved: u32,
- invoke: proc "c" (^Internal_Block_Literal),
+ invoke: rawptr, // contains a pointer to a proc "c" (^Internal_Block_Literal, ...)
descriptor: ^Block_Descriptor,
}
@@ -29,7 +39,7 @@ Internal_Block_Literal_Base :: struct {
Internal_Block_Literal :: struct {
using base: Internal_Block_Literal_Base,
// Imported Variables
- user_proc: proc "c" (user_data: rawptr),
+ user_proc: rawptr, // contains a pointer to a proc "c" (user_data: rawptr, ...)
user_data: rawptr,
}
@@ -50,36 +60,61 @@ global_block_descriptor := Block_Descriptor{
foreign import libSystem "system:System.framework"
foreign libSystem {
- _NSConcreteGlobalBlock: ^intrinsics.objc_class
+ _NSConcreteGlobalBlock: intrinsics.objc_class
+ _NSConcreteStackBlock: intrinsics.objc_class
}
@(private="file")
-Block_createInternal :: proc "c" (is_global: bool, user_data: rawptr, user_proc: proc "c" (user_data: rawptr)) -> ^Block {
- // Set to true on blocks that have captures (and thus are not true
- // global blocks) but are known not to escape for various other
- // reasons. For backward compatibility with old runtimes, whenever
- // BLOCK_IS_NOESCAPE is set, BLOCK_IS_GLOBAL is set too. Copying a
- // non-escaping block returns the original block and releasing such a
- // block is a no-op, which is exactly how global blocks are handled.
- BLOCK_IS_NOESCAPE :: (1 << 23)|BLOCK_IS_GLOBAL
+internal_block_literal_make :: proc (is_global: bool, user_data: rawptr, user_proc: rawptr, invoke: rawptr, allocator: mem.Allocator) -> (b: ^Block, err: mem.Allocator_Error) {
+ _init :: proc(bl: ^Internal_Block_Literal, is_global: bool, user_data: rawptr, user_proc: rawptr, invoke: rawptr) {
+ // Set to true on blocks that have captures (and thus are not true
+ // global blocks) but are known not to escape for various other
+ // reasons. For backward compatibility with old runtimes, whenever
+ // BLOCK_IS_NOESCAPE is set, BLOCK_IS_GLOBAL is set too. Copying a
+ // non-escaping block returns the original block and releasing such a
+ // block is a no-op, which is exactly how global blocks are handled.
+ BLOCK_IS_NOESCAPE :: (1 << 23)|BLOCK_IS_GLOBAL
- BLOCK_HAS_COPY_DISPOSE :: 1 << 25
- BLOCK_HAS_CTOR :: 1 << 26 // helpers have C++ code
- BLOCK_IS_GLOBAL :: 1 << 28
- BLOCK_HAS_STRET :: 1 << 29 // IFF BLOCK_HAS_SIGNATURE
- BLOCK_HAS_SIGNATURE :: 1 << 30
+ BLOCK_HAS_COPY_DISPOSE :: 1 << 25
+ BLOCK_HAS_CTOR :: 1 << 26 // helpers have C++ code
+ BLOCK_IS_GLOBAL :: 1 << 28
+ BLOCK_HAS_STRET :: 1 << 29 // IFF BLOCK_HAS_SIGNATURE
+ BLOCK_HAS_SIGNATURE :: 1 << 30
- extraBytes :: size_of(Internal_Block_Literal) - size_of(Internal_Block_Literal_Base)
+ bl.isa = is_global ? &_NSConcreteGlobalBlock : &_NSConcreteStackBlock
+ bl.flags = BLOCK_IS_GLOBAL if is_global else 0
+ bl.invoke = invoke
+ bl.descriptor = &global_block_descriptor
+ bl.user_proc = auto_cast user_proc
+ bl.user_data = user_data
+ }
+ if is_global {
+ bl := builtin.new (Internal_Block_Literal, allocator) or_return
+ _init(bl, true, user_data, user_proc, invoke)
+ return auto_cast bl, .None
+ } else {
+ // malloc blocks are created by calling 'copy' on a stack block
+ bl: Internal_Block_Literal
+ _init(&bl, false, user_data, user_proc, invoke)
+ return auto_cast copy(cast(^Copying(Block))(&bl)), .None
+ }
+}
- bl := (^Internal_Block_Literal)(AllocateObject(_NSConcreteGlobalBlock, extraBytes, nil))
- bl.isa = _NSConcreteGlobalBlock
- bl.flags = BLOCK_IS_GLOBAL if is_global else 0
- bl.invoke = proc "c" (bl: ^Internal_Block_Literal) {
- bl.user_proc(bl.user_data)
+@(private="file")
+Block_createInternal :: proc (is_global: bool, user_data: rawptr, user_proc: proc "c" (user_data: rawptr), allocator: mem.Allocator) -> (b: ^Block, err: mem.Allocator_Error) {
+ invoke :: proc "c" (bl: ^Internal_Block_Literal) {
+ user_proc := (proc "c" (rawptr))(bl.user_proc)
+ user_proc(bl.user_data)
}
- bl.descriptor = &global_block_descriptor
- bl.user_proc = user_proc
- bl.user_data = user_data
+ return internal_block_literal_make(is_global, user_data, auto_cast user_proc, auto_cast invoke, allocator)
+}
- return auto_cast bl
+@(private="file")
+Block_createInternalWithParam :: proc (is_global: bool, user_data: rawptr, user_proc: proc "c" (user_data: rawptr, t: $T), allocator: mem.Allocator) -> (b: ^Block, err: mem.Allocator_Error) {
+ invoke :: proc "c" (bl: ^Internal_Block_Literal, t: T) {
+ user_proc := (proc "c" (rawptr, T))(bl.user_proc)
+ user_proc(bl.user_data, t)
+ }
+ return internal_block_literal_make(is_global, user_data, auto_cast user_proc, auto_cast invoke, allocator)
}
+
diff --git a/vendor/directx/d3d11/d3d11.odin b/vendor/directx/d3d11/d3d11.odin
index ea1e7f5f8..d94c05d06 100644
--- a/vendor/directx/d3d11/d3d11.odin
+++ b/vendor/directx/d3d11/d3d11.odin
@@ -15,6 +15,7 @@ GUID :: dxgi.GUID
IID :: dxgi.IID
SIZE_T :: dxgi.SIZE_T
BOOL :: dxgi.BOOL
+UINT :: dxgi.UINT
RECT :: dxgi.RECT
SIZE :: dxgi.SIZE
@@ -5146,3 +5147,7 @@ MESSAGE_ID :: enum u32 {
TRACKED_WORKLOAD_DISJOINT_FAILURE,
D3D11_5_MESSAGES_END,
}
+
+CalcSubresource :: #force_inline proc "contextless" (MipSlice: UINT, ArraySlice: UINT, MipLevels: UINT) -> UINT {
+ return MipSlice + ArraySlice * MipLevels
+}
diff --git a/vendor/directx/dxc/dxcapi.odin b/vendor/directx/dxc/dxcapi.odin
index aa0bb8443..79d305ea0 100644
--- a/vendor/directx/dxc/dxcapi.odin
+++ b/vendor/directx/dxc/dxcapi.odin
@@ -1,19 +1,10 @@
package directx_dxc
-import win32 "core:sys/windows"
-import dxgi "vendor:directx/dxgi"
-foreign import "dxcompiler.lib"
-
-BOOL :: dxgi.BOOL
-SIZE_T :: dxgi.SIZE_T
-ULONG :: dxgi.ULONG
-CLSID :: dxgi.GUID
-IID :: dxgi.IID
-HRESULT :: dxgi.HRESULT
-IUnknown :: dxgi.IUnknown
-IUnknown_VTable :: dxgi.IUnknown_VTable
-wstring :: win32.wstring
-FILETIME :: win32.FILETIME
-BSTR :: wstring
+
+when ODIN_OS == .Windows {
+ foreign import dxcompiler "dxcompiler.lib"
+} else {
+ foreign import dxcompiler "system:dxcompiler"
+}
@(default_calling_convention="c", link_prefix="Dxc")
foreign dxcompiler {
@@ -33,12 +24,12 @@ IMalloc :: struct #raw_union {
}
IMalloc_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- Alloc: proc "stdcall" (this: ^IMalloc, cb: SIZE_T) -> rawptr,
- Realloc: proc "stdcall" (this: ^IMalloc, pv: rawptr, cb: SIZE_T) -> rawptr,
- Free: proc "stdcall" (this: ^IMalloc, pv: rawptr),
- GetSize: proc "stdcall" (this: ^IMalloc, pv: rawptr) -> SIZE_T,
- DidAlloc: proc "stdcall" (this: ^IMalloc, pv: rawptr) -> i32,
- HeapMinimize: proc "stdcall" (this: ^IMalloc),
+ Alloc: proc "system" (this: ^IMalloc, cb: SIZE_T) -> rawptr,
+ Realloc: proc "system" (this: ^IMalloc, pv: rawptr, cb: SIZE_T) -> rawptr,
+ Free: proc "system" (this: ^IMalloc, pv: rawptr),
+ GetSize: proc "system" (this: ^IMalloc, pv: rawptr) -> SIZE_T,
+ DidAlloc: proc "system" (this: ^IMalloc, pv: rawptr) -> i32,
+ HeapMinimize: proc "system" (this: ^IMalloc),
}
ISequentialStream :: struct #raw_union {
@@ -47,8 +38,8 @@ ISequentialStream :: struct #raw_union {
}
ISequentialStream_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- Read: proc "stdcall" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbRead: ^ULONG) -> HRESULT,
- Write: proc "stdcall" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbWritten: ^ULONG) -> HRESULT,
+ Read: proc "system" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbRead: ^ULONG) -> HRESULT,
+ Write: proc "system" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbWritten: ^ULONG) -> HRESULT,
}
STATSTG :: struct {
@@ -71,15 +62,15 @@ IStream :: struct #raw_union {
}
IStream_VTable :: struct {
using isequentialstream_vtable: ISequentialStream_VTable,
- Seek: proc "stdcall" (this: ^IStream, dlibMove: i64, dwOrigin: u32, plibNewPosition: ^u64) -> HRESULT,
- SetSize: proc "stdcall" (this: ^IStream, libNewSize: u64) -> HRESULT,
- CopyTo: proc "stdcall" (this: ^IStream, pstm: ^IStream, cb: u64, pcbRead: ^u64, pcbWritten: ^u64) -> HRESULT,
- Commit: proc "stdcall" (this: ^IStream, grfCommitFlags: u32) -> HRESULT,
- Revert: proc "stdcall" (this: ^IStream) -> HRESULT,
- LockRegion: proc "stdcall" (this: ^IStream, libOffset: u64, cb: u64, dwLockType: u32) -> HRESULT,
- UnlockRegion: proc "stdcall" (this: ^IStream, libOffset: u64, cb: u64, dwLockType: u32) -> HRESULT,
- Stat: proc "stdcall" (this: ^IStream, pstatstg: ^STATSTG, grfStatFlag: u32) -> HRESULT,
- Clone: proc "stdcall" (this: ^IStream, ppstm: ^^IStream) -> HRESULT,
+ Seek: proc "system" (this: ^IStream, dlibMove: i64, dwOrigin: u32, plibNewPosition: ^u64) -> HRESULT,
+ SetSize: proc "system" (this: ^IStream, libNewSize: u64) -> HRESULT,
+ CopyTo: proc "system" (this: ^IStream, pstm: ^IStream, cb: u64, pcbRead: ^u64, pcbWritten: ^u64) -> HRESULT,
+ Commit: proc "system" (this: ^IStream, grfCommitFlags: u32) -> HRESULT,
+ Revert: proc "system" (this: ^IStream) -> HRESULT,
+ LockRegion: proc "system" (this: ^IStream, libOffset: u64, cb: u64, dwLockType: u32) -> HRESULT,
+ UnlockRegion: proc "system" (this: ^IStream, libOffset: u64, cb: u64, dwLockType: u32) -> HRESULT,
+ Stat: proc "system" (this: ^IStream, pstatstg: ^STATSTG, grfStatFlag: u32) -> HRESULT,
+ Clone: proc "system" (this: ^IStream, ppstm: ^^IStream) -> HRESULT,
}
IBlob_UUID_STRING :: "8BA5FB08-5195-40E2-AC58-0D989C3A0102"
@@ -90,8 +81,8 @@ IBlob :: struct #raw_union {
}
IBlob_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- GetBufferPointer: proc "stdcall" (this: ^IBlob) -> rawptr,
- GetBufferSize: proc "stdcall" (this: ^IBlob) -> SIZE_T,
+ GetBufferPointer: proc "system" (this: ^IBlob) -> rawptr,
+ GetBufferSize: proc "system" (this: ^IBlob) -> SIZE_T,
}
IBlobEncoding_UUID_STRRING :: "7241D424-2646-4191-97C0-98E96E42FC68"
@@ -102,7 +93,7 @@ IBlobEncoding :: struct #raw_union {
}
IBlobEncoding_VTable :: struct {
using idxcblob_vtable: IBlob_VTable,
- GetEncoding: proc "stdcall" (this: ^IBlobEncoding, pKnown: ^BOOL, pCodePage: ^u32) -> HRESULT,
+ GetEncoding: proc "system" (this: ^IBlobEncoding, pKnown: ^BOOL, pCodePage: ^u32) -> HRESULT,
}
IBlobUtf16_UUID_STRING :: "A3F84EAB-0FAA-497E-A39C-EE6ED60B2D84"
@@ -113,8 +104,8 @@ IBlobUtf16 :: struct #raw_union {
}
IBlobUtf16_VTable :: struct {
using idxcblobencoding_vtable: IBlobEncoding_VTable,
- GetStringPointer: proc "stdcall" (this: ^IBlobUtf16) -> wstring,
- GetStringLength: proc "stdcall" (this: ^IBlobUtf16) -> SIZE_T,
+ GetStringPointer: proc "system" (this: ^IBlobUtf16) -> wstring,
+ GetStringLength: proc "system" (this: ^IBlobUtf16) -> SIZE_T,
}
IBlobUtf8_UUID_STRING :: "3DA636C9-BA71-4024-A301-30CBF125305B"
@@ -125,8 +116,8 @@ IBlobUtf8 :: struct #raw_union {
}
IBlobUtf8_VTable :: struct {
using idxcblobencoding_vtable: IBlobEncoding_VTable,
- GetStringPointer: proc "stdcall" (this: ^IBlobUtf8) -> cstring,
- GetStringLength: proc "stdcall" (this: ^IBlobUtf8) -> SIZE_T,
+ GetStringPointer: proc "system" (this: ^IBlobUtf8) -> cstring,
+ GetStringLength: proc "system" (this: ^IBlobUtf8) -> SIZE_T,
}
IIncludeHandler_UUID_STRING :: "7F61FC7D-950D-467F-B3E3-3C02FB49187C"
@@ -137,7 +128,7 @@ IIncludeHandler :: struct #raw_union {
}
IIncludeHandler_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- LoadSource: proc "stdcall" (this: ^IIncludeHandler, pFilename: wstring, ppIncludeSource: ^^IBlob) -> HRESULT,
+ LoadSource: proc "system" (this: ^IIncludeHandler, pFilename: wstring, ppIncludeSource: ^^IBlob) -> HRESULT,
}
Define :: struct {
@@ -153,11 +144,11 @@ ICompilerArgs :: struct #raw_union {
}
ICompilerArgs_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- GetArguments: proc "stdcall" (this: ^ICompilerArgs) -> [^]wstring,
- GetCount: proc "stdcall" (this: ^ICompilerArgs) -> u32,
- AddArguments: proc "stdcall" (this: ^ICompilerArgs, pArguments: [^]wstring, argCount: u32) -> HRESULT,
- AddArgumentsUTF8: proc "stdcall" (this: ^ICompilerArgs, pArguments: [^]cstring, argCount: u32) -> HRESULT,
- AddDefines: proc "stdcall" (this: ^ICompilerArgs, pDefines: [^]Define, defineCount: u32) -> HRESULT,
+ GetArguments: proc "system" (this: ^ICompilerArgs) -> [^]wstring,
+ GetCount: proc "system" (this: ^ICompilerArgs) -> u32,
+ AddArguments: proc "system" (this: ^ICompilerArgs, pArguments: [^]wstring, argCount: u32) -> HRESULT,
+ AddArgumentsUTF8: proc "system" (this: ^ICompilerArgs, pArguments: [^]cstring, argCount: u32) -> HRESULT,
+ AddDefines: proc "system" (this: ^ICompilerArgs, pDefines: [^]Define, defineCount: u32) -> HRESULT,
}
ILibrary_UUID_STRING :: "E5204DC7-D18C-4C3C-BDFB-851673980FE7"
@@ -168,16 +159,16 @@ ILibrary :: struct #raw_union {
}
ILibrary_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- SetMalloc: proc "stdcall" (this: ^ILibrary, pMalloc: ^IMalloc) -> HRESULT,
- CreateBlobFromBlob: proc "stdcall" (this: ^ILibrary, pBlob: ^IBlob, offset: u32, length: u32, ppResult: ^^IBlob) -> HRESULT,
- CreateBlobFromFile: proc "stdcall" (this: ^ILibrary, pFileName: wstring, codePage: ^u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
- CreateBlobWithEncodingFromPinned: proc "stdcall" (this: ^ILibrary, pText: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
- CreateBlobWithEncodingOnHeapCopy: proc "stdcall" (this: ^ILibrary, pText: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
- CreateBlobWithEncodingOnMalloc: proc "stdcall" (this: ^ILibrary, pText: rawptr, pIMalloc: ^IMalloc, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
- CreateIncludeHandler: proc "stdcall" (this: ^ILibrary, ppResult: ^^IIncludeHandler) -> HRESULT,
- CreateStreamFromBlobReadOnly: proc "stdcall" (this: ^ILibrary, pBlob: ^IBlob, ppStream: ^^IStream) -> HRESULT,
- GetBlobAsUtf8: proc "stdcall" (this: ^ILibrary, pBlob: ^IBlob, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
- GetBlobAsUtf16: proc "stdcall" (this: ^ILibrary, pBlob: ^IBlob, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
+ SetMalloc: proc "system" (this: ^ILibrary, pMalloc: ^IMalloc) -> HRESULT,
+ CreateBlobFromBlob: proc "system" (this: ^ILibrary, pBlob: ^IBlob, offset: u32, length: u32, ppResult: ^^IBlob) -> HRESULT,
+ CreateBlobFromFile: proc "system" (this: ^ILibrary, pFileName: wstring, codePage: ^u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
+ CreateBlobWithEncodingFromPinned: proc "system" (this: ^ILibrary, pText: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
+ CreateBlobWithEncodingOnHeapCopy: proc "system" (this: ^ILibrary, pText: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
+ CreateBlobWithEncodingOnMalloc: proc "system" (this: ^ILibrary, pText: rawptr, pIMalloc: ^IMalloc, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
+ CreateIncludeHandler: proc "system" (this: ^ILibrary, ppResult: ^^IIncludeHandler) -> HRESULT,
+ CreateStreamFromBlobReadOnly: proc "system" (this: ^ILibrary, pBlob: ^IBlob, ppStream: ^^IStream) -> HRESULT,
+ GetBlobAsUtf8: proc "system" (this: ^ILibrary, pBlob: ^IBlob, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
+ GetBlobAsUtf16: proc "system" (this: ^ILibrary, pBlob: ^IBlob, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
}
IOperationResult_UUID_STRING :: "CEDB484A-D4E9-445A-B991-CA21CA157DC2"
@@ -188,9 +179,9 @@ IOperationResult :: struct #raw_union {
}
IOperationResult_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- GetStatus: proc "stdcall" (this: ^IOperationResult, pStatus: ^HRESULT) -> HRESULT,
- GetResult: proc "stdcall" (this: ^IOperationResult, ppResult: ^^IBlob) -> HRESULT,
- GetErrorBuffer: proc "stdcall" (this: ^IOperationResult, ppErrors: ^^IBlobEncoding) -> HRESULT,
+ GetStatus: proc "system" (this: ^IOperationResult, pStatus: ^HRESULT) -> HRESULT,
+ GetResult: proc "system" (this: ^IOperationResult, ppResult: ^^IBlob) -> HRESULT,
+ GetErrorBuffer: proc "system" (this: ^IOperationResult, ppErrors: ^^IBlobEncoding) -> HRESULT,
}
ICompiler_UUID_STRING :: "8C210BF3-011F-4422-8D70-6F9ACB8DB617"
@@ -201,7 +192,7 @@ ICompiler :: struct #raw_union {
}
ICompiler_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- Compile: proc "stdcall" (
+ Compile: proc "system" (
this: ^ICompiler,
pSource: ^Buffer,
pSourceName: wstring,
@@ -213,7 +204,7 @@ ICompiler_VTable :: struct {
defineCount: u32,
pIncludeHandler: ^IIncludeHandler,
ppResult: ^^IOperationResult) -> HRESULT,
- Preprocess: proc "stdcall" (
+ Preprocess: proc "system" (
this: ^ICompiler,
pSource: ^Buffer,
pSourceName: wstring,
@@ -223,7 +214,7 @@ ICompiler_VTable :: struct {
defineCount: u32,
pIncludeHandler: ^IIncludeHandler,
ppResult: ^^IOperationResult) -> HRESULT,
- Disassemble: proc "stdcall" (this: ^ICompiler, pSource: ^Buffer, ppDisassembly: ^IBlobEncoding) -> HRESULT,
+ Disassemble: proc "system" (this: ^ICompiler, pSource: ^Buffer, ppDisassembly: ^IBlobEncoding) -> HRESULT,
}
ICompiler2_UUID_STRING :: "A005A9D9-B8BB-4594-B5C9-0E633BEC4D37"
@@ -234,7 +225,7 @@ ICompiler2 :: struct #raw_union {
}
ICompiler2_VTable :: struct {
using idxccompiler_vtable: ^ICompiler_VTable,
- CompileWithDebug: proc "stdcall" (
+ CompileWithDebug: proc "system" (
this: ^ICompiler2,
pSource: ^Buffer,
pSourceName: wstring,
@@ -258,8 +249,8 @@ ILinker :: struct #raw_union {
}
ILinker_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- RegisterLibrary: proc "stdcall" (this: ^ILinker, pLibName: ^IBlob) -> HRESULT,
- Link: proc "stdcall" (
+ RegisterLibrary: proc "system" (this: ^ILinker, pLibName: ^IBlob) -> HRESULT,
+ Link: proc "system" (
this: ^ILinker,
pEntryName: wstring,
pTargetProfile: wstring,
@@ -284,19 +275,19 @@ IUtils :: struct #raw_union {
}
IUtils_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- CreateBlobFromBlob: proc "stdcall" (this: ^IUtils, pBlob: ^IBlob, offset: u32, length: u32, ppResult: ^^IBlob) -> HRESULT,
- CreateBlobFromPinned: proc "stdcall" (this: ^IUtils, pData: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
- MoveToBlob: proc "stdcall" (this: ^IUtils, pData: rawptr, pIMalloc: ^IMalloc, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
- CreateBlob: proc "stdcall" (this: ^IUtils, pData: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
- LoadFile: proc "stdcall" (this: ^IUtils, pFileName: wstring, pCodePage: ^u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
- CreateReadOnlyStreamFromBlob: proc "stdcall" (this: ^IUtils, pBlob: ^IBlob, ppStream: ^^IStream) -> HRESULT,
- CreateDefaultIncludeHandler: proc "stdcall" (this: ^IUtils, ppResult: ^^IIncludeHandler) -> HRESULT,
- GetBlobAsUtf8: proc "stdcall" (this: ^IUtils, pBlob: ^IBlob, pBlobEncoding: ^^IBlobUtf8) -> HRESULT,
- GetBlobAsUtf16: proc "stdcall" (this: ^IUtils, pBlob: ^IBlob, pBlobEncoding: ^^IBlobUtf16) -> HRESULT,
- GetDxilContainerPart: proc "stdcall" (this: ^IUtils, pShader: ^Buffer, Part: u32, ppPartData: rawptr, pPartSizeInBytes: ^u32) -> HRESULT,
- CreateReflection: proc "stdcall" (this: ^IUtils, pData: ^Buffer, iid: ^IID, ppvReflection: rawptr) -> HRESULT,
- BuildArguments: proc "stdcall" (this: ^IUtils, pSourceName: wstring, pEntryPoint: wstring, pTargetProfile: wstring, pArguments: [^]wstring, argCount: u32, pDefines: [^]Define, defineCount: u32, ppArgs: ^[^]ICompilerArgs) -> HRESULT,
- GetPDBContents: proc "stdcall" (this: ^IUtils, pPDBBlob: ^IBlob, ppHash: ^^IBlob, ppContainer: ^^IBlob) -> HRESULT,
+ CreateBlobFromBlob: proc "system" (this: ^IUtils, pBlob: ^IBlob, offset: u32, length: u32, ppResult: ^^IBlob) -> HRESULT,
+ CreateBlobFromPinned: proc "system" (this: ^IUtils, pData: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
+ MoveToBlob: proc "system" (this: ^IUtils, pData: rawptr, pIMalloc: ^IMalloc, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
+ CreateBlob: proc "system" (this: ^IUtils, pData: rawptr, size: u32, codePage: u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
+ LoadFile: proc "system" (this: ^IUtils, pFileName: wstring, pCodePage: ^u32, pBlobEncoding: ^^IBlobEncoding) -> HRESULT,
+ CreateReadOnlyStreamFromBlob: proc "system" (this: ^IUtils, pBlob: ^IBlob, ppStream: ^^IStream) -> HRESULT,
+ CreateDefaultIncludeHandler: proc "system" (this: ^IUtils, ppResult: ^^IIncludeHandler) -> HRESULT,
+ GetBlobAsUtf8: proc "system" (this: ^IUtils, pBlob: ^IBlob, pBlobEncoding: ^^IBlobUtf8) -> HRESULT,
+ GetBlobAsUtf16: proc "system" (this: ^IUtils, pBlob: ^IBlob, pBlobEncoding: ^^IBlobUtf16) -> HRESULT,
+ GetDxilContainerPart: proc "system" (this: ^IUtils, pShader: ^Buffer, Part: u32, ppPartData: rawptr, pPartSizeInBytes: ^u32) -> HRESULT,
+ CreateReflection: proc "system" (this: ^IUtils, pData: ^Buffer, iid: ^IID, ppvReflection: rawptr) -> HRESULT,
+ BuildArguments: proc "system" (this: ^IUtils, pSourceName: wstring, pEntryPoint: wstring, pTargetProfile: wstring, pArguments: [^]wstring, argCount: u32, pDefines: [^]Define, defineCount: u32, ppArgs: ^[^]ICompilerArgs) -> HRESULT,
+ GetPDBContents: proc "system" (this: ^IUtils, pPDBBlob: ^IBlob, ppHash: ^^IBlob, ppContainer: ^^IBlob) -> HRESULT,
}
DXC_OUT_KIND :: enum u32 {
@@ -322,11 +313,11 @@ IResult :: struct #raw_union {
}
IResult_VTable :: struct {
using idxcoperationresult_vtable: IOperationResult_VTable,
- HasOutput: proc "stdcall" (this: ^IResult, dxcOutKind: DXC_OUT_KIND) -> BOOL,
- GetOutput: proc "stdcall" (this: ^IResult, dxcOutKind: DXC_OUT_KIND, iid: ^IID, ppvObject: rawptr, ppOutputName: ^^IBlobUtf16) -> HRESULT,
- GetNumOutputs: proc "stdcall" (this: ^IResult) -> u32,
- GetOutputByIndex: proc "stdcall" (this: ^IResult, Index: u32) -> DXC_OUT_KIND,
- PrimaryOutput: proc "stdcall" (this: ^IResult) -> DXC_OUT_KIND,
+ HasOutput: proc "system" (this: ^IResult, dxcOutKind: DXC_OUT_KIND) -> BOOL,
+ GetOutput: proc "system" (this: ^IResult, dxcOutKind: DXC_OUT_KIND, iid: ^IID, ppvObject: rawptr, ppOutputName: ^^IBlobUtf16) -> HRESULT,
+ GetNumOutputs: proc "system" (this: ^IResult) -> u32,
+ GetOutputByIndex: proc "system" (this: ^IResult, Index: u32) -> DXC_OUT_KIND,
+ PrimaryOutput: proc "system" (this: ^IResult) -> DXC_OUT_KIND,
}
IExtraOutputs_UUID_STRING :: "319B37A2-A5C2-494A-A5DE-4801B2FAF989"
@@ -337,8 +328,8 @@ IExtraOutputs :: struct #raw_union {
}
IExtraOutputs_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- GetOutputCount: proc "stdcall" (this: ^IExtraOutputs) -> u32,
- GetOutput: proc "stdcall" (this: ^IExtraOutputs, uIndex: u32, iid: ^IID, ppvObject: rawptr, ppOutputType: ^^IBlobUtf16, ppOutputName: ^^IBlobUtf16) -> HRESULT,
+ GetOutputCount: proc "system" (this: ^IExtraOutputs) -> u32,
+ GetOutput: proc "system" (this: ^IExtraOutputs, uIndex: u32, iid: ^IID, ppvObject: rawptr, ppOutputType: ^^IBlobUtf16, ppOutputName: ^^IBlobUtf16) -> HRESULT,
}
ICompiler3_UUID_STRING :: "228B4687-5A6A-4730-900C-9702B2203F54"
@@ -349,8 +340,8 @@ ICompiler3 :: struct #raw_union {
}
ICompiler3_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- Compile: proc "stdcall" (this: ^ICompiler3, pSource: ^Buffer, pArguments: [^]wstring, argCount: u32, pIncludeHandler: ^IIncludeHandler, riid: ^IID, ppResult: rawptr) -> HRESULT,
- Disassemble: proc "stdcall" (this: ^ICompiler3, pObject: ^Buffer, riid: ^IID, ppResult: rawptr) -> HRESULT,
+ Compile: proc "system" (this: ^ICompiler3, pSource: ^Buffer, pArguments: [^]wstring, argCount: u32, pIncludeHandler: ^IIncludeHandler, riid: ^IID, ppResult: rawptr) -> HRESULT,
+ Disassemble: proc "system" (this: ^ICompiler3, pObject: ^Buffer, riid: ^IID, ppResult: rawptr) -> HRESULT,
}
IValidator_UUID_STRING :: "A6E82BD2-1FD7-4826-9811-2857E797F49A"
@@ -361,7 +352,7 @@ IValidator :: struct #raw_union {
}
IValidator_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- Validate: proc "stdcall" (this: ^IValidator, pShader: ^IBlob, Flags: u32, ppResult: ^^IOperationResult) -> HRESULT,
+ Validate: proc "system" (this: ^IValidator, pShader: ^IBlob, Flags: u32, ppResult: ^^IOperationResult) -> HRESULT,
}
IValidator2_UUID_STRING :: "458E1FD1-B1B2-4750-A6E1-9C10F03BED92"
@@ -372,7 +363,7 @@ IValidator2 :: struct #raw_union {
}
IValidator2_VTable :: struct {
using idxcvalidator_vtable: IValidator_VTable,
- ValidateWithDebug: proc "stdcall" (this: ^IValidator2, pShader: ^IBlob, Flags: u32, pOptDebugBitcode: ^Buffer, ppResult: ^^IOperationResult) -> HRESULT,
+ ValidateWithDebug: proc "system" (this: ^IValidator2, pShader: ^IBlob, Flags: u32, pOptDebugBitcode: ^Buffer, ppResult: ^^IOperationResult) -> HRESULT,
}
IContainerBuilder_UUID_STRING :: "334B1F50-2292-4B35-99A1-25588D8C17FE"
@@ -383,10 +374,10 @@ IContainerBuilder :: struct #raw_union {
}
IContainerBuilder_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- Load: proc "stdcall" (this: ^IContainerBuilder, pDxilContainerHeader: ^IBlob) -> HRESULT,
- AddPart: proc "stdcall" (this: ^IContainerBuilder, fourCC: u32, pSource: ^IBlob) -> HRESULT,
- RemovePart: proc "stdcall" (this: ^IContainerBuilder, fourCC: u32) -> HRESULT,
- SerializeContainer: proc "stdcall" (this: ^IContainerBuilder, ppResult: ^^IOperationResult) -> HRESULT,
+ Load: proc "system" (this: ^IContainerBuilder, pDxilContainerHeader: ^IBlob) -> HRESULT,
+ AddPart: proc "system" (this: ^IContainerBuilder, fourCC: u32, pSource: ^IBlob) -> HRESULT,
+ RemovePart: proc "system" (this: ^IContainerBuilder, fourCC: u32) -> HRESULT,
+ SerializeContainer: proc "system" (this: ^IContainerBuilder, ppResult: ^^IOperationResult) -> HRESULT,
}
IAssembler_UUID_STRING :: "091F7A26-1C1F-4948-904B-E6E3A8A771D5"
@@ -397,7 +388,7 @@ IAssembler :: struct #raw_union {
}
IAssembler_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- AssembleToContainer: proc "stdcall" (this: ^IAssembler, pShader: ^IBlob, ppResult: ^^IOperationResult) -> HRESULT,
+ AssembleToContainer: proc "system" (this: ^IAssembler, pShader: ^IBlob, ppResult: ^^IOperationResult) -> HRESULT,
}
IContainerReflection_UUID_STRING :: "D2C21B26-8350-4BDC-976A-331CE6F4C54C"
@@ -408,12 +399,12 @@ IContainerReflection :: struct #raw_union {
}
IContainerReflection_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- Load: proc "stdcall" (this: ^IContainerReflection, pContainer: ^IBlob) -> HRESULT,
- GetPartCount: proc "stdcall" (this: ^IContainerReflection, pResult: ^u32) -> HRESULT,
- GetPartKind: proc "stdcall" (this: ^IContainerReflection, idx: u32, pResult: ^u32) -> HRESULT,
- GetPartContent: proc "stdcall" (this: ^IContainerReflection, idx: u32, ppResult: ^^IBlob) -> HRESULT,
- FindFirstPartKind: proc "stdcall" (this: ^IContainerReflection, kind: u32, pResult: ^u32) -> HRESULT,
- GetPartReflection: proc "stdcall" (this: ^IContainerReflection, idx: u32, iid: ^IID, ppvObject: rawptr) -> HRESULT,
+ Load: proc "system" (this: ^IContainerReflection, pContainer: ^IBlob) -> HRESULT,
+ GetPartCount: proc "system" (this: ^IContainerReflection, pResult: ^u32) -> HRESULT,
+ GetPartKind: proc "system" (this: ^IContainerReflection, idx: u32, pResult: ^u32) -> HRESULT,
+ GetPartContent: proc "system" (this: ^IContainerReflection, idx: u32, ppResult: ^^IBlob) -> HRESULT,
+ FindFirstPartKind: proc "system" (this: ^IContainerReflection, kind: u32, pResult: ^u32) -> HRESULT,
+ GetPartReflection: proc "system" (this: ^IContainerReflection, idx: u32, iid: ^IID, ppvObject: rawptr) -> HRESULT,
}
IOptimizerPass_UUID_STRING :: "AE2CD79F-CC22-453F-9B6B-B124E7A5204C"
@@ -424,11 +415,11 @@ IOptimizerPass :: struct #raw_union {
}
IOptimizerPass_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- GetOptionName: proc "stdcall" (this: ^IOptimizerPass, ppResult: ^wstring) -> HRESULT,
- GetDescription: proc "stdcall" (this: ^IOptimizerPass, ppResult: ^wstring) -> HRESULT,
- GetOptionArgCount: proc "stdcall" (this: ^IOptimizerPass, pCount: ^u32) -> HRESULT,
- GetOptionArgName: proc "stdcall" (this: ^IOptimizerPass, argIndex: u32, ppResult: ^wstring) -> HRESULT,
- GetOptionArgDescription: proc "stdcall" (this: ^IOptimizerPass, argIndex: u32, ppResult: ^wstring) -> HRESULT,
+ GetOptionName: proc "system" (this: ^IOptimizerPass, ppResult: ^wstring) -> HRESULT,
+ GetDescription: proc "system" (this: ^IOptimizerPass, ppResult: ^wstring) -> HRESULT,
+ GetOptionArgCount: proc "system" (this: ^IOptimizerPass, pCount: ^u32) -> HRESULT,
+ GetOptionArgName: proc "system" (this: ^IOptimizerPass, argIndex: u32, ppResult: ^wstring) -> HRESULT,
+ GetOptionArgDescription: proc "system" (this: ^IOptimizerPass, argIndex: u32, ppResult: ^wstring) -> HRESULT,
}
IOptimizer_UUID_STRING :: "25740E2E-9CBA-401B-9119-4FB42F39F270"
@@ -439,9 +430,9 @@ IOptimizer :: struct #raw_union {
}
IOptimizer_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- GetAvailablePassCount: proc "stdcall" (this: ^IOptimizer, pCount: ^u32) -> HRESULT,
- GetAvailablePass: proc "stdcall" (this: ^IOptimizer, index: u32, ppResult: ^^IOptimizerPass) -> HRESULT,
- RunOptimizer: proc "stdcall" (this: ^IOptimizer, pBlob: ^IBlob, ppOptions: [^]wstring, optionCount: u32, pOutputModule: ^^IBlob, ppOutputText: ^^IBlobEncoding) -> HRESULT,
+ GetAvailablePassCount: proc "system" (this: ^IOptimizer, pCount: ^u32) -> HRESULT,
+ GetAvailablePass: proc "system" (this: ^IOptimizer, index: u32, ppResult: ^^IOptimizerPass) -> HRESULT,
+ RunOptimizer: proc "system" (this: ^IOptimizer, pBlob: ^IBlob, ppOptions: [^]wstring, optionCount: u32, pOutputModule: ^^IBlob, ppOutputText: ^^IBlobEncoding) -> HRESULT,
}
VersionInfoFlags :: enum u32 {
@@ -458,8 +449,8 @@ IVersionInfo :: struct #raw_union {
}
IVersionInfo_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- GetVersion: proc "stdcall" (this: ^IVersionInfo, pMajor: ^u32, pMinor: ^u32) -> HRESULT,
- GetFlags: proc "stdcall" (this: ^IVersionInfo, pFlags: ^VersionInfoFlags) -> HRESULT,
+ GetVersion: proc "system" (this: ^IVersionInfo, pMajor: ^u32, pMinor: ^u32) -> HRESULT,
+ GetFlags: proc "system" (this: ^IVersionInfo, pFlags: ^VersionInfoFlags) -> HRESULT,
}
IVersionInfo2_UUID_STRING :: "FB6904C4-42F0-4B62-9C46-983AF7DA7C83"
@@ -470,7 +461,7 @@ IVersionInfo2 :: struct #raw_union {
}
IVersionInfo2_VTable :: struct {
using idxcversioninfo_vtable: IVersionInfo_VTable,
- GetCommitInfo: proc "stdcall" (this: ^IVersionInfo2, pCommitCount: ^u32, pCommitHash: ^[^]byte) -> HRESULT,
+ GetCommitInfo: proc "system" (this: ^IVersionInfo2, pCommitCount: ^u32, pCommitHash: ^[^]byte) -> HRESULT,
}
IVersionInfo3_UUID_STRING :: "5E13E843-9D25-473C-9AD2-03B2D0B44B1E"
@@ -481,7 +472,7 @@ IVersionInfo3 :: struct #raw_union {
}
IVersionInfo3_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- GetCustomVersionString: proc "stdcall" (this: ^IVersionInfo3, pVersionString: ^cstring) -> HRESULT,
+ GetCustomVersionString: proc "system" (this: ^IVersionInfo3, pVersionString: ^cstring) -> HRESULT,
}
ArgPair :: struct {
@@ -497,30 +488,30 @@ IPdbUtils :: struct #raw_union {
}
IPdbUtils_VTable :: struct {
using iunknown_vtable: IUnknown_VTable,
- Load: proc "stdcall" (this: ^IPdbUtils, pPdbOrDxil: ^IBlob) -> HRESULT,
- GetSourceCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT,
- GetSource: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, ppResult: ^^IBlobEncoding) -> HRESULT,
- GetSourceName: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT,
- GetFlagCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT,
- GetFlag: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT,
- GetArgCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT,
- GetArg: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT,
- GetArgPairCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT,
- GetArgPair: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pName: ^BSTR, pValue: ^BSTR) -> HRESULT,
- GetDefineCount: proc "stdcall" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT,
- GetDefine: proc "stdcall" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT,
- GetTargetProfile: proc "stdcall" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT,
- GetEntryPoint: proc "stdcall" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT,
- GetMainFileName: proc "stdcall" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT,
- GetHash: proc "stdcall" (this: ^IPdbUtils, ppResult: ^^IBlob) -> HRESULT,
- GetName: proc "stdcall" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT,
- IsFullPDB: proc "stdcall" (this: ^IPdbUtils) -> BOOL,
- GetFullPDB: proc "stdcall" (this: ^IPdbUtils, ppFullPDB: ^^IBlob) -> HRESULT,
- GetVersionInfo: proc "stdcall" (this: ^IPdbUtils, ppVersionInfo: ^^IVersionInfo) -> HRESULT,
- SetCompiler: proc "stdcall" (this: ^IPdbUtils, pCompiler: ^ICompiler3) -> HRESULT,
- CompileForFullPDB: proc "stdcall" (this: ^IPdbUtils, ppResult: ^^IResult) -> HRESULT,
- OverrideArgs: proc "stdcall" (this: ^IPdbUtils, pArgPairs: ^ArgPair, uNumArgPairs: u32) -> HRESULT,
- OverrideRootSignature: proc "stdcall" (this: ^IPdbUtils, pRootSignature: wstring) -> HRESULT,
+ Load: proc "system" (this: ^IPdbUtils, pPdbOrDxil: ^IBlob) -> HRESULT,
+ GetSourceCount: proc "system" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT,
+ GetSource: proc "system" (this: ^IPdbUtils, uIndex: u32, ppResult: ^^IBlobEncoding) -> HRESULT,
+ GetSourceName: proc "system" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT,
+ GetFlagCount: proc "system" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT,
+ GetFlag: proc "system" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT,
+ GetArgCount: proc "system" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT,
+ GetArg: proc "system" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT,
+ GetArgPairCount: proc "system" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT,
+ GetArgPair: proc "system" (this: ^IPdbUtils, uIndex: u32, pName: ^BSTR, pValue: ^BSTR) -> HRESULT,
+ GetDefineCount: proc "system" (this: ^IPdbUtils, pCount: ^u32) -> HRESULT,
+ GetDefine: proc "system" (this: ^IPdbUtils, uIndex: u32, pResult: ^BSTR) -> HRESULT,
+ GetTargetProfile: proc "system" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT,
+ GetEntryPoint: proc "system" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT,
+ GetMainFileName: proc "system" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT,
+ GetHash: proc "system" (this: ^IPdbUtils, ppResult: ^^IBlob) -> HRESULT,
+ GetName: proc "system" (this: ^IPdbUtils, pResult: ^BSTR) -> HRESULT,
+ IsFullPDB: proc "system" (this: ^IPdbUtils) -> BOOL,
+ GetFullPDB: proc "system" (this: ^IPdbUtils, ppFullPDB: ^^IBlob) -> HRESULT,
+ GetVersionInfo: proc "system" (this: ^IPdbUtils, ppVersionInfo: ^^IVersionInfo) -> HRESULT,
+ SetCompiler: proc "system" (this: ^IPdbUtils, pCompiler: ^ICompiler3) -> HRESULT,
+ CompileForFullPDB: proc "system" (this: ^IPdbUtils, ppResult: ^^IResult) -> HRESULT,
+ OverrideArgs: proc "system" (this: ^IPdbUtils, pArgPairs: ^ArgPair, uNumArgPairs: u32) -> HRESULT,
+ OverrideRootSignature: proc "system" (this: ^IPdbUtils, pRootSignature: wstring) -> HRESULT,
}
diff --git a/vendor/directx/dxc/dxcdef_unix.odin b/vendor/directx/dxc/dxcdef_unix.odin
new file mode 100644
index 000000000..649bb8a13
--- /dev/null
+++ b/vendor/directx/dxc/dxcdef_unix.odin
@@ -0,0 +1,37 @@
+//+build linux, darwin
+package directx_dxc
+import "core:c"
+
+FILETIME :: struct {
+ dwLowDateTime: DWORD,
+ dwHighDateTime: DWORD,
+}
+
+GUID :: struct {
+ Data1: DWORD,
+ Data2: WORD,
+ Data3: WORD,
+ Data4: [8]BYTE,
+}
+
+BYTE :: distinct u8
+WORD :: u16
+DWORD :: u32
+BOOL :: distinct b32
+SIZE_T :: uint
+ULONG :: c.ulong
+CLSID :: GUID
+IID :: GUID
+LONG :: distinct c.long
+HRESULT :: distinct LONG
+wstring :: [^]c.wchar_t
+BSTR :: wstring
+
+IUnknown :: struct {
+ using _iunknown_vtable: ^IUnknown_VTable,
+}
+IUnknown_VTable :: struct {
+ QueryInterface: proc "c" (this: ^IUnknown, riid: ^IID, ppvObject: ^rawptr) -> HRESULT,
+ AddRef: proc "c" (this: ^IUnknown) -> ULONG,
+ Release: proc "c" (this: ^IUnknown) -> ULONG,
+}
diff --git a/vendor/directx/dxc/dxcdef_windows.odin b/vendor/directx/dxc/dxcdef_windows.odin
new file mode 100644
index 000000000..16e6f6566
--- /dev/null
+++ b/vendor/directx/dxc/dxcdef_windows.odin
@@ -0,0 +1,16 @@
+//+build windows
+package directx_dxc
+import win32 "core:sys/windows"
+import dxgi "vendor:directx/dxgi"
+
+BOOL :: dxgi.BOOL
+SIZE_T :: dxgi.SIZE_T
+ULONG :: dxgi.ULONG
+CLSID :: dxgi.GUID
+IID :: dxgi.IID
+HRESULT :: dxgi.HRESULT
+IUnknown :: dxgi.IUnknown
+IUnknown_VTable :: dxgi.IUnknown_VTable
+wstring :: win32.wstring
+FILETIME :: win32.FILETIME
+BSTR :: wstring
diff --git a/vendor/raylib/raylib.odin b/vendor/raylib/raylib.odin
index 5576a0915..f6e58a564 100644
--- a/vendor/raylib/raylib.odin
+++ b/vendor/raylib/raylib.odin
@@ -901,7 +901,7 @@ foreign lib {
IsWindowMaximized :: proc() -> bool --- // Check if window is currently maximized (only PLATFORM_DESKTOP)
IsWindowFocused :: proc() -> bool --- // Check if window is currently focused (only PLATFORM_DESKTOP)
IsWindowResized :: proc() -> bool --- // Check if window has been resized last frame
- IsWindowState :: proc(flag: ConfigFlag) -> bool --- // Check if one specific window flag is enabled
+ IsWindowState :: proc(flags: ConfigFlags) -> bool --- // Check if one specific window flag is enabled
SetWindowState :: proc(flags: ConfigFlags) --- // Set window configuration state using flags (only PLATFORM_DESKTOP)
ClearWindowState :: proc(flags: ConfigFlags) --- // Clear window configuration state flags
ToggleFullscreen :: proc() --- // Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)