mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-18 16:51:51 +03:00
[RefC] Erase the World (not a fantasy things)
This commit is contained in:
parent
d34cf62611
commit
cabc7abebe
@ -138,7 +138,7 @@ cPrimType Bits64Type = "Bits64"
|
|||||||
cPrimType StringType = "string"
|
cPrimType StringType = "string"
|
||||||
cPrimType CharType = "char"
|
cPrimType CharType = "char"
|
||||||
cPrimType DoubleType = "double"
|
cPrimType DoubleType = "double"
|
||||||
cPrimType WorldType = "f32"
|
cPrimType WorldType = "void"
|
||||||
|
|
||||||
cConstant : Constant -> String
|
cConstant : Constant -> String
|
||||||
cConstant (I x) = "(Value*)makeInt64("++ showIntMin x ++")"
|
cConstant (I x) = "(Value*)makeInt64("++ showIntMin x ++")"
|
||||||
@ -155,7 +155,7 @@ cConstant (Db x) = "(Value*)makeDouble("++ show x ++")"
|
|||||||
cConstant (Ch x) = "(Value*)makeChar("++ escapeChar x ++")"
|
cConstant (Ch x) = "(Value*)makeChar("++ escapeChar x ++")"
|
||||||
cConstant (Str x) = "(Value*)makeString("++ cStringQuoted x ++")"
|
cConstant (Str x) = "(Value*)makeString("++ cStringQuoted x ++")"
|
||||||
cConstant (PrT t) = cPrimType t
|
cConstant (PrT t) = cPrimType t
|
||||||
cConstant WorldVal = "(Value*)makeWorld()"
|
cConstant WorldVal = "(Value*)NULL"
|
||||||
|
|
||||||
extractConstant : Constant -> String
|
extractConstant : Constant -> String
|
||||||
extractConstant (I x) = show x
|
extractConstant (I x) = show x
|
||||||
@ -803,7 +803,7 @@ extractValue _ CFPtr varName = "((Value_Pointer*)" ++ varName ++ ")->
|
|||||||
extractValue _ CFGCPtr varName = "((Value_GCPointer*)" ++ varName ++ ")->p->p"
|
extractValue _ CFGCPtr varName = "((Value_GCPointer*)" ++ varName ++ ")->p->p"
|
||||||
extractValue CLangC CFBuffer varName = "((Value_Buffer*)" ++ varName ++ ")->buffer->data"
|
extractValue CLangC CFBuffer varName = "((Value_Buffer*)" ++ varName ++ ")->buffer->data"
|
||||||
extractValue CLangRefC CFBuffer varName = "((Value_Buffer*)" ++ varName ++ ")->buffer"
|
extractValue CLangRefC CFBuffer varName = "((Value_Buffer*)" ++ varName ++ ")->buffer"
|
||||||
extractValue _ CFWorld varName = "(Value_World*)" ++ varName
|
extractValue _ CFWorld _ = "(Value *)NULL"
|
||||||
extractValue _ (CFFun x y) varName = "(Value_Closure*)" ++ varName
|
extractValue _ (CFFun x y) varName = "(Value_Closure*)" ++ varName
|
||||||
extractValue c (CFIORes x) varName = extractValue c x varName
|
extractValue c (CFIORes x) varName = extractValue c x varName
|
||||||
extractValue _ (CFStruct x xs) varName = assert_total $ idris_crash ("INTERNAL ERROR: Struct access not implemented: " ++ varName)
|
extractValue _ (CFStruct x xs) varName = assert_total $ idris_crash ("INTERNAL ERROR: Struct access not implemented: " ++ varName)
|
||||||
@ -828,7 +828,7 @@ packCFType CFChar varName = "makeChar(" ++ varName ++ ")"
|
|||||||
packCFType CFPtr varName = "makePointer(" ++ varName ++ ")"
|
packCFType CFPtr varName = "makePointer(" ++ varName ++ ")"
|
||||||
packCFType CFGCPtr varName = "makePointer(" ++ varName ++ ")"
|
packCFType CFGCPtr varName = "makePointer(" ++ varName ++ ")"
|
||||||
packCFType CFBuffer varName = "makeBuffer(" ++ varName ++ ")"
|
packCFType CFBuffer varName = "makeBuffer(" ++ varName ++ ")"
|
||||||
packCFType CFWorld varName = "makeWorld(" ++ varName ++ ")"
|
packCFType CFWorld _ = "(Value *)NULL"
|
||||||
packCFType (CFFun x y) varName = "makeFunction(" ++ varName ++ ")"
|
packCFType (CFFun x y) varName = "makeFunction(" ++ varName ++ ")"
|
||||||
packCFType (CFIORes x) varName = packCFType x varName
|
packCFType (CFIORes x) varName = packCFType x varName
|
||||||
packCFType (CFStruct x xs) varName = "makeStruct(" ++ varName ++ ")"
|
packCFType (CFStruct x xs) varName = "makeStruct(" ++ varName ++ ")"
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
#define CONDITION_TAG 31
|
#define CONDITION_TAG 31
|
||||||
|
|
||||||
#define COMPLETE_CLOSURE_TAG 98 // for trampoline tail recursion handling
|
#define COMPLETE_CLOSURE_TAG 98 // for trampoline tail recursion handling
|
||||||
#define WORLD_TAG 99
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int refCounter;
|
int refCounter;
|
||||||
@ -176,8 +175,3 @@ typedef struct {
|
|||||||
int filled;
|
int filled;
|
||||||
int total;
|
int total;
|
||||||
} IORef_Storage;
|
} IORef_Storage;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
Value_header header;
|
|
||||||
IORef_Storage *listIORefs;
|
|
||||||
} Value_World;
|
|
||||||
|
@ -177,12 +177,6 @@ Value_Array *makeArray(int length) {
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value_World *makeWorld() {
|
|
||||||
Value_World *retVal = IDRIS2_NEW_VALUE(Value_World);
|
|
||||||
retVal->header.tag = WORLD_TAG;
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
Value *newReference(Value *source) {
|
Value *newReference(Value *source) {
|
||||||
// note that we explicitly allow NULL as source (for erased arguments)
|
// note that we explicitly allow NULL as source (for erased arguments)
|
||||||
if (source) {
|
if (source) {
|
||||||
@ -291,9 +285,6 @@ void removeReference(Value *elem) {
|
|||||||
removeReference((Value *)vPtr->p);
|
removeReference((Value *)vPtr->p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WORLD_TAG:
|
|
||||||
/* nothing to delete, added for sake of completeness */
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -34,4 +34,3 @@ Value_Pointer *makePointer(void *);
|
|||||||
Value_GCPointer *makeGCPointer(void *ptr_Raw, Value_Closure *onCollectFct);
|
Value_GCPointer *makeGCPointer(void *ptr_Raw, Value_Closure *onCollectFct);
|
||||||
Value_Buffer *makeBuffer(void *buf);
|
Value_Buffer *makeBuffer(void *buf);
|
||||||
Value_Array *makeArray(int length);
|
Value_Array *makeArray(int length);
|
||||||
Value_World *makeWorld(void);
|
|
||||||
|
Loading…
Reference in New Issue
Block a user