aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base/runtime/wasm_allocator.odin2
-rw-r--r--core/odin/doc-format/doc_format.odin13
-rw-r--r--core/sync/extended.odin18
-rw-r--r--core/sync/primitives.odin10
-rw-r--r--core/sync/primitives_atomic.odin10
-rw-r--r--src/parser.cpp11
-rw-r--r--src/tilde_type_info.cpp12
7 files changed, 34 insertions, 42 deletions
diff --git a/base/runtime/wasm_allocator.odin b/base/runtime/wasm_allocator.odin
index 325b1d4fa..d5fd71ba6 100644
--- a/base/runtime/wasm_allocator.odin
+++ b/base/runtime/wasm_allocator.odin
@@ -43,7 +43,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-WASM_Allocator :: struct #no_copy {
+WASM_Allocator :: struct {
// The minimum alignment of allocations.
alignment: uint,
// A region that contains as payload a single forward linked list of pointers to
diff --git a/core/odin/doc-format/doc_format.odin b/core/odin/doc-format/doc_format.odin
index a60768931..df36c1b55 100644
--- a/core/odin/doc-format/doc_format.odin
+++ b/core/odin/doc-format/doc_format.odin
@@ -219,12 +219,13 @@ Type :: struct {
custom_align: String,
// Used by:
- // .Array - 1 count: 0=len
- // .Enumerated_Array - 1 count: 0=len
- // .SOA_Struct_Fixed - 1 count: 0=len
- // .Bit_Set - 2 count: 0=lower, 1=upper
- // .Simd_Vector - 1 count: 0=len
- // .Matrix - 2 count: 0=row_count, 1=column_count
+ // .Array - 1 count: 0=len
+ // .Enumerated_Array - 1 count: 0=len
+ // .SOA_Struct_Fixed - 1 count: 0=len
+ // .Bit_Set - 2 count: 0=lower, 1=upper
+ // .Simd_Vector - 1 count: 0=len
+ // .Matrix - 2 count: 0=row_count, 1=column_count
+ // .Struct - <=2 count: 0=min_field_align, 1=max_field_align
elem_count_len: u32le,
elem_counts: [Type_Elems_Cap]i64le,
diff --git a/core/sync/extended.odin b/core/sync/extended.odin
index 82fc3d751..8566eccc8 100644
--- a/core/sync/extended.odin
+++ b/core/sync/extended.odin
@@ -26,7 +26,7 @@ is not allowed to become negative.
**Note**: Just like any synchronization primitives, a wait group cannot be
copied after first use. See documentation for `Mutex` or `Cond`.
*/
-Wait_Group :: struct #no_copy {
+Wait_Group :: struct {
counter: int,
mutex: Mutex,
cond: Cond,
@@ -144,7 +144,7 @@ thread procedure.
thread.destroy(t)
}
*/
-Barrier :: struct #no_copy {
+Barrier :: struct {
mutex: Mutex,
cond: Cond,
index: int,
@@ -206,7 +206,7 @@ When a thread calls `auto_reset_event_wait`, its execution will be blocked,
until the event is signalled by another thread. The call to
`auto_reset_event_signal` wakes up exactly one thread waiting for the event.
*/
-Auto_Reset_Event :: struct #no_copy {
+Auto_Reset_Event :: struct {
// status == 0: Event is reset and no threads are waiting
// status == 1: Event is signalled
// status == -N: Event is reset and N threads are waiting
@@ -260,7 +260,7 @@ of entries into the critical section.
This type of synchronization primitive is applicable for short critical sections
in low-contention systems, as it uses a spinlock under the hood.
*/
-Ticket_Mutex :: struct #no_copy {
+Ticket_Mutex :: struct {
ticket: uint,
serving: uint,
}
@@ -332,7 +332,7 @@ Once a lock on a benaphore is acquired by a thread, no other thread is allowed
into any critical sections, associted with the same benaphore, until the lock
is released.
*/
-Benaphore :: struct #no_copy {
+Benaphore :: struct {
counter: i32,
sema: Sema,
}
@@ -424,7 +424,7 @@ to acquire another lock on the same benaphore. When a thread has acquired the
lock on a benaphore, the benaphore will stay locked until the thread releases
the lock as many times as it has been locked by the thread.
*/
-Recursive_Benaphore :: struct #no_copy {
+Recursive_Benaphore :: struct {
counter: int,
owner: int,
recursion: i32,
@@ -536,7 +536,7 @@ Once action.
`Once` a synchronization primitive, that only allows a single entry into a
critical section from a single thread.
*/
-Once :: struct #no_copy {
+Once :: struct {
m: Mutex,
done: bool,
}
@@ -636,7 +636,7 @@ A Parker is an associated token which is initially not present:
* The `unpark` procedure automatically makes the token available if it
was not already.
*/
-Parker :: struct #no_copy {
+Parker :: struct {
state: Futex,
}
@@ -713,7 +713,7 @@ A one-shot event is an associated token which is initially not present:
* The `one_shot_event_signal` procedure automatically makes the token
available if its was not already.
*/
-One_Shot_Event :: struct #no_copy {
+One_Shot_Event :: struct {
state: Futex,
}
diff --git a/core/sync/primitives.odin b/core/sync/primitives.odin
index f091de045..276427477 100644
--- a/core/sync/primitives.odin
+++ b/core/sync/primitives.odin
@@ -36,7 +36,7 @@ holding another lock, that will cause a trivial case of deadlock. Do not use
`Mutex` in recursive functions. In case multiple locks by the same thread are
desired, use `Recursive_Mutex`.
*/
-Mutex :: struct #no_copy {
+Mutex :: struct {
impl: _Mutex,
}
@@ -147,7 +147,7 @@ result in broken and unsafe behavior. For this reason, mutexes are marked as
exclusive lock more than once from the same thread, or an exclusive and shared
lock on the same thread. Taking a shared lock multiple times is acceptable.
*/
-RW_Mutex :: struct #no_copy {
+RW_Mutex :: struct {
impl: _RW_Mutex,
}
@@ -313,7 +313,7 @@ released. Trying to use a copy of the lock at a different memory address will
result in broken and unsafe behavior. For this reason, mutexes are marked as
`#no_copy`.
*/
-Recursive_Mutex :: struct #no_copy {
+Recursive_Mutex :: struct {
impl: _Recursive_Mutex,
}
@@ -414,7 +414,7 @@ lock has been released. Trying to use a copy of the lock at a different memory
address will result in broken and unsafe behavior. For this reason, condition
variables are marked as `#no_copy`.
*/
-Cond :: struct #no_copy {
+Cond :: struct {
impl: _Cond,
}
@@ -494,7 +494,7 @@ must watch the same memory address to know when the lock has been released.
Trying to use a copy of the lock at a different memory address will result in
broken and unsafe behavior. For this reason, semaphores are marked as `#no_copy`.
*/
-Sema :: struct #no_copy {
+Sema :: struct {
impl: _Sema,
}
diff --git a/core/sync/primitives_atomic.odin b/core/sync/primitives_atomic.odin
index c694e5f96..9d5bdf7ee 100644
--- a/core/sync/primitives_atomic.odin
+++ b/core/sync/primitives_atomic.odin
@@ -13,7 +13,7 @@ Atomic_Mutex_State :: enum Futex {
// The zero value for a Atomic_Mutex is an unlocked mutex
//
// An Atomic_Mutex must not be copied after first use
-Atomic_Mutex :: struct #no_copy {
+Atomic_Mutex :: struct {
state: Atomic_Mutex_State,
}
@@ -105,7 +105,7 @@ Atomic_RW_Mutex_State_Reader_Mask :: ~Atomic_RW_Mutex_State_Is_Writing
// The zero value for an Atomic_RW_Mutex is an unlocked mutex.
//
// An Atomic_RW_Mutex must not be copied after first use.
-Atomic_RW_Mutex :: struct #no_copy {
+Atomic_RW_Mutex :: struct {
state: Atomic_RW_Mutex_State,
mutex: Atomic_Mutex,
sema: Atomic_Sema,
@@ -246,7 +246,7 @@ atomic_rw_mutex_shared_guard :: proc "contextless" (m: ^Atomic_RW_Mutex) -> bool
// The zero value for a Recursive_Mutex is an unlocked mutex
//
// An Atomic_Recursive_Mutex must not be copied after first use
-Atomic_Recursive_Mutex :: struct #no_copy {
+Atomic_Recursive_Mutex :: struct {
owner: int,
recursion: int,
mutex: Mutex,
@@ -309,7 +309,7 @@ atomic_recursive_mutex_guard :: proc "contextless" (m: ^Atomic_Recursive_Mutex)
// waiting for signalling the occurence of an event
//
// An Atomic_Cond must not be copied after first use
-Atomic_Cond :: struct #no_copy {
+Atomic_Cond :: struct {
state: Futex,
}
@@ -344,7 +344,7 @@ atomic_cond_broadcast :: proc "contextless" (c: ^Atomic_Cond) {
// Posting to the semaphore increases the count by one, or the provided amount.
//
// An Atomic_Sema must not be copied after first use
-Atomic_Sema :: struct #no_copy {
+Atomic_Sema :: struct {
count: Futex,
}
diff --git a/src/parser.cpp b/src/parser.cpp
index d3b35f3f4..06703d643 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -1230,7 +1230,7 @@ gb_internal Ast *ast_dynamic_array_type(AstFile *f, Token token, Ast *elem) {
}
gb_internal Ast *ast_struct_type(AstFile *f, Token token, Slice<Ast *> fields, isize field_count,
- Ast *polymorphic_params, bool is_packed, bool is_raw_union, bool is_no_copy, bool is_all_or_none,
+ Ast *polymorphic_params, bool is_packed, bool is_raw_union, bool is_all_or_none,
Ast *align, Ast *min_field_align, Ast *max_field_align,
Token where_token, Array<Ast *> const &where_clauses) {
Ast *result = alloc_ast_node(f, Ast_StructType);
@@ -1240,7 +1240,6 @@ gb_internal Ast *ast_struct_type(AstFile *f, Token token, Slice<Ast *> fields, i
result->StructType.polymorphic_params = polymorphic_params;
result->StructType.is_packed = is_packed;
result->StructType.is_raw_union = is_raw_union;
- result->StructType.is_no_copy = is_no_copy;
result->StructType.is_all_or_none = is_all_or_none;
result->StructType.align = align;
result->StructType.min_field_align = min_field_align;
@@ -2776,7 +2775,6 @@ gb_internal Ast *parse_operand(AstFile *f, bool lhs) {
bool is_packed = false;
bool is_all_or_none = false;
bool is_raw_union = false;
- bool no_copy = false;
Ast *align = nullptr;
Ast *min_field_align = nullptr;
Ast *max_field_align = nullptr;
@@ -2863,11 +2861,6 @@ gb_internal Ast *parse_operand(AstFile *f, bool lhs) {
syntax_error(tag, "Duplicate struct tag '#%.*s'", LIT(tag.string));
}
is_raw_union = true;
- } else if (tag.string == "no_copy") {
- if (no_copy) {
- syntax_error(tag, "Duplicate struct tag '#%.*s'", LIT(tag.string));
- }
- no_copy = true;
} else {
syntax_error(tag, "Invalid struct tag '#%.*s'", LIT(tag.string));
}
@@ -2913,7 +2906,7 @@ gb_internal Ast *parse_operand(AstFile *f, bool lhs) {
parser_check_polymorphic_record_parameters(f, polymorphic_params);
return ast_struct_type(f, token, decls, name_count,
- polymorphic_params, is_packed, is_raw_union, no_copy, is_all_or_none,
+ polymorphic_params, is_packed, is_raw_union, is_all_or_none,
align, min_field_align, max_field_align,
where_token, where_clauses);
} break;
diff --git a/src/tilde_type_info.cpp b/src/tilde_type_info.cpp
index 58e8d3087..96a101376 100644
--- a/src/tilde_type_info.cpp
+++ b/src/tilde_type_info.cpp
@@ -783,14 +783,13 @@ gb_internal void cg_setup_type_info_data(cgModule *m) {
i64 is_packed_offset = type_offset_of(tag_type, 5);
i64 is_raw_union_offset = type_offset_of(tag_type, 6);
- i64 is_no_copy_offset = type_offset_of(tag_type, 7);
- i64 custom_align_offset = type_offset_of(tag_type, 8);
+ i64 custom_align_offset = type_offset_of(tag_type, 7);
- i64 equal_offset = type_offset_of(tag_type, 9);
+ i64 equal_offset = type_offset_of(tag_type, 8);
- i64 soa_kind_offset = type_offset_of(tag_type, 10);
- i64 soa_base_type_offset = type_offset_of(tag_type, 11);
- i64 soa_len_offset = type_offset_of(tag_type, 12);
+ i64 soa_kind_offset = type_offset_of(tag_type, 9);
+ i64 soa_base_type_offset = type_offset_of(tag_type, 10);
+ i64 soa_len_offset = type_offset_of(tag_type, 11);
// TODO(bill): equal proc stuff
gb_unused(equal_offset);
@@ -825,7 +824,6 @@ gb_internal void cg_setup_type_info_data(cgModule *m) {
set_bool(m, global, offset+is_packed_offset, t->Struct.is_packed);
set_bool(m, global, offset+is_raw_union_offset, t->Struct.is_raw_union);
- set_bool(m, global, offset+is_no_copy_offset, t->Struct.is_no_copy);
set_bool(m, global, offset+custom_align_offset, t->Struct.custom_align != 0);
if (t->Struct.soa_kind != StructSoa_None) {