Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[For review] New ctfe #6186

Merged
merged 164 commits into from
Dec 30, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
4bb9ea9
add todo
UplinkCoder Nov 28, 2016
7b01b36
use the blockExit visitor for switch-statements
UplinkCoder Nov 29, 2016
96559b3
delete dysfunctional callExp code
UplinkCoder Nov 29, 2016
8150aa4
this should have fixed our break continue bug ... potentially
UplinkCoder Nov 29, 2016
0599cae
defened against non-senseical situations
UplinkCoder Nov 29, 2016
3cf929b
fix typo
UplinkCoder Nov 29, 2016
3b85a78
Fix break continue and goto handling
UplinkCoder Nov 29, 2016
f2a77ed
Support integral asserts
UplinkCoder Nov 30, 2016
1cb3898
fixes
UplinkCoder Dec 1, 2016
73ccf42
cleaup and bailout on void initialisation
UplinkCoder Dec 2, 2016
dad8294
get ready for structs
UplinkCoder Dec 3, 2016
335d35b
fixing
UplinkCoder Dec 3, 2016
0f25fac
fix performance issue setting the whole array instead of just the fir…
UplinkCoder Dec 3, 2016
f73a291
one step closer to working structs
UplinkCoder Dec 3, 2016
48b3fed
maake struct literals work again
UplinkCoder Dec 3, 2016
d66d35e
dfmt
UplinkCoder Dec 3, 2016
f1079bb
make struct literal returns work
UplinkCoder Dec 3, 2016
89e0273
getSliceIndex to actually safe the slice type
UplinkCoder Dec 3, 2016
988892c
add important commnet
UplinkCoder Dec 4, 2016
76fe32a
begin solving the inifinte loop problem
UplinkCoder Dec 4, 2016
7761edd
another step to proper handling of infinite loops
UplinkCoder Dec 4, 2016
ddda64e
more work on inifnite loops
UplinkCoder Dec 4, 2016
f9552ab
work on while (true) and for(;true;)
UplinkCoder Dec 4, 2016
ce54b14
add comment
UplinkCoder Dec 5, 2016
46e49db
fix if(true) and if(false)
UplinkCoder Dec 5, 2016
a410083
modify IntegerExp handling to make sure we cast small enough constant…
UplinkCoder Dec 5, 2016
fb3be9d
better void handling
UplinkCoder Dec 5, 2016
b51ac05
PREF FIX!
UplinkCoder Dec 5, 2016
7ce15f4
further fix perf
UplinkCoder Dec 5, 2016
cadfcd1
use static TypeVisitor
UplinkCoder Dec 6, 2016
de1aca2
use bytecode cache
UplinkCoder Dec 6, 2016
9e54d90
improve cache to not use an BCV when it is a cached function
UplinkCoder Dec 6, 2016
865d981
remove rmem dependency from bytecode stuff
UplinkCoder Dec 6, 2016
e1933e3
make cacheBC a compiltime parameter
UplinkCoder Dec 6, 2016
c843873
remove some dead code and get rid of phobos dependencies
UplinkCoder Dec 6, 2016
a85d610
mark literals as ownedByCtfe
UplinkCoder Dec 6, 2016
d24f5ba
perpare for fixing the for-loop continues
UplinkCoder Dec 6, 2016
0b3340c
safe the pointerTypePointer
UplinkCoder Dec 7, 2016
5a7cf98
correct behavior of Initialize and prepare for another perf-fix
UplinkCoder Dec 7, 2016
2a18765
reformat
UplinkCoder Dec 7, 2016
d849ef0
make structLiteralCreation a bit more robust
UplinkCoder Dec 7, 2016
55a934b
a little perf fixing
UplinkCoder Dec 7, 2016
5cd7d04
change continue handling and reformat
UplinkCoder Dec 7, 2016
be738b1
use new handling in infiniteLoop
UplinkCoder Dec 8, 2016
4a25045
remove outdated and wrong comment
UplinkCoder Dec 8, 2016
a7e013f
get ready for more informative errors
UplinkCoder Dec 8, 2016
4a80db2
more work an more informative errors
UplinkCoder Dec 8, 2016
b985732
more work on erros
UplinkCoder Dec 8, 2016
1a882fd
pass the error values through
UplinkCoder Dec 8, 2016
982d568
more prepareations
UplinkCoder Dec 8, 2016
4b26541
fixing
UplinkCoder Dec 8, 2016
8c921d4
perf fix: use static BCV
UplinkCoder Dec 8, 2016
aa29bd5
ldmd fixes
UplinkCoder Dec 8, 2016
6a077d9
small perf optimisation
UplinkCoder Dec 8, 2016
494e20b
reformat
UplinkCoder Dec 9, 2016
b083ff4
fixes
UplinkCoder Dec 9, 2016
48ec61c
prepare for functionCalls
UplinkCoder Dec 9, 2016
cfa8d79
more work and calls and remove dead code
UplinkCoder Dec 9, 2016
0a62276
add more benchmarking and an important comment
UplinkCoder Dec 9, 2016
9477cf5
print interpretation stats
UplinkCoder Dec 9, 2016
ccfeaa7
32bit fix
UplinkCoder Dec 9, 2016
0d1b772
add comment
UplinkCoder Dec 9, 2016
24ef231
make error system work
UplinkCoder Dec 9, 2016
d513a59
fix multiple functions in printer
UplinkCoder Dec 9, 2016
1172536
change bc to be stand-alone again if not copiled within dmd
UplinkCoder Dec 9, 2016
0127a9d
add important fixme!
UplinkCoder Dec 9, 2016
6d13a71
some work on functions
UplinkCoder Dec 10, 2016
ad21381
some work on functions (2)
UplinkCoder Dec 10, 2016
ca1282c
function are closer to working then ever before :)
UplinkCoder Dec 10, 2016
3d2f7c3
remember to clear state before working on a new function
UplinkCoder Dec 10, 2016
3899b4f
temporary fix
UplinkCoder Dec 10, 2016
6979ae5
fx
UplinkCoder Dec 10, 2016
ba5d561
hackish fix
UplinkCoder Dec 10, 2016
c5727ec
some work still buggy though
UplinkCoder Dec 10, 2016
348e9c9
work on bcFunctions
UplinkCoder Dec 10, 2016
0418284
fix backends that do not support bcfunctions
UplinkCoder Dec 10, 2016
c645fd0
fix nast math bug!
UplinkCoder Dec 10, 2016
ca8ca9e
add another important note
UplinkCoder Dec 10, 2016
c3ae044
IfStatement optimisation
UplinkCoder Dec 11, 2016
a46676c
hunt down antother performance hog
UplinkCoder Dec 11, 2016
c1d6d96
Revert "IfStatement optimisation"
UplinkCoder Dec 11, 2016
bfd920a
use switchStates = void
UplinkCoder Dec 11, 2016
345fb4a
fix bad typo
UplinkCoder Dec 11, 2016
c860e97
fix the bailout
UplinkCoder Dec 11, 2016
60646d8
fix the bailout-fix
UplinkCoder Dec 11, 2016
7b5409b
add important comment
UplinkCoder Dec 11, 2016
b53f699
don't reallocate the heap all the time ... ti makes for cache misses
UplinkCoder Dec 11, 2016
15cb704
interpreter perf fix and call preperation
UplinkCoder Dec 11, 2016
8d5843e
src/bc_macro.d
UplinkCoder Dec 12, 2016
b8569d9
prepare for interpreter optimisation
UplinkCoder Dec 12, 2016
0cbf8b2
make the blacklisting cheaper
UplinkCoder Dec 12, 2016
534e6cb
fix blacklisting
UplinkCoder Dec 12, 2016
ffd6804
style-fix
UplinkCoder Dec 12, 2016
4150ae3
remove old currentBlock concept
UplinkCoder Dec 12, 2016
fa06c97
Fix Labled for and foreach
UplinkCoder Dec 12, 2016
7a9b78a
remove fixme
UplinkCoder Dec 12, 2016
8b056f6
reformat
UplinkCoder Dec 12, 2016
0799760
Every array-foreach get's lowered to calling opSlice awww
UplinkCoder Dec 13, 2016
d158ab6
fixing bug in arrays
UplinkCoder Dec 13, 2016
93fc175
more prepareing for functionCalls
UplinkCoder Dec 13, 2016
4e7f942
Fix llvm backend
UplinkCoder Dec 13, 2016
047ccdf
remove build error message for now
UplinkCoder Dec 13, 2016
b1fd78a
call semantic3
UplinkCoder Dec 13, 2016
bc09db4
fix fnIdx usage
UplinkCoder Dec 13, 2016
6ed3f0f
fixing
UplinkCoder Dec 13, 2016
a41746e
remove mod4
UplinkCoder Dec 14, 2016
1f9b540
more fixing
UplinkCoder Dec 13, 2016
cc45b65
fix druntime tests
UplinkCoder Dec 13, 2016
1096f87
introduce the imm32 shorthand
UplinkCoder Dec 13, 2016
cb6a77f
fixes to build druntime
UplinkCoder Dec 14, 2016
96932cf
fixing bailout
UplinkCoder Dec 14, 2016
4e5af05
fix bug where strings would be treated as i32s
UplinkCoder Dec 14, 2016
e19f677
fix printer
UplinkCoder Dec 14, 2016
08dce9b
reformat add more bailouts and and various fixes
UplinkCoder Dec 14, 2016
2b13fa6
fixing off-by-one error
UplinkCoder Dec 14, 2016
bb68a6b
fixing array and slice index accsess
UplinkCoder Dec 14, 2016
9b51a77
fixing array and slice index accsess
UplinkCoder Dec 14, 2016
520caa2
fix lhs immidiates and ArrayBounds-checks
UplinkCoder Dec 14, 2016
d0b751c
fixing non-argument array-literals
UplinkCoder Dec 15, 2016
f9cdecb
fix fixups
UplinkCoder Dec 15, 2016
50de890
add version (ctfe_noboundscheck)
UplinkCoder Dec 15, 2016
33dbf5a
phobos compiletime tests passing!
UplinkCoder Dec 15, 2016
0ce0411
fix regression partially
UplinkCoder Dec 16, 2016
20bd077
begin to fix infinite recursion in the typeVistor
UplinkCoder Dec 16, 2016
8af6305
add FIXMEs
UplinkCoder Dec 17, 2016
7a884ff
apply perf fix
UplinkCoder Dec 17, 2016
dfead0c
comment
UplinkCoder Dec 17, 2016
26d78e5
Add StrEq3() instruction to bytecode
UplinkCoder Dec 17, 2016
7745218
remove a few bailouts
UplinkCoder Dec 17, 2016
76f1bdb
fix off by one error and make struct supported again
UplinkCoder Dec 17, 2016
242cab8
get ready for StrCat3
UplinkCoder Dec 17, 2016
886d47b
some work on strcat again
UplinkCoder Dec 17, 2016
1d10f2c
cleanup and dfmt
UplinkCoder Dec 18, 2016
0147ee0
prepare for more complex tpes
UplinkCoder Dec 18, 2016
978f9aa
fix
UplinkCoder Dec 18, 2016
dc35225
Small correction of code that was not tested
UplinkCoder Dec 18, 2016
07c99a4
get ready for scopes (we just need to handle gotos correctly)
UplinkCoder Dec 19, 2016
bf055a1
various changes
UplinkCoder Dec 20, 2016
4e2c7f1
fix
UplinkCoder Dec 21, 2016
dd07541
variuous bugfixes
UplinkCoder Dec 21, 2016
82eaa85
whitespace fixes
UplinkCoder Dec 21, 2016
a06c973
fix
UplinkCoder Dec 21, 2016
c9be28d
small perf fix and reformat
UplinkCoder Dec 21, 2016
7080d0f
add missing break
UplinkCoder Dec 21, 2016
271e9eb
implement very basic pointer supprt
UplinkCoder Dec 22, 2016
6dd9926
Do a nullPtrCheck on loads and stores
UplinkCoder Dec 22, 2016
21eac2c
fix issues found during unittests
UplinkCoder Dec 22, 2016
f965e59
fix segfault
UplinkCoder Dec 22, 2016
6cfa932
remove handling of the indirect flag
UplinkCoder Dec 22, 2016
935f818
compact code
UplinkCoder Dec 22, 2016
f1fb796
handle empty strings again
UplinkCoder Dec 23, 2016
03ccfb8
fix empty string handling and remove dead code
UplinkCoder Dec 23, 2016
3f1e9f8
support global ctfe variables
UplinkCoder Dec 23, 2016
10b63d9
fx
UplinkCoder Dec 23, 2016
904116e
Work on && support
UplinkCoder Dec 24, 2016
968fb58
fix bug and enable 64bit return-vales
UplinkCoder Dec 24, 2016
5d86ca3
small step towards fixing array literals
UplinkCoder Dec 25, 2016
8cc1117
32bit fixes
UplinkCoder Dec 26, 2016
d3d3179
some work towards static immutable array variable handling
UplinkCoder Dec 27, 2016
1e11d0f
add experimental code back in
UplinkCoder Dec 27, 2016
33ec389
temoprarily add asttypename.d
UplinkCoder Dec 27, 2016
53b4c45
fix druntime unittests
UplinkCoder Dec 27, 2016
88c5739
tmpfix
UplinkCoder Dec 27, 2016
144ef57
some work on bug in cast-exp
UplinkCoder Dec 29, 2016
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
Prev Previous commit
Next Next commit
phobos compiletime tests passing!
  • Loading branch information
UplinkCoder committed Dec 15, 2016
commit 33dbf5aee7d42b1929fd62ef176bd299c4da8ac5
47 changes: 40 additions & 7 deletions src/ctfe_bc.d
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct BlackList

bool isInitialized() pure const
{
return list[0]!is Identifier.init;
return list[0] !is Identifier.init;
}

Identifier[32] list;
Expand Down Expand Up @@ -117,7 +117,8 @@ struct BlackList
{
initialize([ /*"_ArrayEq",*/ "isRooted", "__lambda2", "isSameLength", "bug4910",
"wrapperParameters", "defaultMatrix", "extSeparatorPos", "args",
"check", "hashOf", "allAreAcceptedUnits", "back", "front", "generateFunction"]);
"check", "hashOf", "allAreAcceptedUnits", "back", "front", "generateFunction",
"parseJSON"]);
}

}
Expand Down Expand Up @@ -526,7 +527,11 @@ struct BCStruct
if (idx == -1)
return -1;

assert(idx < memberTypeCount);
debug (ctfe)
assert(idx < memberTypeCount);
else
if (idx < memberTypeCount)
return -1;

foreach (t; memberTypes[0 .. idx])
{
Expand Down Expand Up @@ -1075,7 +1080,11 @@ extern (C++) final class BCTypeVisitor : Visitor

foreach (sMember; sd.fields)
{
st.addField(&_sharedCtfeState, toBCType(sMember.type));
if(sMember.type.ty == Tstruct && (cast(TypeStruct)sMember.type).sym == sd)
assert(0);

auto bcType = toBCType(sMember.type);
st.addField(&_sharedCtfeState, bcType);
}

sharedCtfeState.endStruct(st);
Expand Down Expand Up @@ -2116,6 +2125,13 @@ public:
return;
}
int offset = _struct.offset(fIndex);
if (offset == -1)
{
debug (ctfe)
assert(0, "Could not get field-offset of" ~ vd.toString);
else
return;
}
assert(offset != -1);

debug (ctfe)
Expand All @@ -2129,7 +2145,15 @@ public:
BCType(BCTypeEnum.i32));

auto lhs = genExpr(dve.e1);
assert(lhs.type == BCTypeEnum.Struct);
if (lhs.type != BCTypeEnum.Struct)
{
bailout();
debug(ctfe)
assert(0, "lhs.type != Struct but: " ~ to!string(lhs.type.type) ~ " " ~ dve.e1.toString);
else
return ;
}


if (!(lhs.vType == BCValueType.StackValue
|| lhs.vType == BCValueType.Parameter || lhs.vType == BCValueType.Temporary))
Expand Down Expand Up @@ -2819,14 +2843,23 @@ public:
writefln("StringExp %s", se.toString);
}

if (se.sz < 1 || se.string[se.len] != 0)
if (!se || se.sz > 1/* || se.string[se.len] != 0*/)
{
debug (ctfe)
assert(0, "only zero terminated char strings are supported for now");
bailout();
return;
//assert(se.string[se.len] == '\0', "string should be 0-terminated");
}
if (!se.len)
{
debug(ctfe)
{
assert(0, "length-0 StringExp encontered, What do I do ?");
}
bailout();
return ;
}
auto stringAddr = _sharedCtfeState.heap.pushString(se.string, cast(uint) se.len);
auto stringAddrValue = imm32(stringAddr.addr);
if (insideArgumentProcessing)
Expand Down Expand Up @@ -3597,7 +3630,7 @@ public:
override void visit(CallExp ce)
{
bailout();

return ;
FuncDeclaration fd;
BCValue[] bc_args;
bc_args.length = ce.arguments.dim;
Expand Down
2 changes: 1 addition & 1 deletion src/dinterpret.d
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ extern (C++) Expression interpret(FuncDeclaration fd, InterState* istate, Expres
ctfeCompile(fd);

// try bc-evaluator if the interpreter has not already begun
if (!istate && !thisarg /*&& global.params.bc_ctfe*/)
if (!istate && !thisarg && !fd.vthis/*&& global.params.bc_ctfe*/)
{
import ddmd.ctfe.ctfe_bc;
if (auto e = evaluateFunction(fd, arguments, thisarg))
Expand Down