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

Commits:

1 changed file:

Changes:

  • src/lisp/save.c
    ... ... @@ -438,6 +438,15 @@ asm_header_word(lispobj* ptr, lispobj object, FILE* f)
    438 438
     }
    
    439 439
     
    
    440 440
         
    
    441
    +int
    
    442
    +asm_ni(lispobj* ptr, lispobj object, FILE* f)
    
    443
    +{
    
    444
    +    asm_label(ptr, object, f);
    
    445
    +    fprintf(f, "\t.4byte\t0x%lx\t# NOT IMPLEMENTED\n",
    
    446
    +            object);
    
    447
    +    return 1;
    
    448
    +}
    
    449
    +
    
    441 450
     /*
    
    442 451
      * Handles all objects that consists of only of lispobjs
    
    443 452
      */
    
    ... ... @@ -476,51 +485,35 @@ asm_list_pointer(lispobj* ptr, lispobj object, FILE* f)
    476 485
         asm_label(ptr, object, f);
    
    477 486
     
    
    478 487
         asm_lispobj(ptr, object, f);
    
    479
    -    asm_lispobj(ptr + 1, ptr[1], f);
    
    480 488
     
    
    481
    -    return 2;
    
    489
    +    return 1;
    
    482 490
     }
    
    483 491
     
    
    484 492
     int
    
    485 493
     asm_function_pointer(lispobj* ptr, lispobj object, FILE* f)
    
    486 494
     {
    
    487
    -    int k;
    
    488
    -    int len = HeaderValue(object);
    
    495
    +    printf("function pointer 0x%lx\n", object);
    
    489 496
         
    
    490 497
         asm_label(ptr, object, f);
    
    491
    -    for (k = 0; k < 6; ++k) {
    
    492
    -        asm_lispobj(ptr, *ptr, f);
    
    493
    -        ++ptr;
    
    494
    -    }
    
    495
    -    fprintf(f, "# function code\n");
    
    496
    -
    
    497
    -    unsigned char *c = (unsigned char*) ptr;
    
    498
    -    
    
    499
    -    for (k = 0; k < len - 5*4; ++k) {
    
    500
    -        fprintf(f, "\t.byte\t0x%x\n", *c++);
    
    501
    -    }
    
    502
    -
    
    503
    -    return len + 1;
    
    498
    +    asm_lispobj(ptr, object, f);
    
    499
    +    return 1;
    
    504 500
     }
    
    505 501
     
    
    506 502
     
    
    507 503
     int
    
    508 504
     asm_other_pointer(lispobj* ptr, lispobj object, FILE* f)
    
    509 505
     {
    
    510
    -    int len;
    
    511
    -    
    
    512 506
         asm_label(ptr, object, f);
    
    513 507
         asm_lispobj(ptr, object, f);
    
    514
    -    len = asmtab[TypeOf(ptr[1])](ptr + 1, ptr[1], f);
    
    515
    -    return len + 1;
    
    508
    +    return 1;
    
    516 509
     }
    
    517 510
     
    
    518 511
     int
    
    519 512
     asm_fdefn(lispobj* ptr, lispobj object, FILE* f)
    
    520 513
     {
    
    521
    -    asm_label(ptr, *ptr, f);
    
    514
    +    asm_label(ptr, object, f);
    
    522 515
         
    
    523
    -    asm_header_word(ptr, *ptr, f);
    
    516
    +    asm_header_word(ptr, object, f);
    
    524 517
         asm_lispobj(ptr + 1, ptr[1], f);
    
    525 518
         asm_lispobj(ptr + 2, ptr[2], f);
    
    526 519
     
    
    ... ... @@ -529,6 +522,43 @@ asm_fdefn(lispobj* ptr, lispobj object, FILE* f)
    529 522
         return 4;
    
    530 523
     }
    
    531 524
     
    
    525
    +int
    
    526
    +asm_instance_pointer(lispobj* ptr, lispobj object, FILE* f)
    
    527
    +{
    
    528
    +    asm_label(ptr, object, f);
    
    529
    +    asm_lispobj(ptr, object, f);
    
    530
    +    return 1;
    
    531
    +}
    
    532
    +
    
    533
    +int
    
    534
    +asm_simple_vector(lispobj* ptr, lispobj object, FILE* f)
    
    535
    +{
    
    536
    +    int k;
    
    537
    +    int len = ptr[1] >> 2;
    
    538
    +    lispobj* data = ptr + 2;
    
    539
    +    
    
    540
    +    asm_label(ptr, object, f);
    
    541
    +    asm_header_word(ptr, object, f);
    
    542
    +    asm_lispobj(ptr + 1, ptr[1], f);
    
    543
    +
    
    544
    +    for (k = 0; k < len; ++k) {
    
    545
    +        asm_lispobj(data + k,  data[k], f);
    
    546
    +    }
    
    547
    +    
    
    548
    +    return len + 2;
    
    549
    +}
    
    550
    +
    
    551
    +int
    
    552
    +asm_closure_header(lispobj* ptr, lispobj object, FILE* f)
    
    553
    +{
    
    554
    +    return asm_boxed(ptr, object, f);
    
    555
    +}
    
    556
    +
    
    557
    +int
    
    558
    +asm_complex_vector(lispobj* ptr, lispobj object, FILE* f)
    
    559
    +{
    
    560
    +    return asm_ni(ptr, object, f);
    
    561
    +}
    
    532 562
     
    
    533 563
     #if 0
    
    534 564
     int
    
    ... ... @@ -627,24 +657,26 @@ init_asmtab()
    627 657
         int k = 0;
    
    628 658
     
    
    629 659
         for (k = 0; k < 256; ++k) {
    
    630
    -        asmtab[k] = asm_boxed;
    
    660
    +        asmtab[k] = asm_ni;
    
    631 661
         }
    
    632 662
     
    
    633 663
         for (k = 0; k < 32; ++k) {
    
    634 664
             asmtab[type_EvenFixnum | (k << 3)] = asm_immediate;
    
    635 665
             asmtab[type_FunctionPointer | (k << 3)] = asm_function_pointer;
    
    636
    -	/* OtherImmediate0 */
    
    666
    +        asmtab[type_OtherImmediate0 | (k << 3)] = asm_ni;
    
    637 667
             asmtab[type_ListPointer | (k << 3)] = asm_list_pointer;
    
    638 668
             asmtab[type_OddFixnum | (k << 3)] = asm_immediate;
    
    639
    -#if 0
    
    640 669
             asmtab[type_InstancePointer | (k << 3)] = asm_instance_pointer;
    
    641
    -#endif        
    
    642
    -	/* OtherImmediate1 */
    
    670
    +        asmtab[type_OtherImmediate1 | (k << 3) ] = asm_ni;
    
    643 671
             asmtab[type_OtherPointer | (k << 3)] = asm_other_pointer;
    
    644 672
         }
    
    645 673
         
    
    646 674
         asmtab[type_SymbolHeader] = asm_boxed;
    
    647 675
         asmtab[type_Fdefn] = asm_fdefn;
    
    676
    +    asmtab[type_InstanceHeader] = asm_boxed;
    
    677
    +    asmtab[type_SimpleVector] = asm_simple_vector;
    
    678
    +    asmtab[type_FuncallableInstanceHeader] = asm_closure_header;
    
    679
    +    asmtab[type_ComplexVector] = asm_boxed;
    
    648 680
     }
    
    649 681
         
    
    650 682
     void