1. Pypy
  2. Untitled project
  3. lang-scheme
  4. Issues
Issue #1 new

= operator

Anonymous created an issue

(display (if (= 1 2) 1 2)) returns 1 instead 2 Is this a bug or am I missing something?

Comments (8)

  1. Shizhi Wang

    I still haven't figure out why. Here is error/warning I get by running: python /pypy/pypy/translator/goal/translate.py /lang-scheme/scheme/targetscheme.py Any tip on what's wrong is much appreciated!

    [rtyper] -=- specialized 25 more blocks -=-
    *******%%%%%############################################################%%%%%%%%
    *****%%%###############################################################%%%%%%%%%
    #######################################################################%%%%%%%%%
    *****%%%#####################################################
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gctypelayout.GCData object at 0xb9595ec> has no attribute 'root_stack_top'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gctypelayout.GCData object at 0xb9595ec> has no attribute 'root_stack_base'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute 'young_objects_with_light_finalizers'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute 'young_rawmalloced_objects'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute 'rawmalloced_total_size'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute 'next_major_collection_initial'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute 'old_objects_with_light_finalizers'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute '_debug_pending'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute '_list_rpy'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute 'tmpstack'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute '_callback2_arg4'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute '_debug_seen'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute 'finalizer_lock_count'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute '_callback2_arg3'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute 'nursery_objects_shadows'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute 'young_objects_with_weakrefs'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute 'old_objects_with_weakrefs'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute 'next_major_collection_threshold'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute 'old_rawmalloced_objects'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute 'objects_to_trace'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute 'objects_with_finalizers'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute '_count_rpy'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute '_callback2_arg0'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute '_callback2_arg1'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute '_callback2_arg2'
    [rtyper:WARNING] prebuilt instance <pypy.rpython.memory.gc.minimark.MiniMarkGC object at 0xb959dac> has no attribute 'run_finalizers'
    [rtyper] specializing: 5100 / 6516 blocks   (78%)
    *****%%%############################
    [rtyper] specializing: 5500 / 6618 blocks   (83%)
    *****%%%###########
    ...
    
    [translation:info] written: /tmp/usession-default-23/testing_1/testing_1.c
    [translation:info] Compiling c source...
    [platform:execute] make  in /tmp/usession-default-23/testing_1
    [platform:WARNING] rpython_memory_gc_env.c: In function ‘pypy_g_get_total_memory_linux’:
    [platform:WARNING] rpython_memory_gc_env.c:420:48: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] rpython_memory_gc_env.c:420:48: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] rpython_memory_gc_env.c:420:48: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] rpython_memory_gc_env.c:420:48: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] rpython_memory_gc_env.c:420:48: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] rpython_memory_gc_env.c:420:48: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] rpython_memory_gc_env.c:420:48: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] rpython_memory_gc_env.c:420:48: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] rlib_rdtoa.c: In function ‘pypy_g_dtoa_formatd__Float_Char_Signed_Signed’:
    [platform:WARNING] rlib_rdtoa.c:473:49: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] rlib_rdtoa.c:473:49: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] rpython_lltypesystem_rffi.c: In function ‘pypy_g__PyPy_dg_dtoa__Float_Signed_Signed_arrayPtr_arra’:
    [platform:WARNING] rpython_lltypesystem_rffi.c:531:2: warning: passing argument 4 of ‘_PyPy_dg_dtoa’ from incompatible pointer type [enabled by default]
    [platform:WARNING] /home/cnsgsz/pypy/pypy/translator/c/src/dtoa.h:4:8: note: expected ‘int *’ but argument is of type ‘Signed *’
    [platform:WARNING] rpython_lltypesystem_rffi.c:531:2: warning: passing argument 5 of ‘_PyPy_dg_dtoa’ from incompatible pointer type [enabled by default]
    [platform:WARNING] /home/cnsgsz/pypy/pypy/translator/c/src/dtoa.h:4:8: note: expected ‘int *’ but argument is of type ‘Signed *’
    [platform:WARNING] syntax.c: In function ‘pypy_g_QuasiQuote_unquote’:
    [platform:WARNING] syntax.c:12123:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12123:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12123:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12123:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12123:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12123:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12123:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12123:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12123:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12123:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12123:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12123:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12123:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12123:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12123:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12606:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12606:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12606:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12606:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12606:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12606:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12606:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12606:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12606:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12606:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12606:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12606:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12606:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12606:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12606:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12975:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12975:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12975:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12975:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12975:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12975:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12975:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12975:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:12975:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:13409:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:13409:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:13409:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:13409:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:13409:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] syntax.c:13409:50: warning: array subscript is above array bounds [-Warray-bounds]
    [platform:WARNING] In file included from debug_print.c:16:0:
    [platform:WARNING] common_header.h:17:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
    [platform:WARNING] /usr/include/features.h:215:0: note: this is the location of the previous definition
    [translation:info] usession directory: /tmp/usession-default-23
    [translation:info] created: /home/cnsgsz/ss-c
    
  2. Armin Rigo

    Ah, figured it out. Translation of the scheme interpreter cannot possibly work; this is not RPython code. I've no clue why there is a targetscheme.py, but it was not finished. The next issue is all these "def new" methods in W_Root subclasses in object.py. They are completely ignored by RPython. As a result, "#f" returns W_Boolean(False), which in RPython really makes and returns an instance of W_Boolean.

    Someone needs to fix it by removing the new methods (the sanest solution).

  3. Shizhi Wang

    Thanks! I also got interactive.py to work. (hopefully below is the correct way?) cnsgsz@ubuntu:/lang-scheme/scheme$ python interactive.py PyPy Scheme interpreter -> I am new to pypy and this scheme implementation, it would be great if you can help me out with some questions I have with this implementation: 1. how does pypy tools help with the interactive.py implementation? does pypy makes it faster than otherwise standard python implementation of scheme interpreter? I know how translation of rpython code with pypy can produce a faster interpreter, but the interactive.py isn't translated... 2. what are you referring to by "def new" in W_Root? is there a quick fix to make targetscheme.py and the translation work? Thank you so much!

  4. Armin Rigo

    1. Indeed, interactive.py is not translated. It runs the scheme interpreter in regular Python. It's in this mode that we run most tests. To run them, use "python /path/to/pypy/test_all.py test/test_<filename>.py" or just "test/" to pick the whole directory.

    2. That's bitbucket being unhelpful and eating underscopes from what I typed... I meant "def --new--()", where each "-" stands for an underscore. You have of course to know reasonably well Python (e.g. what the method --new--() does) in order to develop an interpreter with PyPy. Scheme is not yet ready to use --- as shown by this issue, and I'm sure there are more.

  5. Log in to comment