Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/core/exception.d
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,10 @@ extern (C)

/* One of these three is called upon an assert() fail.
*/
void _d_assertm(immutable(ModuleInfo)* m, uint line)
void _d_assertp(immutable(char)* file, uint line)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can file be passed as a D string directly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the idea is to reduce the amount of machine code needed at the call site.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And a D string would require this? I mean, I have no idea about these things.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There would be an extra register push (on x86_64, or depending on whatever other target ABI a stack store) to set up the length argument.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right.

{
onAssertError(m.name, line);
import core.stdc.string : strlen;
onAssertError(file[0 .. strlen(file)], line);
}

void _d_assert_msg(string msg, string file, uint line)
Expand All @@ -638,9 +639,10 @@ extern (C)

/* One of these three is called upon an assert() fail inside of a unittest block
*/
void _d_unittestm(immutable(ModuleInfo)* m, uint line)
void _d_unittestp(immutable(char)* file, uint line)
{
_d_unittest(m.name, line);
import core.stdc.string : strlen;
_d_unittest(file[0 .. strlen(file)], line);
}

void _d_unittest_msg(string msg, string file, uint line)
Expand All @@ -655,9 +657,10 @@ extern (C)

/* Called when an array index is out of bounds
*/
void _d_array_bounds(immutable(ModuleInfo)* m, uint line)
void _d_arrayboundsp(immutable(char*) file, uint line)
{
onRangeError(m.name, line);
import core.stdc.string : strlen;
onRangeError(file[0 .. strlen(file)], line);
}

void _d_arraybounds(string file, uint line)
Expand Down