[RefC] Erase the World (not a fantasy things)

This commit is contained in:
HIROKI, Hattori 2024-01-21 19:34:05 +09:00
parent d34cf62611
commit cabc7abebe
4 changed files with 4 additions and 20 deletions

View File

@ -138,7 +138,7 @@ cPrimType Bits64Type = "Bits64"
cPrimType StringType = "string"
cPrimType CharType = "char"
cPrimType DoubleType = "double"
cPrimType WorldType = "f32"
cPrimType WorldType = "void"
cConstant : Constant -> String
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 (Str x) = "(Value*)makeString("++ cStringQuoted x ++")"
cConstant (PrT t) = cPrimType t
cConstant WorldVal = "(Value*)makeWorld()"
cConstant WorldVal = "(Value*)NULL"
extractConstant : Constant -> String
extractConstant (I x) = show x
@ -803,7 +803,7 @@ extractValue _ CFPtr varName = "((Value_Pointer*)" ++ varName ++ ")->
extractValue _ CFGCPtr varName = "((Value_GCPointer*)" ++ varName ++ ")->p->p"
extractValue CLangC CFBuffer varName = "((Value_Buffer*)" ++ varName ++ ")->buffer->data"
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 c (CFIORes x) varName = extractValue c x 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 CFGCPtr varName = "makePointer(" ++ varName ++ ")"
packCFType CFBuffer varName = "makeBuffer(" ++ varName ++ ")"
packCFType CFWorld varName = "makeWorld(" ++ varName ++ ")"
packCFType CFWorld _ = "(Value *)NULL"
packCFType (CFFun x y) varName = "makeFunction(" ++ varName ++ ")"
packCFType (CFIORes x) varName = packCFType x varName
packCFType (CFStruct x xs) varName = "makeStruct(" ++ varName ++ ")"

View File

@ -37,7 +37,6 @@
#define CONDITION_TAG 31
#define COMPLETE_CLOSURE_TAG 98 // for trampoline tail recursion handling
#define WORLD_TAG 99
typedef struct {
int refCounter;
@ -176,8 +175,3 @@ typedef struct {
int filled;
int total;
} IORef_Storage;
typedef struct {
Value_header header;
IORef_Storage *listIORefs;
} Value_World;

View File

@ -177,12 +177,6 @@ Value_Array *makeArray(int length) {
return a;
}
Value_World *makeWorld() {
Value_World *retVal = IDRIS2_NEW_VALUE(Value_World);
retVal->header.tag = WORLD_TAG;
return retVal;
}
Value *newReference(Value *source) {
// note that we explicitly allow NULL as source (for erased arguments)
if (source) {
@ -291,9 +285,6 @@ void removeReference(Value *elem) {
removeReference((Value *)vPtr->p);
break;
}
case WORLD_TAG:
/* nothing to delete, added for sake of completeness */
break;
default:
break;

View File

@ -34,4 +34,3 @@ Value_Pointer *makePointer(void *);
Value_GCPointer *makeGCPointer(void *ptr_Raw, Value_Closure *onCollectFct);
Value_Buffer *makeBuffer(void *buf);
Value_Array *makeArray(int length);
Value_World *makeWorld(void);