opcode

How to interpret the opcode manually?

蓝咒 提交于 2019-11-30 09:00:59
77f4bcbc 8945fc mov dword ptr [ebp-4],eax And here's the rule: 88 /r MOV r/m8,r8 2/2 Move byte register to r/m byte 89 /r MOV r/m16,r16 2/2 Move word register to r/m word 89 /r MOV r/m32,r32 2/2 Move dword register to r/m dword How to interpret 8945fc to mov dword ptr [ebp-4],eax ? We have here a three-byte instruction: 89 45 fc. The first byte is the opcode byte. Looking it up in the table, we can see that it's a MOV instruction and it takes a Mod R/M byte. The Mod R/M byte has the following layout: 7 6 5 4 3 2 1 0 +-----+---------+---------+ | Mod | Reg | R/M | +-----+---------+---------+

What is faster: JMP or string of NOPs?

断了今生、忘了曾经 提交于 2019-11-30 08:27:10
问题 I'm implementing binary translation and have to deal with sequences of NOPs (0x90) with length about 16 opcodes. Is it better for performance to place JMP (to the end) at start of such sequences? 回答1: The Intel Architecture Software developer's guide, volume 2B (instructions N-Z) contains the following table (pg 4-12) about NOP : Table 4-9. Recommended Multi-Byte Sequence of NOP Instruction Length Assembly Byte Sequence =========================================================================

Dynamic object property populator (without reflection)

感情迁移 提交于 2019-11-30 07:48:06
I want to populate an object's properties without using reflection in a manner similar to the DynamicBuilder on CodeProject . The CodeProject example is tailored for populating entities using a DataReader or DataRecord. I use this in several DALs to good effect. Now I want to modify it to use a dictionary or other data agnostic object so that I can use it in non DAL code --places I currently use reflection. I know almost nothing about OpCodes and IL. I just know that it works well and is faster than reflection. I have tried to modify the CodeProject example and because of my ignorance with IL,

What is the purpose of the ACC_SUPER access flag on Java Class files?

半世苍凉 提交于 2019-11-30 05:52:39
The invokespecial JVM instruction is used for calling initialisation methods ( <init> ) when creating new objects. The description of the instruction suggests (but doesn't clarify) that the decision on whether to call the constructor of a superclass or a constructor of the current class depends on the state of the ACC_SUPER flag set within the class file. From the Sun JVM Specification: Next, the resolved method is selected for invocation unless all of the following conditions are true: The ACC_SUPER flag (see Table 4.1, "Class access and property modifiers") is set for the current class. --

calling code stored in the heap from vc++

扶醉桌前 提交于 2019-11-29 20:31:23
Imagine I am doing something like this: void *p = malloc (1000); *((char*)p) = some_opcode; *((char*)p+1) = another_opcode; // for the sake of the example: the opcodes are ok .... etc... How can I define a function pointer to call p as if it was a function? (i'm using VC++ 2008 express). Thanks A comment wasn't enough space. Joe_Muc is correct. You should not stuff code into memory obtained by malloc or new . You will run into problems if you change the page properties of pages that Windows allocates. This isn't a problem becuase using VirtualAlloc() and the related WIn32 APIs is every easy:

PHP Opcode Caching/Zend Acceleration and include_once vs. require_once

爱⌒轻易说出口 提交于 2019-11-29 14:42:43
问题 I have a colleague who is looking into opcode caching/Zend Acceleration (I've always assumed these are the same thing) for our PHP based application. His Benchmarks appear to indicate that we're NOT seeing a performance benefit if we include our (large) class libraries with require_once, but we DO see the performance benefit when using include_once. This smells fishy to both of us, but I don't have time to check into our benchmark methodology myself and my colleague has more tolerance for the

What is the significance of operations on the register EAX having their own opcodes?

若如初见. 提交于 2019-11-29 14:09:17
If you look at documentation of operations like cmp , test , add , sub , and and , you will notice that operations that involve register EAX and its 16 and 8 bit variants as the first operand have a distinct opcode which is different from the "general case" version of these instructions. Is this separate opcode merely a way to save code space, is it at all more efficient than the general-case opcode, or is it just some relic of the past that isn't worth shaking off for compatibility reasons? This is primarily a relic of the past, but not exactly "obsolete" either. In the early days ( i.e. , on

What Java code will force javac 1.6 to use the 'swap' and 'nop' opcodes?

喜夏-厌秋 提交于 2019-11-29 13:50:43
I'm working on an amateur JVM implementation, and I'm trying to make sure I have test coverage for all of the opcodes in the spec. I've gotten it down to the last few, but nop and swap have been eluding me. For example, here's a simple function that might use swap : static int do_swap() { int a = 56; int b = 32; return b%a; } But the bytecode produced by javac 1.6 avoids swapping in lieu of local storage: static int do_swap(); Code: 0: bipush 56 2: istore_0 3: bipush 32 5: istore_1 6: iload_1 7: iload_0 8: irem 9: ireturn Any ideas? None. The Java Language Specification does not provide such

Dynamic object property populator (without reflection)

▼魔方 西西 提交于 2019-11-29 09:54:52
问题 I want to populate an object's properties without using reflection in a manner similar to the DynamicBuilder on CodeProject. The CodeProject example is tailored for populating entities using a DataReader or DataRecord. I use this in several DALs to good effect. Now I want to modify it to use a dictionary or other data agnostic object so that I can use it in non DAL code --places I currently use reflection. I know almost nothing about OpCodes and IL. I just know that it works well and is

What is the purpose of the ACC_SUPER access flag on Java Class files?

这一生的挚爱 提交于 2019-11-29 06:15:01
问题 The invokespecial JVM instruction is used for calling initialisation methods ( <init> ) when creating new objects. The description of the instruction suggests (but doesn't clarify) that the decision on whether to call the constructor of a superclass or a constructor of the current class depends on the state of the ACC_SUPER flag set within the class file. From the Sun JVM Specification: Next, the resolved method is selected for invocation unless all of the following conditions are true: The