Skip to main content
47 votes
Accepted

Given a specific computer system, is it possible to estimate the actual precise run time of a piece of Assembly code

I can only quote from the manual of a rather primitive CPU, a 68020 processor from around 1986: "Calculating the exact runtime of a sequence of instructions is difficult, even if you have precise ...
gnasher729's user avatar
  • 30.7k
33 votes
Accepted

Assembly writer vs compiler in VLIW architecture

The "assembly writer" in that book is a human software developer who writes code in assembler language.
gnasher729's user avatar
  • 30.7k
30 votes

Given a specific computer system, is it possible to estimate the actual precise run time of a piece of Assembly code

You cannot do this in general, but in some senses, you very much can, and there have been a few historical cases in which you indeed had to. The Atari 2600 (or Atari Video Computer System) was one of ...
TheHans255's user avatar
23 votes

How AlphaDev improved sorting algorithms?

This is not a new sorting algorithm. It's much more interesting than that. AlphaDev appears to have produced a new technique for superoptimisation. You can think of the superoptimisation problem as ...
Pseudonym's user avatar
  • 22.3k
20 votes
Accepted

Why is static recompilation not possible?

Static recompilation from a binary is hard, because it is challenging to reconstruct the structure of the program. It is hard to statically figure out the location of all instructions that will be ...
D.W.'s user avatar
  • 162k
15 votes

Given a specific computer system, is it possible to estimate the actual precise run time of a piece of Assembly code

There are two aspects at play here As @gnasher729 points out, if we know the exact instructions to execute, it's still difficult to estimate the exact runtime because of things like caching, branch ...
Joey Eremondi's user avatar
12 votes

How AlphaDev improved sorting algorithms?

Check out Grady Booch's tweet on the matter: there is no "new sorting algorithm" here. Coming up with assembly level tricks is not the same as finding a new sorting algorithm. That would ...
ExpressionCoder's user avatar
10 votes

Assembly writer vs compiler in VLIW architecture

In VLIW architecture, the compiler/and or assembly writer chooses instructions that can be executed in parallel The meaning of this sentence is that in VLIW architecture, assembler (machine) code ...
Bulat's user avatar
  • 1,898
9 votes
Accepted

Essential difference between Assembly languages to all other programming languages

The two most obvious characteristics of an assembly language are: It is specific to a particular CPU architecture. There is a one-to-one correspondence between assembly language commands and machine ...
gandalf61's user avatar
  • 1,589
6 votes
Accepted

How AlphaDev improved sorting algorithms?

The improvement in the figure consists of the removal of one instruction. In a branch-less assembly program, this usually leads to a performance improvement. How much of a practical improvement it ...
Discrete lizard's user avatar
  • 8,303
5 votes

Essential difference between Assembly languages to all other programming languages

The essential difference between assembly language and every other programming language is that assembly language specifies the sequence of instructions directly, whereas in any other language, the ...
Yuval Filmus's user avatar
5 votes

Does assembly language get translated to binary code? If so, is assembly language portable across machines?

Assembler code describes instructions for one particular architecture. It is slightly helpful by allowing you to use human-readable names for instructions, names for memory addresses, doing some ...
gnasher729's user avatar
  • 30.7k
5 votes

How does a CPU do function calls?

Note that Turing machines don't have any function calls, and they work just fine as Turing machines. Function calls are not a necessity for Turing-completeness. All non-recursive function calls can ...
Quitting Due To Antisemitism's user avatar
4 votes

How is an Assembly Language Processed by a CPU's Circuitry?

An assembler is a program that reads assembly language commands and translates then into a sequence of binary instructions, addresses and data values that is called machine code. The machine code is ...
gandalf61's user avatar
  • 1,589
4 votes

Essential difference between Assembly languages to all other programming languages

(Warning, this historical account of increasing abstraction and declarative programming may annoy, confuse, or upset you:) Hello, world! By far and large, programing languages happen on a continuum, ...
J D's user avatar
  • 181
4 votes
Accepted

Do compilers of high programming languages always compile them directly to machine code?

I've seen compilers that compile directly to object code. I've seen compilers that compile to assembler code. I've seen compilers that compile to byte code for a virtual machine. I've seen ...
gnasher729's user avatar
  • 30.7k
4 votes

Why is static recompilation not possible?

Static recompilation is used, for example it is central in Apple's Rosetta 2 emulator. But there are challenges that make it difficult to apply. Most importantly, all jump targets are not readily ...
jpa's user avatar
  • 449
3 votes

Are assembly languages untyped?

Can we say that assembly is generally untyped? If you mean "assembly" as, e.g. x86 assembly language, then I think yes, to some degree. Types are some constraints that we can statically checked/...
Ta Thanh Dinh's user avatar
3 votes

Are assembly languages untyped?

Many assembly languages do have certain features that could be considered static typing. Most often this is for making programming easier, rather than type checking. In many assembly languages you ...
Artelius's user avatar
  • 676
3 votes

Are assembly languages untyped?

Assembly language is normally untyped, in the sense that there is no type-checking. Adding type-checking is a non-trivial research challenge (hence the papers you see). Papers on typed assembly ...
D.W.'s user avatar
  • 162k
3 votes
Accepted

The instructions a Stack Machine has

There are dozens and dozens of stack machines out there in the wild, and they all have different instruction sets. So there's no single correct answer. Some people might consider using ...
Draconis's user avatar
  • 7,148
3 votes

How is an Assembly Language Processed by a CPU's Circuitry?

The CPU only understands machine code. Assembly language has to be compiled to machine code in order for the CPU to execute it. Machine code isn't very user friendly. While the very first computers ...
Yuval Filmus's user avatar
3 votes

How does a CPU do function calls?

Is there a return address stack on the CPU (limited to memory on chip), or is it emulated in software at the assembler using regular RAM? Yes. Some processors do not have a stack (and need to ...
Jasen's user avatar
  • 157
3 votes

In theory, is it impossible, or possible (although ridiculously impractical), to inline recursive functions?

I think you're conflating two different problems here. One is "inlining" (the elimination of a method call), the other is "loop unrolling" (the elimination of a jump instruction). ...
Steve's user avatar
  • 562
2 votes

How is an Assembly Language Processed by a CPU's Circuitry?

That translation isn’t done by the CPU when it executed the instructions. It is done a lot earlier, when a program called “assembler” translates the assembler instructions into sequences of bits that ...
gnasher729's user avatar
  • 30.7k
2 votes

Given a specific computer system, is it possible to estimate the actual precise run time of a piece of Assembly code

Back in the era of 8-bit computers, some games did something like that. Programmers would use the exact amount of time it took to execute instructions, based on the amount of time they took and the ...
Davislor's user avatar
  • 1,241
2 votes

Given a specific computer system, is it possible to estimate the actual precise run time of a piece of Assembly code

Would the choice of "computer system" happen to include microcontrollers? Some microcontrollers have very predictable execution times, for example the 8 bit PIC series have four clock cycles per ...
Oliver Broad's user avatar
2 votes

RAM and ROM confusion

"ROM" stands for "read only memory". This usually means that you can read any location in ROM, but you can't change what is already in ROM. (Data in ROM is written when the ROM chip is constructed, ...
Mars's user avatar
  • 716
2 votes
Accepted

Can a 32-bit processor work with a 64-bit size word?

Just what makes a processor a 32-bit processor? And what would 64-bit word/32-bit halfword mean in the context? There are processors allowing a single instruction ...
greybeard's user avatar
  • 1,074

Only top scored, non community-wiki answers of a minimum length are eligible