From 2c05d1515e3edc8c365522adb4a6b8205a7a7a42 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Sun, 18 Dec 2016 19:07:56 -0700 Subject: [PATCH] initialize MyThread::dynamicTable on thread creation Previously, I was lazily initializing this field in addDynamic, but that only worked if a thread compiles an invokedynamic expression prior to the first time it executes one, which is not always the case. This is a bit tricky to write a simple test case for, since it involves multiple threads, but I've tested it with a big, lambda-heavy app and it fixes an otherwise consistent crash there. --- src/compile.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/compile.cpp b/src/compile.cpp index 725033ab0c..4b3969a9e5 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -1311,10 +1311,6 @@ Allocator* allocator(MyThread* t); unsigned addDynamic(MyThread* t, GcInvocation* invocation) { - if (t->dynamicTable == nullptr) { - t->dynamicTable = dynamicTable(t); - } - ACQUIRE(t, t->m->classLock); int index = invocation->index(); @@ -8828,6 +8824,7 @@ class MyProcessor : public Processor { t->heapImage = heapImage; t->codeImage = codeImage; t->thunkTable = thunkTable; + t->dynamicTable = local::dynamicTable(t); #if TARGET_BYTES_PER_WORD == BYTES_PER_WORD