Posts Tagged il2cpp

How SharedStatic Works

Tags: , , , ,

Burst 1.2 comes with a new feature: SharedStatic<T>. This allows us to write to static variables from within Burst-compiled code like jobs and function pointers. Today we’ll look at how this is implemented by Burst and IL2CPP. We’ll also put them to a performance test to see how fast they are.

Read the rest of this article »

4 Comments

What Does Deallocating Temp Memory Do?

Tags: , , ,

Last week we learned a lot about Allocator.Temp, but we left some questions open. One of them was what happens when we explicitly deallocate Temp memory. We know we don’t need to and that it’ll be deallocated at the end of the frame, but what happens when we explicitly deallocate it? Today we’ll dive in and try to find out.

Read the rest of this article »

4 Comments

How IL2CPP Calls Burst

Tags: , ,

Ever wonder how code compiled with IL2CPP can call code compiled by Burst? Today we’ll dive into the details and find out!

Read the rest of this article »

3 Comments

IL2CPP Output for C# 7.3: Local functions, fixed, and stackalloc

Tags: , , , ,

Continuing the series, today we’ll dive into local functions, fixed-size buffers, fixed blocks on arbitrary types with GetPinnableReference, and stackalloc initializers to see how they’re all implemented in C++ and what assembly code ends up actually running on the CPU.

Read the rest of this article »

2 Comments

IL2CPP Output for C# 7.3: Pattern Matching

Tags: , , , ,

Last week we started exploring the new features of C# 7.3 in Unity 2018.3 by delving into tuples. This week we’ll continue and look at pattern matching. Read on to see how the many forms of pattern matching are actually implemented by IL2CPP!

Read the rest of this article »

3 Comments

IL2CPP Output for C# 7.3: Tuples

Tags: , , , , , , ,

Unity 2018.3 officially launched last Thursday and with it comes support for the very latest version of C#: 7.3. This includes four new versions—7.0, 7.1, 7.2, and 7.3—so it’s a big upgrade from the C# 6 that we’ve had since 2018.1. Today we’ll begin an article series to learn what happens when we use some of the new features with IL2CPP. We’ll look at the C++ it outputs and even what the C++ compiles to so we know what the CPU will end up executing. Specifically, we’ll focus on the new tuples feature and talk about creating, naming, deconstructing, and comparing them.

Read the rest of this article »

3 Comments

How Async and Await Work

Tags: , , , ,

Last week’s article tested the performance of the async and await keywords plus the C# Task system against Unity’s new C# jobs system. This week we’ll go in depth with async and await to learn how they work, how they relate to the Task system, and how we can customize them for our own uses.

Read the rest of this article »

5 Comments

IL2CPP Output for Iterators, Switch, and Using

Tags: , , ,

Today we’ll look at the C++ code that IL2CPP outputs when we use iterator functions (those that yield), switch statements, and using blocks. What are you really telling the computer to do when you use these C# features? Read on to find out.

(Website Announcement: check out the new tags page to find articles by topic)

Read the rest of this article »

No Comments

How NativeArray Works

Tags: ,

NativeArray<T> is a new type introduced recently in Unity 2018.1. It’s like List<T> except it’s backed by an unmanaged array instead of a managed array. It’s also a struct instead of a class. This means it creates no garbage for the GC to later collect. That’s the surface level description, but today we’ll go in depth to find out how it really works and learn some interesting facts along the way.

Read the rest of this article »

9 Comments

C# 6 in IL2CPP

Tags: , , ,

Unity 2018.1 was released last week and with it comes support for C# 6. Today we’ll take a look at the C++ that IL2CPP generates when we use the new features in C# 6. Warning: one of them is buggy and shouldn’t be used.

Read the rest of this article »

2 Comments