LWDR Versions Save

LightWeight D Runtime targeting ARM Cortex CPUs

v0.4.0-beta.1

2 years ago
  • Manual deallocation of delegates.
  • Object monitor.
  • Synchronization/locking.
  • Module information.
  • Shared and static constructors and destructors.

v0.3.0

2 years ago

See betas for release highlights.

v0.3.0-beta.3

2 years ago

RefCount and Unique are designed specifically for LWDR. The implementation is inspired by AutoMem.

struct Point { int x, y; }

{
  auto rc0 = RefCount!(Point*)(new Point(3, 4)); // or RefCount!(Point*)(3, 4); works too
  {
    auto rc1 = rc0; // increase reference count
  } // decrease reference count
} // decrease reference count and free

It works for classes, interfaces, pointers and dynamic arrays.

struct Point { int x, y; }

{
  auto u0 = Unique!(Point*)(new Point(3, 4)); // Unique!(Point*)(3, 4); works too
  /+ ERROR +/ auto u1 = u0; // error -- cannot copy
  auto u2 = u0.move; // works
  u0.hasPayload; // false
  u1.hasPayload; // true
} // u1 will deallocate the payload

It works for classes, interfaces, pointers and dynamic arrays.

Dynamic arrays can be constructor via RefCount's and Unique's constructors. Example:

auto rcArray0 = RefCount!(int[])(4, 5, 6); // pass the array elements to RefCount's ctor
auto rcArray1 = RefCount!(int[])([4, 5, 6]); // allocate the array and then pass it to RefCount

The documentation of the source code has been improved. This is too make the codebase easier to explore and reason about.

v0.3.0-beta.2

2 years ago

D's delete is deprecated. LWDR.free(..) has been added as a replacement. When possible, LWDR.free will invoke the target's destructor.

Example:

class C {}
C c = new C();
LWDR.free(c); // if C has a destructor, it will be invoked
struct S {}
S* s = new S();
LWDR.free(s); // if S has a destructor, it will be invoked
int[] array = new int[](2);
LWDR.free(array); 
struct S {}
S[] s = new S[](2);
LWDR.free(s); // For each S element, its destructor will be called (if it has one)

v0.3.0-beta.1

2 years ago

Thread Local Storage (TLS) support has been added. LWDR will not register your threads, you must do that by:

import lwdr;
//...
LWDR.registerCurrentThread();

Support for freeing TLS memory needs to be added. TLS is opt via the version LWDR_TLS.

Primitive memory tracking has been added. Refer to this. Memory tracking is opt-in via the version LWDR_TrackMem.

Dynamic arrays are now opt-in. You must specify the version LWDR_DynamicArray via compiler command line or in your DUB setup file (example: "versions": ["LWDR_DynamicArray"])

v0.2.3

3 years ago

Dynamic array resizing for all element types now works:

struct S {
  uint b = 2; // non-zero initialised element
}

S[] s = [S(3), S(4)];
s.length = 3; // used to fail
printf("Items are; %d %d %d\n", s[0].b, s[1].a, s[2].a); // 3, 4, 2 (last one is default initialised!)

v0.2.2

3 years ago

This release now supports dynamic array resizing for zero-initialised elements.

For example:

int[] myArr = new int[](2);
myArr.length = 3; // resize to 3 elements
printf("length of myArr is: %d\n", cast(int)myArr.length); // "length of myArr is: 3"

However, the following will fail:

struct S {
  int b = 2;
}
//...
S[] s = new S[](2);
s.length = 3; // this will fail, because S is a non zero initialised item

v0.2.1

3 years ago

This release now supports dynamic array concatenation.

For example:

int[] myArr = [2, 3, 4];
myArr ~= 5;
// myArr is now [2, 3, 4, 5]

int myArr2 = [6, 7];

int myArr3 = myArr ~ myArr2;
// myArr3 is [2, 3, 4, 5, 6, 7];

v0.2

3 years ago

v0.1-beta.3

3 years ago

Basic dynamic array support

Dynamic arrays can be allocated and deallocated (via delete). However, they cannot be concatenated, nor resized. Support for this will be coming soon.

Restructuring of lifetime.d (formerly memory.d)

lifetime.d/memory.d has been broken down into a package for ease of use.

Heap allocation of structures

Heap allocation and deallocation of structs is now supported.