Skip to content

Commit 4082d3f

Browse files
authored
Merge pull request #5029 from kinke/merge_stable
Merge upstream stable
2 parents 6241b2b + 2b7c8bd commit 4082d3f

355 files changed

Lines changed: 24981 additions & 21463 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/4d-test-libs/action.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ runs:
2323
# sporadically hanging since Ubuntu 22
2424
excludes+='|^core.thread-shared_32$'
2525
elif [[ '${{ runner.os }}-${{ inputs.arch }}' == Linux-aarch64 ]]; then
26-
# FIXME: failing unittest(s)
27-
excludes+='|^std.internal.math.gammafunction'
28-
# FIXME: failing unittest(s) with enabled optimizations
29-
excludes+='|^std.math.exponential(-shared)?$'
3026
# FIXME: sporadically hanging
3127
excludes+='|^core.thread-shared$'
3228
fi

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# LDC master
22

33
#### Big news
4-
- Frontend, druntime and Phobos are at version ~[2.112.0](https://dlang.org/changelog/2.112.0.html), incl. new command-line options `-extI`, `-dllimport=externalOnly` and `-edition`. (#4949, #4962, #4988)
4+
- Frontend, druntime and Phobos are at version ~[2.112.0](https://dlang.org/changelog/2.112.0.html), incl. new command-line options `-extI`, `-dllimport=externalOnly` and `-edition`. (#4949, #4962, #4988, #5029)
55
- **Breaking change for dcompute**: The special `@kernel` UDA is now a function and _**requires**_ parentheses as in `@kernel() void foo(){}`. Optionally you can provide launch dimensions, `@kernel([2,4,8])`, to specify to the compute runtime how the kernel is intended to be launched.
66
- ldc2.conf can now be a directory. All the files inside it, ordered naturally, will be concatenated and treated like a big config. (#4954)
77
- Running `ldc-build-runtime --installWithSuffix` now includes installing a target-specific .conf file to that directory. (#4978)

dmd/README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Note that these groups have no strict meaning, the category assignments are a bi
3535
| [mars.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/mars.d) | Argument parsing, path manipulation. |
3636
| [cli.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/cli.d) | Define the command line interface |
3737
| [dmdparams.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dmdparams.d) | DMD-specific parameters |
38+
| [dmsc.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dmsc.d) | Configures and initializes the back-end |
3839
| [globals.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/globals.d) | Define a structure storing command line options |
3940
| [dinifile.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dinifile.d) | Parse settings from .ini file (`sc.ini` / `dmd.conf`) |
4041
| [vsoptions.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/vsoptions.d) | Detect the Microsoft Visual Studio toolchain for linking |
@@ -46,6 +47,7 @@ Note that these groups have no strict meaning, the category assignments are a bi
4647
| [compiler.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/compiler.d) | Describe a back-end compiler and implements compiler-specific actions |
4748
| [deps.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/deps.d) | Implement the `-deps` and `-makedeps` switches |
4849
| [timetrace.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/timetrace.d) | Build time profiling utility |
50+
| [targetcompiler.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/targetcompiler.d) | Differences in building gdc, ldc and dmd |
4951

5052
### Lexing / parsing
5153

@@ -209,27 +211,28 @@ Note that these groups have no strict meaning, the category assignments are a bi
209211
| [lib/scanmach.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/lib/scanmach.d) | Extract symbol names from a library in Mach-O format |
210212
| [lib/scanmscoff.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/lib/scanmscoff.d) | Extract symbol names from a library in COFF format |
211213

214+
215+
### ABI
216+
| File | Purpose |
217+
| [argtypes_x86.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/argtypes_x86.d) | Convert a D type into simple (register) types for the 32-bit x86 ABI |
218+
| [argtypes_sysv_x64.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/argtypes_sysv_x64.d) | 'argtypes' for the x86_64 System V ABI |
219+
| [argtypes_aarch64.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/argtypes_aarch64.d) | 'argtypes' for the AArch64 ABI |
212220
### Code generation / back-end interfacing
213221

214222
| File | Purpose |
215223
|---------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
216-
| [dmsc.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dmsc.d) | Configures and initializes the back-end |
217-
| [toobj.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/toobj.d) | Convert an AST that went through all semantic phases into an object file |
218-
| [toir.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/toir.d) | Convert Dsymbols intermediate representation |
219-
| [e2ir.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/e2ir.d) | Convert Expressions to intermediate representation |
220-
| [s2ir.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/s2ir.d) | Convert Statements to intermediate representation |
221-
| [stmtstate.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/stmtstate.d) | Used to help transform statement AST into flow graph |
222-
| [toctype.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/toctype.d) | Convert a D type to a type the back-end understands |
223-
| [tocsym.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/tocsym.d) | Convert a D symbol to a symbol the linker understands (with mangled name) |
224-
| [argtypes_x86.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/argtypes_x86.d) | Convert a D type into simple (register) types for the 32-bit x86 ABI |
225-
| [argtypes_sysv_x64.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/argtypes_sysv_x64.d) | 'argtypes' for the x86_64 System V ABI |
226-
| [argtypes_aarch64.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/argtypes_aarch64.d) | 'argtypes' for the AArch64 ABI |
227-
| [glue.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/glue.d) | Generate the object file for function declarations |
228-
| [gluelayer.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/gluelayer.d) | Declarations for back-end functions that the front-end invokes |
229-
| [todt.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/todt.d) | Convert initializers into structures that the back-end will add to the data segment |
230-
| [tocvdebug.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/tovcdebug.d) | Generate debug info in the CV4 debug format. |
231-
| [objc.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/objc.d) | Objective-C interfacing |
232-
| [objc_glue.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/objc_glue.d) | Glue code for Objective-C interop. |
224+
| [stmtstate.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/stmtstate.d) | Used to help transform statement AST into flow graph |
225+
| [objc.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/objc.d) | Objective-C interfacing |
226+
| [irgen/toobj.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/irgen/toobj.d) | Convert an AST that went through all semantic phases into an object file|
227+
| [irgen/toir.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/irgen/toir.d) | Convert Dsymbols intermediate representation |
228+
| [irgen/e2ir.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/irgen/e2ir.d) | Convert Expressions to intermediate representation |
229+
| [irgen/s2ir.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/irgen/s2ir.d) | Convert Statements to intermediate representation |
230+
| [irgen/toctype.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/irgen/toctype.d) | Convert a D type to a type the back-end understands |
231+
| [irgen/tocsym.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/irgen/tocsym.d) | Convert a D symbol to a symbol the linker understands (with mangled name) |
232+
| [irgen/package.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/irgen/package.d) | Generate the object file for function declarations |
233+
| [irgen/todt.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/irgen/todt.d) | Convert initializers into structures that the back-end will add to the data segment |
234+
| [irgen/tocvdebug.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/irgen/tovcdebug.d)| Generate debug info in the CV4 debug format. |
235+
| [irgen/objc.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/irgen/objc.d)| irgen code for Objective-C interop. |
233236

234237
**Name mangling**
235238

dmd/access.d

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import dmd.dmodule;
2020
import dmd.dscope;
2121
import dmd.dstruct;
2222
import dmd.dsymbol;
23+
import dmd.dsymbolsem : toAlias;
2324
import dmd.errors;
2425
import dmd.expression;
2526
import dmd.funcsem : overloadApply;

dmd/aggregate.d

Lines changed: 2 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@ import dmd.declaration;
2525
import dmd.dscope;
2626
import dmd.dstruct;
2727
import dmd.dsymbol;
28-
import dmd.dsymbolsem : dsymbolSemantic, determineSize, include;
2928
import dmd.dtemplate;
3029
import dmd.errors;
3130
import dmd.expression;
3231
import dmd.func;
33-
import dmd.globals;
3432
import dmd.hdrgen;
3533
import dmd.id;
3634
import dmd.identifier;
@@ -146,6 +144,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
146144
DtorDeclaration fieldDtor; /// function destructing (non-inherited) fields
147145

148146
Expression getRTInfo; /// pointer to GC info generated by object.RTInfo(this)
147+
Scope* rtInfoScope; /// scope to be used when evaluating getRTInfo
149148

150149
///
151150
Visibility visibility;
@@ -170,7 +169,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
170169
sc2.parent = this;
171170
sc2.inunion = isUnionDeclaration();
172171
sc2.visibility = Visibility(Visibility.Kind.public_);
173-
sc2.explicitVisibility = 0;
172+
sc2.explicitVisibility = false;
174173
sc2.aligndecl = null;
175174
sc2.userAttribDecl = null;
176175
sc2.namespace = null;
@@ -186,32 +185,6 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
186185
return fields.length - isNested() - (vthis2 !is null);
187186
}
188187

189-
override final uinteger_t size(Loc loc)
190-
{
191-
//printf("+AggregateDeclaration::size() %s, scope = %p, sizeok = %d\n", toChars(), _scope, sizeok);
192-
bool ok = determineSize(this, loc);
193-
//printf("-AggregateDeclaration::size() %s, scope = %p, sizeok = %d\n", toChars(), _scope, sizeok);
194-
return ok ? structsize : SIZE_INVALID;
195-
}
196-
197-
198-
override final Type getType()
199-
{
200-
/* Apply storage classes to forward references. (Issue 22254)
201-
* Note: Avoid interfaces for now. Implementing qualifiers on interface
202-
* definitions exposed some issues in their TypeInfo generation in DMD.
203-
* Related PR: https://github.com/dlang/dmd/pull/13312
204-
*/
205-
if (semanticRun == PASS.initial && !isInterfaceDeclaration())
206-
{
207-
auto stc = storage_class;
208-
if (_scope)
209-
stc |= _scope.stc;
210-
type = type.addSTC(stc);
211-
}
212-
return type;
213-
}
214-
215188
// is aggregate deprecated?
216189
override final bool isDeprecated() const
217190
{
@@ -381,39 +354,6 @@ version (IN_LLVM) {} else
381354
}
382355
}
383356

384-
/*********************************
385-
* Iterate this dsymbol or members of this scoped dsymbol, then
386-
* call `fp` with the found symbol and `params`.
387-
* Params:
388-
* symbol = the dsymbol or parent of members to call fp on
389-
* fp = function pointer to process the iterated symbol.
390-
* If it returns nonzero, the iteration will be aborted.
391-
* ctx = context parameter passed to fp.
392-
* Returns:
393-
* nonzero if the iteration is aborted by the return value of fp,
394-
* or 0 if it's completed.
395-
*/
396-
int apply(Dsymbol symbol, int function(Dsymbol, void*) fp, void* ctx)
397-
{
398-
if (auto nd = symbol.isNspace())
399-
{
400-
return nd.members.foreachDsymbol( (s) { return s && s.apply(fp, ctx); } );
401-
}
402-
if (auto ad = symbol.isAttribDeclaration())
403-
{
404-
return ad.include(ad._scope).foreachDsymbol( (s) { return s && s.apply(fp, ctx); } );
405-
}
406-
if (auto tm = symbol.isTemplateMixin())
407-
{
408-
if (tm._scope) // if fwd reference
409-
dsymbolSemantic(tm, null); // try to resolve it
410-
411-
return tm.members.foreachDsymbol( (s) { return s && s.apply(fp, ctx); } );
412-
}
413-
414-
return fp(symbol, ctx);
415-
}
416-
417357
/****************************
418358
* Do byte or word alignment as necessary.
419359
* Align sizes of 0, as we may not know array sizes yet.

dmd/aggregate.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ namespace dmd
4848
bool fill(StructDeclaration* sd, Loc loc, Expressions &elements, bool ctorinit);
4949
bool isFuncHidden(ClassDeclaration* cd, FuncDeclaration* fd);
5050
Dsymbol* vtblSymbol(ClassDeclaration *cd);
51+
bool fillVtbl(BaseClass *bc, ClassDeclaration *cd, FuncDeclarations *vtbl, int newinstance);
5152
}
5253

5354
enum class ClassKind : uint8_t
@@ -113,15 +114,14 @@ class AggregateDeclaration : public ScopeDsymbol
113114
DtorDeclaration *fieldDtor; // function destructing (non-inherited) fields
114115

115116
Expression *getRTInfo; // pointer to GC info generated by object.RTInfo(this)
117+
Scope* rtInfoScope; // scope to be used when evaluating getRTInfo
116118

117119
Visibility visibility;
118120
d_bool noDefaultCtor; // no default construction
119121
d_bool disableNew; // disallow allocations using `new`
120122
Sizeok sizeok; // set when structsize contains valid data
121123

122124
virtual Scope *newScope(Scope *sc);
123-
uinteger_t size(Loc loc) override final;
124-
Type *getType() override final;
125125
bool isDeprecated() const override final; // is aggregate deprecated?
126126
bool isNested() const;
127127
bool isExport() const override final;
@@ -173,7 +173,6 @@ class StructDeclaration : public AggregateDeclaration
173173
static StructDeclaration *create(Loc loc, Identifier *id, bool inObject);
174174
StructDeclaration *syntaxCopy(Dsymbol *s) override;
175175
const char *kind() const override;
176-
bool isPOD();
177176
bool zeroInit() const; // !=0 if initialize with 0 fill
178177
bool zeroInit(bool v);
179178
bool hasIdentityAssign() const; // true if has identity opAssign
@@ -198,7 +197,6 @@ class StructDeclaration : public AggregateDeclaration
198197

199198
unsigned numArgTypes() const;
200199
Type *argType(unsigned index);
201-
bool hasRegularCtor(bool ignoreDisabled = false);
202200
};
203201

204202
class UnionDeclaration final : public StructDeclaration
@@ -222,8 +220,6 @@ struct BaseClass
222220

223221
DArray<BaseClass> baseInterfaces; // if BaseClass is an interface, these
224222
// are a copy of the InterfaceDeclaration::interfaces
225-
226-
bool fillVtbl(ClassDeclaration *cd, FuncDeclarations *vtbl, int newinstance);
227223
};
228224

229225
struct ClassFlags
@@ -277,9 +273,6 @@ class ClassDeclaration : public AggregateDeclaration
277273
ThreeState isabstract; // if abstract class
278274
Baseok baseok; // set the progress of base classes resolving
279275
ObjcClassDeclaration objc; // Data for a class declaration that is needed for the Objective-C integration
280-
#if !IN_LLVM
281-
Symbol *cpp_type_info_ptr_sym; // cached instance of class Id.cpp_type_info_ptr
282-
#endif
283276

284277
static ClassDeclaration *create(Loc loc, Identifier *id, BaseClasses *baseclasses, Dsymbols *members, bool inObject);
285278
const char *toPrettyChars(bool QualifyTypes = false) override;

dmd/argtypes_aarch64.d

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
module dmd.argtypes_aarch64;
1313

1414
import dmd.astenums;
15+
import dmd.dsymbolsem : isPOD;
1516
import dmd.mtype;
1617
import dmd.typesem;
1718

dmd/argtypes_sysv_x64.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module dmd.argtypes_sysv_x64;
1313

1414
import dmd.astenums;
1515
import dmd.declaration;
16-
import dmd.globals;
16+
import dmd.dsymbolsem : isPOD;
1717
import dmd.mtype;
1818
import dmd.typesem;
1919
import dmd.target;

dmd/argtypes_x86.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import core.checkedint;
1616

1717
import dmd.astenums;
1818
import dmd.declaration;
19-
import dmd.globals;
19+
import dmd.dsymbolsem : isPOD;
2020
import dmd.location;
2121
import dmd.mtype;
2222
import dmd.typesem;
@@ -326,7 +326,7 @@ TypeTuple toArgTypes_x86(Type t)
326326
* nfields = number of fields in the aggregate (dimension for static arrays)
327327
* getFieldInfo = get information about the nth field in the aggregate
328328
*/
329-
extern (D) void aggregate(uinteger_t sz, size_t nfields, Type delegate(size_t, out uint, out uint) getFieldInfo)
329+
extern (D) void aggregate(ulong sz, size_t nfields, Type delegate(size_t, out uint, out uint) getFieldInfo)
330330
{
331331
if (nfields == 0)
332332
return memory();

dmd/arrayop.d

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import dmd.location;
3131
import dmd.mtype;
3232
import dmd.common.outbuffer;
3333
import dmd.tokens;
34+
import dmd.typesem : isAssignable;
3435
import dmd.visitor;
3536

3637
/**********************************************

0 commit comments

Comments
 (0)