Raymond Toy pushed to branch native-image at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/lisp/save.c
    ... ... @@ -409,6 +409,8 @@ save_executable(char *filename, lispobj init_function)
    409 409
      * handle the type value when printing out the assembly code.
    
    410 410
      */
    
    411 411
     static int (*asmtab[256])(lispobj* where, lispobj object, FILE* f);
    
    412
    +static char* asmtab_types[256];
    
    413
    +
    
    412 414
     
    
    413 415
     void
    
    414 416
     asm_label(lispobj* ptr, lispobj object, FILE* f) 
    
    ... ... @@ -460,7 +462,7 @@ asm_header_word(lispobj* ptr, lispobj object, FILE* f, const char* note)
    460 462
         unsigned long len = HeaderValue(object);
    
    461 463
         unsigned long type = TypeOf(object);
    
    462 464
         
    
    463
    -    fprintf(f, "\t.4byte\t0x%lx << 8 + %ld\t# %s\n", len, type, note);
    
    465
    +    fprintf(f, "\t.4byte\t0x%lx << 8 + %ld\t# %s\n", len, type, asmtab_types[type]);
    
    464 466
     }
    
    465 467
     
    
    466 468
         
    
    ... ... @@ -587,7 +589,23 @@ asm_simple_vector(lispobj* ptr, lispobj object, FILE* f)
    587 589
     int
    
    588 590
     asm_closure_header(lispobj* ptr, lispobj object, FILE* f)
    
    589 591
     {
    
    590
    -    return asm_boxed(ptr, object, f);
    
    592
    +    struct closure *closure;
    
    593
    +    int k;
    
    594
    +    int nwords = CEILING(1 + HeaderValue(object), 2);
    
    595
    +
    
    596
    +    closure = (struct closure *) ptr;
    
    597
    +
    
    598
    +    asm_label(ptr, object, f);
    
    599
    +    asm_header_word(ptr, object, f, "closure header");
    
    600
    +    fprintf(f, "\t.4byte\tL%08lx\n", closure->function);
    
    601
    +
    
    602
    +    nwords -= 2;
    
    603
    +    
    
    604
    +    for (k = 0; k < nwords; ++k) {
    
    605
    +        asm_lispobj(closure->info + k, closure->info[k], f);
    
    606
    +
    
    607
    +    }
    
    608
    +    return nwords;
    
    591 609
     }
    
    592 610
     
    
    593 611
     int
    
    ... ... @@ -1188,6 +1206,61 @@ init_asmtab(void)
    1188 1206
     {
    
    1189 1207
         int k = 0;
    
    1190 1208
     
    
    1209
    +    /* Initialize type labels */
    
    1210
    +    for (k = 0; k < 256; ++k) {
    
    1211
    +        asmtab_types[k] = "";
    
    1212
    +    }
    
    1213
    +
    
    1214
    +    asmtab_types[type_Bignum] = "Bignum";
    
    1215
    +    asmtab_types[type_Ratio] = "Ratio";
    
    1216
    +    asmtab_types[type_SingleFloat] = "SingleFloat";
    
    1217
    +    asmtab_types[type_DoubleFloat] = "DoubleFloat";
    
    1218
    +    asmtab_types[type_DoubleDoubleFloat] = "DoubleDoubleFloat";
    
    1219
    +    asmtab_types[type_Complex] = "Complex";
    
    1220
    +    asmtab_types[type_ComplexSingleFloat] = "ComplexSingleFloat";
    
    1221
    +    asmtab_types[type_ComplexDoubleFloat] = "ComplexDoubleFloat";
    
    1222
    +    asmtab_types[type_ComplexDoubleDoubleFloat] = "ComplexDoubleDoubleFloat";
    
    1223
    +    asmtab_types[type_SimpleArray] = "SimpleArray";
    
    1224
    +    asmtab_types[type_SimpleString] = "SimpleString";
    
    1225
    +    asmtab_types[type_SimpleBitVector] = "SimpleBitVector";
    
    1226
    +    asmtab_types[type_SimpleVector] = "SimpleVector";
    
    1227
    +    asmtab_types[type_SimpleArrayUnsignedByte2] = "SimpleArrayUnsignedByte2";
    
    1228
    +    asmtab_types[type_SimpleArrayUnsignedByte4] = "SimpleArrayUnsignedByte4";
    
    1229
    +    asmtab_types[type_SimpleArrayUnsignedByte8] = "SimpleArrayUnsignedByte8";
    
    1230
    +    asmtab_types[type_SimpleArrayUnsignedByte16] = "SimpleArrayUnsignedByte16";
    
    1231
    +    asmtab_types[type_SimpleArrayUnsignedByte32] = "SimpleArrayUnsignedByte32";
    
    1232
    +    asmtab_types[type_SimpleArraySignedByte8] = "SimpleArraySignedByte8";
    
    1233
    +    asmtab_types[type_SimpleArraySignedByte16] = "SimpleArraySignedByte16";
    
    1234
    +    asmtab_types[type_SimpleArraySignedByte30] = "SimpleArraySignedByte30";
    
    1235
    +    asmtab_types[type_SimpleArraySignedByte32] = "SimpleArraySignedByte32";
    
    1236
    +    asmtab_types[type_SimpleArraySingleFloat] = "SimpleArraySingleFloat";
    
    1237
    +    asmtab_types[type_SimpleArrayDoubleFloat] = "SimpleArrayDoubleFloat";
    
    1238
    +    asmtab_types[type_SimpleArrayDoubleDoubleFloat] = "SimpleArrayDoubleDoubleFloat";
    
    1239
    +    asmtab_types[type_SimpleArrayComplexSingleFloat] = "SimpleArrayComplexSingleFloat";
    
    1240
    +    asmtab_types[type_SimpleArrayComplexDoubleFloat] = "SimpleArrayComplexDoubleFloat";
    
    1241
    +    asmtab_types[type_SimpleArrayComplexDoubleDoubleFloat] = "SimpleArrayComplexDoubleDoubleFloat";
    
    1242
    +    asmtab_types[type_ComplexString] = "ComplexString";
    
    1243
    +    asmtab_types[type_ComplexBitVector] = "ComplexBitVector";
    
    1244
    +    asmtab_types[type_ComplexVector] = "ComplexVector";
    
    1245
    +    asmtab_types[type_ComplexArray] = "ComplexArray";
    
    1246
    +    asmtab_types[type_CodeHeader] = "CodeHeader";
    
    1247
    +    asmtab_types[type_FunctionHeader] = "FunctionHeader";
    
    1248
    +    asmtab_types[type_ClosureHeader] = "ClosureHeader";
    
    1249
    +    asmtab_types[type_FuncallableInstanceHeader] = "FuncallableInstanceHeader";
    
    1250
    +    asmtab_types[type_ByteCodeFunction] = "ByteCodeFunction";
    
    1251
    +    asmtab_types[type_ByteCodeClosure] = "ByteCodeClosure";
    
    1252
    +    asmtab_types[type_ClosureFunctionHeader] = "ClosureFunctionHeader";
    
    1253
    +    asmtab_types[type_ReturnPcHeader] = "ReturnPcHeader";
    
    1254
    +    asmtab_types[type_ValueCellHeader] = "ValueCellHeader";
    
    1255
    +    asmtab_types[type_SymbolHeader] = "SymbolHeader";
    
    1256
    +    asmtab_types[type_BaseChar] = "BaseChar";
    
    1257
    +    asmtab_types[type_Sap] = "Sap";
    
    1258
    +    asmtab_types[type_UnboundMarker] = "UnboundMarker";
    
    1259
    +    asmtab_types[type_WeakPointer] = "WeakPointer";
    
    1260
    +    asmtab_types[type_InstanceHeader] = "InstanceHeader";
    
    1261
    +    asmtab_types[type_Fdefn] = "Fdefn";
    
    1262
    +    asmtab_types[type_ScavengerHook] = "ScavengerHook";
    
    1263
    +    
    
    1191 1264
         for (k = 0; k < 256; ++k) {
    
    1192 1265
             asmtab[k] = asm_ni;
    
    1193 1266
         }