Skip to content

Commit b005246

Browse files
authored
Merge pull request dlang#3838 from teodutu/remove-old-_d_newThrowable
Remove old `_d_newThrowable` hook
2 parents 53fccb9 + 7b7a2ec commit b005246

File tree

1 file changed

+0
-45
lines changed

1 file changed

+0
-45
lines changed

src/rt/ehalloc.d

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -18,51 +18,6 @@ debug(PRINTF)
1818
import core.stdc.stdio;
1919
}
2020

21-
/**********************************************
22-
* Allocate an exception of type `ci` from the exception pool.
23-
* It has the same interface as `rt.lifetime._d_newclass()`.
24-
* The class type must be Throwable or derived from it,
25-
* and cannot be a COM or C++ class. The compiler must enforce
26-
* this.
27-
* Returns:
28-
* default initialized instance of the type
29-
*/
30-
31-
extern (C) Throwable _d_newThrowable(const TypeInfo_Class ci)
32-
{
33-
debug(PRINTF) printf("_d_newThrowable(ci = %p, %s)\n", ci, cast(char *)ci.name);
34-
35-
assert(!(ci.m_flags & TypeInfo_Class.ClassFlags.isCOMclass));
36-
assert(!(ci.m_flags & TypeInfo_Class.ClassFlags.isCPPclass));
37-
38-
import core.stdc.stdlib : malloc;
39-
auto init = ci.initializer;
40-
void* p = malloc(init.length);
41-
if (!p)
42-
{
43-
import core.exception : onOutOfMemoryError;
44-
onOutOfMemoryError();
45-
}
46-
47-
debug(PRINTF) printf(" p = %p\n", p);
48-
49-
// initialize it
50-
p[0 .. init.length] = init[];
51-
52-
if (!(ci.m_flags & TypeInfo_Class.ClassFlags.noPointers))
53-
{
54-
// Inform the GC about the pointers in the object instance
55-
import core.memory : GC;
56-
57-
GC.addRange(p, init.length, ci);
58-
}
59-
60-
debug(PRINTF) printf("initialization done\n");
61-
Throwable t = cast(Throwable)p;
62-
t.refcount() = 1;
63-
return t;
64-
}
65-
6621

6722
/********************************************
6823
* Delete exception instance `t` from the exception pool.

0 commit comments

Comments
 (0)