DeadPro60 / shedskin

Automatically exported from code.google.com/p/shedskin
0 stars 0 forks source link

enumerated list type inference doesn't work #99

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
class A(object):
        status_positions = ["C", "Z", "I", "D", "B", "5", "V", "N"]

        def pop_status(self):
                flags_bin = 42
                flags = set([(flag_name if (flags_bin & (1 << flag_bit)) != 0 else None) for flag_bit, flag_name in enumerate(self.__class__.status_positions)])
                print(flags)                                                                                                               

a = A()
a.pop_status()

*** SHED SKIN Python-to-C++ Compiler 0.5 ***
Copyright 2005-2010 Mark Dufour; License GNU GPL version 3 (See LICENSE)

[iterative type analysis..]
**
iterations: 2 templates: 75
[generating c++ code..]
*WARNING* a.py:8: variable 'flag_bit' has no type
*WARNING* a.py:8: variable 'flag_name' has no type

Original issue reported on code.google.com by danny.m...@gmail.com on 15 Oct 2010 at 9:34

Attachments:

GoogleCodeExporter commented 8 years ago
huh, or did I not think things through... shouldn't the condition check the 
real row number? *wonders*

Original comment by danny.m...@gmail.com on 26 Jun 2011 at 9:04

GoogleCodeExporter commented 8 years ago
two comments about speed.. 

looking at the above profile, mmu.xread_read_memory seems quite slow, because 
of the for loop in there. it looks like it should be possible to work around 
that..

you can make the C64 emulator use multiple cores :-) that is, the boehm GC can 
make use of those.. using 7.2 can also help a lot in some cases (6.8 is usually 
installed on distributions). ./configure --enable-cplusplus 
--enable-large-config --enable-parallel-mark --enable-thread-local-alloc 
--enable-threads=pthreads.

just some thoughts, I'm bored at work.. :-)

Original comment by mark.duf...@gmail.com on 28 Jun 2011 at 10:39

GoogleCodeExporter commented 8 years ago
Yeah, I've thought about just hard-coding all the special non-RAM mmu things 
instead of the "for" loop like the CIA, VIC, SID, CIA2 and CPUPort now. 

However, it would also be possible to limit the ability of set_overlay a bit 
(i.e. which addresses are allowed in an overlay) and use a regular array to 
look up what is to be done. I think the latter would be no problem since all 
the addresses are in pages of 256 bytes each on the original C64 in the first 
place, so there are only 256 possibilities max after a simple bit shift 
"address >> 8"...

Yeah, I've got boehm GC 6.8 installed as well. Good to know the newer GC 
supports multicore better ^^

Original comment by danny.m...@gmail.com on 29 Jun 2011 at 7:27