Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 632017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:01:48+00:00 2026-05-13T20:01:48+00:00

I’m currently working my way through Andrew Appel’s Modern Compiler Implementation in Java, and

  • 0

I’m currently working my way through Andrew Appel’s Modern Compiler Implementation in Java, and I’m right around the point where I build the low-level intermediate representation.

Initially, I had decided to target the JVM and ignore all of the low-level machine stuff, but in the interest of learning things that I don’t know much about I’ve had a change of heart. This changes my IR, because targeting the JVM allows me to (more or less) wave my hands at making a method call or constructing an object.

The Appel book doesn’t go into detail about any specific machine architecture, so I’d like to know where I can find out everything I need to know to go farther.

The things that I’m currently aware that I need to know are:

  • Which instruction set to use. I have two laptops I could develop on; both have Core 2 Duo processors. My current understanding is that x86 processors mostly use the same instruction set, but they are not all exactly the same.

  • Whether the operating system affects the code generation step of compilation, or whether it is completely dependent on the processor. For example, I know something is different about generating code to run on a 32-bit vs. a 64-bit platform.

  • How stack frames and such are organized. When to use registers vs. putting parameters on the stack, caller-save vs. callee-save, all of that. I’d have thought that this would be described along with the instruction set but so far I haven’t seen this particular info anywhere. Maybe I’m misunderstanding something here?

Links to resources in lieu of answers are perfectly welcomed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:01:48+00:00Added an answer on May 13, 2026 at 8:01 pm

    Most of the x86 instruction set is common to all processors — it’s a reasonably safe bet that your processors both have the same instruction set, except possibly for SIMD instructions that probably won’t be very useful to you when implementing a simple compiler (these instructions are normally used to make multimedia applications and the like go faster). The instruction set is listed in Intel’s manuals — 2A and 2B in particular have a full listing of instructions and their behaviour, although the other volumes are worth taking a look at.

    When generating user space code, the choice of operating system matters when it comes to syscalls. For instance, if you want a program to output something to the terminal on 64 bit Linux, you need to make a system call by:

    • loading the value 1 into register rax to indicate this is a write system call.
    • loading the value 1 into register rdi to indicate stdout should be used (1 is the file descriptor for stdout)
    • loading the start address of what you want to print into register rsi
    • loading the length of what you want to print into register rdx
    • executing the syscall instruction once the registers (and memory) have been set up.

    The return value from write is stored in rax.

    A different operating system might have a different system call number for write, might have a different way of passing in arguments (x86-64 Linux system calls always use rdi, rsi, rdx, r10, r8, and r9 in that order for parameters, with the system call number in rax), and might have different system calls altogether.

    The convention for ordinary function calls on Linux is similar — the order of registers is rdi, rsi, rdx, rcx, r8, and r9 (so all the same, except using rcx instead of r10), with further arguments on the stack and a return value in rax. According to this page, registers rbp, rbx, and r12 up to r15 should be preserved across function calls. You are, of course, free to make up your own convention (unless making a system call), but that makes it harder to call be called from code generated or written by others.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 300k
  • Answers 300k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer OKay here is the deal. It looks like Webapp URL… May 13, 2026 at 8:02 pm
  • Editorial Team
    Editorial Team added an answer I think its better to convert your namevaluecollection into List… May 13, 2026 at 8:02 pm
  • Editorial Team
    Editorial Team added an answer The default Shortcut is Alt+Enter. It is also accessible in… May 13, 2026 at 8:02 pm

Related Questions

I want use html5's new tag to play a wav file (currently only supported
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I've got a string that has curly quotes in it. I'd like to replace
In order to apply a triggered animation to all ToolTip s in my app,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.