Skip to content

Commit d720951

Browse files
Prevent clang from doing tail-call elimination in DartEntry::InvokeClosure.
TEST=language/issue21159_test.dart with --noopt [email protected] Review URL: https://codereview.chromium.org/1587293002 .
1 parent a07b997 commit d720951

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

runtime/vm/dart_entry.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,12 @@ RawObject* DartEntry::InvokeClosure(const Array& arguments,
192192
ASSERT(getter_result.IsNull() || getter_result.IsInstance());
193193

194194
arguments.SetAt(0, getter_result);
195-
return InvokeClosure(arguments, arguments_descriptor);
195+
// This otherwise unnecessary handle is used to prevent clang from
196+
// doing tail call elimination, which would make the stack overflow
197+
// check above ineffective.
198+
Object& result = Object::Handle(InvokeClosure(arguments,
199+
arguments_descriptor));
200+
return result.raw();
196201
}
197202
cls = cls.SuperClass();
198203
}

0 commit comments

Comments
 (0)