forked from ValeLang/Vale
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Array<M, V, E> is now Array<M, E>, all arrays are now varying. * Removed IFunction1 from builtins, its no longer needed by the compiler. * Removed RSA initialization like [vary *], now just use Array<...> * Thinking of using sugar for array lists, not arrays. Non-breaking changes: * Added push/pop support for arrays. * This means our array list no longer needs optionals! * Added .capacity() for arrays. * Removed RawArray, it doesn't fit anymore since all RSAs are varying. * Fixed kldc test * Added an error for the rune type solver * We can now destroy an RSA with `() = arr;` to mirror structs. * Moved drop_into into builtins
- Loading branch information
Showing
130 changed files
with
3,259 additions
and
918 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
Midas/src/c-compiler/function/expressions/newimmruntimesizearray.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#include <iostream> | ||
#include <region/common/common.h> | ||
#include "region/common/controlblock.h" | ||
#include "function/expressions/shared/elements.h" | ||
|
||
#include "translatetype.h" | ||
|
||
#include "function/expressions/shared/members.h" | ||
#include "function/expression.h" | ||
#include "function/expressions/shared/shared.h" | ||
#include "region/common/heap.h" | ||
|
||
Ref translateNewImmRuntimeSizedArray( | ||
GlobalState* globalState, | ||
FunctionState* functionState, | ||
BlockState* blockState, | ||
LLVMBuilderRef builder, | ||
NewImmRuntimeSizedArray* constructRuntimeSizedArray) { | ||
|
||
auto generatorType = constructRuntimeSizedArray->generatorType; | ||
auto generatorExpr = constructRuntimeSizedArray->generatorExpr; | ||
auto sizeKind = constructRuntimeSizedArray->sizeKind; | ||
auto sizeExpr = constructRuntimeSizedArray->sizeExpr; | ||
auto sizeType = constructRuntimeSizedArray->sizeType; | ||
auto elementType = constructRuntimeSizedArray->elementType; | ||
auto arrayRefType = constructRuntimeSizedArray->arrayRefType; | ||
|
||
auto runtimeSizedArrayMT = dynamic_cast<RuntimeSizedArrayT*>(constructRuntimeSizedArray->arrayRefType->kind); | ||
|
||
auto capacityRef = translateExpression(globalState, functionState, blockState, builder, sizeExpr); | ||
|
||
auto generatorRef = translateExpression(globalState, functionState, blockState, builder, generatorExpr); | ||
globalState->getRegion(generatorType)->checkValidReference(FL(), functionState, builder, | ||
generatorType, generatorRef); | ||
|
||
// If we get here, arrayLT is a pointer to our counted struct. | ||
auto rsaRef = | ||
globalState->getRegion(arrayRefType)->constructRuntimeSizedArray( | ||
makeEmptyTupleRef(globalState), | ||
functionState, | ||
builder, | ||
arrayRefType, | ||
runtimeSizedArrayMT, | ||
capacityRef, | ||
runtimeSizedArrayMT->name->name); | ||
buildFlare(FL(), globalState, functionState, builder); | ||
globalState->getRegion(arrayRefType)->checkValidReference(FL(), functionState, builder, | ||
arrayRefType, rsaRef); | ||
|
||
buildFlare(FL(), globalState, functionState, builder); | ||
fillRuntimeSizedArray( | ||
globalState, | ||
functionState, | ||
builder, | ||
arrayRefType, | ||
runtimeSizedArrayMT, | ||
elementType, | ||
generatorType, | ||
constructRuntimeSizedArray->generatorMethod, | ||
generatorRef, | ||
capacityRef, | ||
rsaRef);//getRuntimeSizedArrayContentsPtr(builder, rsaWrapperPtrLE)); | ||
buildFlare(FL(), globalState, functionState, builder); | ||
|
||
globalState->getRegion(sizeType)->dealias(AFL("ConstructRSA"), functionState, builder, sizeType, capacityRef); | ||
globalState->getRegion(generatorType)->dealias(AFL("ConstructRSA"), functionState, builder, generatorType, generatorRef); | ||
|
||
return rsaRef; | ||
} |
47 changes: 47 additions & 0 deletions
47
Midas/src/c-compiler/function/expressions/newmutruntimesizearray.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include <iostream> | ||
#include <region/common/common.h> | ||
#include "region/common/controlblock.h" | ||
#include "function/expressions/shared/elements.h" | ||
|
||
#include "translatetype.h" | ||
|
||
#include "function/expressions/shared/members.h" | ||
#include "function/expression.h" | ||
#include "function/expressions/shared/shared.h" | ||
#include "region/common/heap.h" | ||
|
||
Ref translateNewMutRuntimeSizedArray( | ||
GlobalState* globalState, | ||
FunctionState* functionState, | ||
BlockState* blockState, | ||
LLVMBuilderRef builder, | ||
NewMutRuntimeSizedArray* constructRuntimeSizedArray) { | ||
|
||
auto sizeKind = constructRuntimeSizedArray->sizeKind; | ||
auto sizeExpr = constructRuntimeSizedArray->sizeExpr; | ||
auto sizeType = constructRuntimeSizedArray->sizeType; | ||
auto elementType = constructRuntimeSizedArray->elementType; | ||
auto arrayRefType = constructRuntimeSizedArray->arrayRefType; | ||
|
||
auto runtimeSizedArrayMT = dynamic_cast<RuntimeSizedArrayT*>(constructRuntimeSizedArray->arrayRefType->kind); | ||
|
||
auto capacityRef = translateExpression(globalState, functionState, blockState, builder, sizeExpr); | ||
|
||
// If we get here, arrayLT is a pointer to our counted struct. | ||
auto rsaRef = | ||
globalState->getRegion(arrayRefType)->constructRuntimeSizedArray( | ||
makeEmptyTupleRef(globalState), | ||
functionState, | ||
builder, | ||
arrayRefType, | ||
runtimeSizedArrayMT, | ||
capacityRef, | ||
runtimeSizedArrayMT->name->name); | ||
buildFlare(FL(), globalState, functionState, builder); | ||
globalState->getRegion(arrayRefType)->checkValidReference(FL(), functionState, builder, | ||
arrayRefType, rsaRef); | ||
|
||
globalState->getRegion(sizeType)->dealias(AFL("ConstructRSA"), functionState, builder, sizeType, capacityRef); | ||
|
||
return rsaRef; | ||
} |
Oops, something went wrong.