Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- during Python opcode execution cycle ;P
- LOAD_CLOSURE === >
- g:
- 00000000 88 (00 00 = 000000AD STR: 'a' (01 00 00 00 61)) - LOAD_DEREF
- 00000003 64 (01 00 = 00000099 INT: 1 (01 00 00 00)) - LOAD_CONST
- 00000006 17 - BINARY_ADD
- 00000007 53 - RETURN_VALUE
- f:
- 00000000 64 (01 00 = 00000070 INT: 1 (01 00 00 00)) - LOAD_CONST
- 00000003 89 (00 00 = 000000FF STR: 'a' (00 00 00 00)) - STORE_DEREF
- 00000006 87 (00 00 = 000000FF STR: 'a' (00 00 00 00)) - LOAD_CLOSURE
- 00000009 66 (01 00) - BUILD_TUPLE
- 0000000C 64 (02 00 = 00000075 CODE(g)) - LOAD_CONST
- 0000000F 86 (00 00) - MAKE_CLOSURE
- 00000012 7D (00 00 = 000000F0 STR: 'g' (01 00 00 00)) - STORE_FAST
- 00000015 7C (00 00 = 000000F0 STR: 'g' (01 00 00 00)) - LOAD_FAST
- 00000018 83 (00 00) - CALL_FUNCTION
- 0000001B 53 - RETURN_VALUE
- <module>:
- 00000000 64 (00 00 = 00000038 CODE(f)) - LOAD_CONST
- 00000003 84 (00 00) - MAKE_FUNCTION
- 00000006 5A (00 00 = 0000013C STR: 'f' (02 00 00 00)) - STORE_NAME
- 00000009 65 (00 00 = 0000013C STR: 'f' (02 00 00 00)) - LOAD_NAME
- 0000000C 83 (00 00) - CALL_FUNCTION
- 0000000F 47 - PRINT_ITEM
- 00000010 48 - PRINT_NEWLINE
- 00000011 64 (01 00 = 00000136 None (4E)) - LOAD_CONST
- 00000014 53 - RETURN_VALUE
- ref: http://unpyc.sourceforge.net/Opcodes.html
- Tesekkur PYTHON Out order execution paradiqma istifade etmirsen :)
- ortaya barriers gelir )) Gel ASM (C compatible) uzerinde baxaq
- Ilk atomic execution tesirine baxiram )
- CPU 1 ==== CPU 2
- STORE ==== > 0xde |||||| STORE === > 0x39
- WTF? ((out of ordering prosesi :P)
- LOAD ==== > 0x45 |||||| LOAD === > 0x11
- Intel architecture instruction set loading ve storing emeliyyatlarini 1-opcode cycle ile hell edir foreverr.
- Interpreter execution sirasinda L[1-3] cache dump edirem hemcinin TLB (QEMU uzerinde oz yazdigim dump_TLB funskiya ile)
- PAGE_SHIFTING sonrasi, umumilikde 13 instruction (29 cycle) ise dusdu ve TLB memory addressingi buradan edir. PAGE_SIZE(4kb)>>=PAGE_SHIFT
- VPN_lere baxiram
- L2 TLB/cache information: 4K pages & L2 TLB (0x80000006/ebx):
- ==== > VPN 02
- 1 cycle
- | opcode | prefix | opcode | lock | opcode |
- al buda sene performance :P
- Logical CPU cores (0x80000008/ecx):
- number of CPU cores - 1 = 0x0 (0)
- ApicIdCoreIdSize = 0x0 (0)
- APIC IRQ gondererek (on qemu) ordering-e baxiram
- extended APIC ID = 1
- --- level 1 (core) ---
- bits to shift APIC ID to get next = 0x1 (1)
- logical processors at this level = 0x2 (2)
- on abstract machine (VMX dependable) :P
- CPU 1 ==== CPU 2
- LOAD ==== > 0x11 |||||| STORE === > 0x39
- WTF? ((movement ilk once load etdi)
- LOAD ==== > 0x45 |||||| STORE === > 0xde
- sizin ucun teorik instruction parallelism grafikide cekim gorun performans nece olur :) (RISC based)
- +----+----+----+-----+----+
- | IF | ID | EX | MEM | WB | <-------------- 1ci opcode
- +----+----+----+-----+----+----+
- | IF | ID | EX | MEM| WB | <----------- 2ci opcode
- +----+----+-----+----+----+----+
- | IF | ID | EX | MEM| WB | <------ 3cu opcode
- +----+-----+----+----+----+
- ...... ve s.
- ancaq gcc default olaraq SMP barriers disable edir (reordering depended) :P (buda boyuk proektlerde concurrency ve s. ( such as RCU) qarisiqliq yaradir buda cox vaxt EXCEPTION trigger edir (#GP ve s.)).
- Hemcinin NUMA based processor mene imkan verirki atomic (core depended) memory management edim.
- core-lar ayriliqda paralel olaraq bank-lara ve node-lara icazesi var.
- Sandybrigde processor ======== binary-ni guest machine uzerinde ise saliram VMX state-de 1 CORE,1 node (BANK) NORMAL(ZOne) zonasini mapped edir.
- fucking shiiiiitttt
- Node 0, zone Normal
- pages free 115253
- min 9355
- low 11693
- high 14032
- scanned 0
- spanned 192495
- present 192495
- managed 188524
- nr_free_pages 115253
- nr_alloc_batch 1009
- nr_inactive_anon 12802
- nr_active_anon 16307
- nr_inactive_file 16056
- nr_active_file 16960
- nr_unevictable 14
- nr_mlock 14
- nr_shmem 668
- infinitive loop prosesinde memory statistikasina baxiram )
- zone watermarks 1 structure ile 3 memory addr ile zone balance trace edir low state-de (page_free,page_min) reclaim edilir. (kswapd woken up :P) - (zone->free_pages = low :( .... pages_min=reclaim)
- Cunki hemcinin ABI mapped (sections,header(program)) edirem :P
- buna gorede 2ci prosedura gelirem :) (VDSO mapping blah blah)
- kernel (load_elf_binary()) funksiyasi ELF parsing edir.
- 571 static int load_elf_binary(struct linux_binprm *bprm)
- 572 {
- 573 struct file *interpreter = NULL; /* to shut gcc up */
- 574 unsigned long load_addr = 0, load_bias = 0;
- 575 int load_addr_set = 0;
- 576 char * elf_interpreter = NULL;
- 577 unsigned long error;
- 578 struct elf_phdr *elf_ppnt, *elf_phdata;
- 579 unsigned long elf_bss, elf_brk;
- 580 int retval, i;
- 581 unsigned int size;
- 582 unsigned long elf_entry;
- 583 unsigned long interp_load_addr = 0;
- 584 unsigned long start_code, end_code, start_data, end_data;
- 585 unsigned long reloc_func_desc __maybe_unused = 0;
- 586 int executable_stack = EXSTACK_DEFAULT;
- 587 struct pt_regs *regs = current_pt_regs();
- 588 struct {
- 589 struct elfhdr elf_ex;
- 590 struct elfhdr interp_elf_ex;
- 591 } *loc;
- 592
- 593 loc = kmalloc(sizeof(*loc), GFP_KERNEL);
- 594 if (!loc) {
- 595 retval = -ENOMEM;
- 596 goto out_ret;
- 597 }
- 598
- 599 /* Get the exec-header */
- 600 loc->elf_ex = *((struct elfhdr *)bprm->buf);
- 601
- 602 retval = -ENOEXEC;
- 603 /* First of all, some simple consistency checks */
- 604 if (memcmp(loc->elf_ex.e_ident, ELFMAG, SELFMAG) != 0)
- 605 goto out;
- 606
- 607 if (loc->elf_ex.e_type != ET_EXEC && loc->elf_ex.e_type != ET_DYN)
- 608 goto out;
- 609 if (!elf_check_arch(&loc->elf_ex))
- 610 goto out;
- 611 if (!bprm->file->f_op->mmap)
- 612 goto out;
- ........
- ^
- | (ELF Handling)
- |
- Hemcinin her process space-e dynamic symbol mapping edir
- 29: 080495f0 0 OBJECT LOCAL DEFAULT 21 __JCR_LIST__
- 30: 08048330 0 FUNC LOCAL DEFAULT 14 deregister_tm_clones
- 31: 08048360 0 FUNC LOCAL DEFAULT 14 register_tm_clones
- 32: 080483a0 0 FUNC LOCAL DEFAULT 14 __do_global_dtors_aux
- 33: 080496fc 1 OBJECT LOCAL DEFAULT 26 completed.6584
- 34: 080495ec 0 OBJECT LOCAL DEFAULT 20 __do_global_dtors_aux_fin
- 35: 080483c0 0 FUNC LOCAL DEFAULT 14 frame_dummy
- 36: 080495e8 0 OBJECT LOCAL DEFAULT 19 __frame_dummy_init_array_
- 37: 00000000 0 FILE LOCAL DEFAULT ABS test.c
- 38: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
- 39: 080485e4 0 OBJECT LOCAL DEFAULT 18 __FRAME_END__
- 40: 080495f0 0 OBJECT LOCAL DEFAULT 21 __JCR_END__
- 41: 00000000 0 FILE LOCAL DEFAULT ABS
- 42: 080495ec 0 NOTYPE LOCAL DEFAULT 19 __init_array_end
- 43: 080495f4 0 OBJECT LOCAL DEFAULT 22 _DYNAMIC
- 44: 080495e8 0 NOTYPE LOCAL DEFAULT 19 __init_array_start
- 45: 080484c8 0 NOTYPE LOCAL DEFAULT 17 __GNU_EH_FRAME_HDR
- 46: 080496e0 0 OBJECT LOCAL DEFAULT 24 _GLOBAL_OFFSET_TABLE_
- 47: 080484a0 2 FUNC GLOBAL DEFAULT 14 __libc_csu_fini
- 48: 08048320 4 FUNC GLOBAL HIDDEN 14 __x86.get_pc_thunk.bx
- 49: 080496f4 0 NOTYPE WEAK DEFAULT 25 data_start
- 50: 00000000 0 FUNC GLOBAL DEFAULT UND printf@@GLIBC_2.0
- 51: 080496fc 0 NOTYPE GLOBAL DEFAULT 25 _edata
- 52: 080484a4 0 FUNC GLOBAL DEFAULT 15 _fini
- 53: 080496f4 0 NOTYPE GLOBAL DEFAULT 25 __data_start
- 54: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
- 55: 080496f8 0 OBJECT GLOBAL HIDDEN 25 __dso_handle
- 56: 080484bc 4 OBJECT GLOBAL DEFAULT 16 _IO_stdin_used
- 57: 00000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@@GLIBC_
- 58: 08048440 93 FUNC GLOBAL DEFAULT 14 __libc_csu_init
- 59: 08049700 0 NOTYPE GLOBAL DEFAULT 26 _end
- 60: 080482f0 0 FUNC GLOBAL DEFAULT 14 _start
- 61: 080484b8 4 OBJECT GLOBAL DEFAULT 16 _fp_hw
- 62: 080496fc 0 NOTYPE GLOBAL DEFAULT 26 __bss_start
- 63: 08048418 32 FUNC GLOBAL DEFAULT 14 main
- 64: 080483eb 45 FUNC GLOBAL DEFAULT 14 function
- 65: 080496fc 0 OBJECT GLOBAL HIDDEN 25 __TMC_END__
- 66: 0804828c 0 FUNC GLOBAL DEFAULT 11 _init
- performance WTFFF? :)
Advertisement
Add Comment
Please, Sign In to add comment