News for hackers. Stuff that matters.
Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by pjmlp on Thursday August 06, 2020 @02:04AM (#24068494)
It is so easy, write the code that you want in safe mode C++/CLI, get the code template, then implement the helper classes to generate the same MSIL on the fly.

As for stack allocation, apparently you missed structs.

Here is your string allocated on the stack.

    unsafe struct cppstring
    {
        const int BuffSize = 1024;
        fixed char data[BuffSize + 1];
        int current;
        
        public cppstring(System.ReadOnlySpan<char> buffer)
        {
            for (int i = 0; i < System.Math.Min(BuffSize, buffer.Length); i++)
                data[i] = buffer[i];
            current = 0;
        }
    }

    public class StackDemo {
        public void Myfunc() {
            var str = new cppstring ("Hello from stack");
        }
    }
Providing std::string like operations is left as exercise for the reader.
Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by algorithmsRcool on Saturday August 08, 2020 @08:47PM (#24096418)
But that object is not a string, it is char buffer. You cannot directly substitute one for the other.

Yes I realize they can be used to store the same data, but you've defined a new type that is incompatible with an actual string object.