Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Bytecode portability and word/int sizes
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Melvin Smith  
View profile  
 More options Nov 22 2003, 1:00 pm
Newsgroups: perl.perl6.internals
From: mrjoltc...@mindspring.com (Melvin Smith)
Date: Sat, 22 Nov 2003 12:50:49 -0500
Local: Sat, Nov 22 2003 12:50 pm
Subject: Bytecode portability and word/int sizes
At 12:13 PM 11/22/2003 +0000, you wrote:

>   * write intval size into PBC header

Leo, I know this is a first cut at freeze/thaw, and I'm happy you've
done it. Let me make some comments to you and Dan.

I'm pretty sure Dan and I discussed this when I was reworking bytecode
to be portable last year, but I think at the time we decided there were other
things (like freezing PMCs) that needed to be done. Now that it is in, its
time to re-light this discussion until we get a document out of it. :)

A) I didn't look at your commit to see the reason for storing the INTVAL size
into the bytecode header, so I won't question it yet, but since p6i has argued
this for a couple of years, I want to restate some things.

Parrot currently assumes INTVAL size == OPCODE size because
both get configured as the same integral type, although you can choose
to override it, it is not supported to choose INTVAL > OPCODE, though
the inverse is. So storing it in the header is probably redundant, unless
we change the rules.

While we may have platforms that have void */size_t > than INT,
we should not have any where void */size_t < INT.

An int should always pack into 1 opcode_t, if it doesn't we have configured
wrong for INTVAL (someone chose a 64-bit type on a 32-bit platform),
and the fact that by configure, it is even possible, says we have the
typedef hierarchy wrong. I still feel that Parrot_Int should be dependant
on Parrot_Opcode.

B) For bytecodes to be portable we have to have some rules about
standard sizes. Yes, we can unpack a 64-bit bytecode on a 32-bit
CPU, but INTVAL constants (non-PMC) get truncated.

Since it is NEVER portable for someone to write code using the Ix
registers with values > than 32-bit, we have to make a rule. Any use
of integers > than 32-bit should use a PMC type, not an integral type.

The fact that:

set I0, 0
LOOP:
inc I0
lt I0, <MAXINT CONSTANT>, LOOP

Runs differently between platforms is enough reason to make
a least common denominator MAXINT the Parrot standard.

The summary of this:

Parrot must use a PMC Int type to store portable data, so the INTVAL
should be stored as part of the PMC stream, not the bytecode
header, as we may support multiple sizes.

-Melvin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.