mirror of
https://github.com/corda/corda.git
synced 2025-05-22 02:07:46 +00:00
use THREAD_RUNTIME_ARRAY instead of RUNTIME_ARRAY where appropriate
This ensures that if the stack is unwound for an exception we'll still release the memory.
This commit is contained in:
parent
f2d2c9af29
commit
d97fe5304f
@ -342,7 +342,7 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code,
|
|||||||
|
|
||||||
unsigned count = s.read2() - 1;
|
unsigned count = s.read2() - 1;
|
||||||
if (count) {
|
if (count) {
|
||||||
RUNTIME_ARRAY(Type, types, count + 2);
|
THREAD_RUNTIME_ARRAY(t, Type, types, count + 2);
|
||||||
types[0] = Type_object;
|
types[0] = Type_object;
|
||||||
types[1] = Type_intptr_t;
|
types[1] = Type_intptr_t;
|
||||||
|
|
||||||
@ -420,7 +420,7 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code,
|
|||||||
object fields = allFields(t, typeMaps, c, &count, &array);
|
object fields = allFields(t, typeMaps, c, &count, &array);
|
||||||
PROTECT(t, fields);
|
PROTECT(t, fields);
|
||||||
|
|
||||||
RUNTIME_ARRAY(Field, memberFields, count + 1);
|
THREAD_RUNTIME_ARRAY(t, Field, memberFields, count + 1);
|
||||||
|
|
||||||
unsigned memberIndex;
|
unsigned memberIndex;
|
||||||
unsigned buildMemberOffset;
|
unsigned buildMemberOffset;
|
||||||
@ -454,7 +454,7 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code,
|
|||||||
|
|
||||||
const unsigned StaticHeader = 3;
|
const unsigned StaticHeader = 3;
|
||||||
|
|
||||||
RUNTIME_ARRAY(Field, staticFields, count + StaticHeader);
|
THREAD_RUNTIME_ARRAY(t, Field, staticFields, count + StaticHeader);
|
||||||
|
|
||||||
init(new (&staticFields[0]) Field, Type_object, 0, BytesPerWord, 0,
|
init(new (&staticFields[0]) Field, Type_object, 0, BytesPerWord, 0,
|
||||||
TargetBytesPerWord);
|
TargetBytesPerWord);
|
||||||
@ -1334,7 +1334,7 @@ writeBootImage2(Thread* t, OutputStream* bootimageOutput, OutputStream* codeOutp
|
|||||||
}
|
}
|
||||||
++ count;
|
++ count;
|
||||||
|
|
||||||
RUNTIME_ARRAY(Field, fields, count);
|
THREAD_RUNTIME_ARRAY(t, Field, fields, count);
|
||||||
|
|
||||||
init(new (&fields[0]) Field, Type_object, 0, BytesPerWord, 0,
|
init(new (&fields[0]) Field, Type_object, 0, BytesPerWord, 0,
|
||||||
TargetBytesPerWord);
|
TargetBytesPerWord);
|
||||||
|
@ -647,7 +647,7 @@ invokeNative(Thread* t, object method)
|
|||||||
{ THREAD_RESOURCE0(t, popFrame(static_cast<Thread*>(t)));
|
{ THREAD_RESOURCE0(t, popFrame(static_cast<Thread*>(t)));
|
||||||
|
|
||||||
unsigned footprint = methodParameterFootprint(t, method);
|
unsigned footprint = methodParameterFootprint(t, method);
|
||||||
RUNTIME_ARRAY(uintptr_t, args, footprint);
|
THREAD_RUNTIME_ARRAY(t, uintptr_t, args, footprint);
|
||||||
unsigned sp = frameBase(t, t->frame);
|
unsigned sp = frameBase(t, t->frame);
|
||||||
unsigned argOffset = 0;
|
unsigned argOffset = 0;
|
||||||
if ((methodFlags(t, method) & ACC_STATIC) == 0) {
|
if ((methodFlags(t, method) & ACC_STATIC) == 0) {
|
||||||
@ -2321,7 +2321,7 @@ interpret3(Thread* t, const int base)
|
|||||||
object class_ = resolveClassInPool(t, frameMethod(t, frame), index - 1);
|
object class_ = resolveClassInPool(t, frameMethod(t, frame), index - 1);
|
||||||
PROTECT(t, class_);
|
PROTECT(t, class_);
|
||||||
|
|
||||||
RUNTIME_ARRAY(int32_t, counts, dimensions);
|
THREAD_RUNTIME_ARRAY(t, int32_t, counts, dimensions);
|
||||||
for (int i = dimensions - 1; i >= 0; --i) {
|
for (int i = dimensions - 1; i >= 0; --i) {
|
||||||
counts[i] = popInt(t);
|
counts[i] = popInt(t);
|
||||||
if (UNLIKELY(counts[i] < 0)) {
|
if (UNLIKELY(counts[i] < 0)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user