Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
handle size_t and bool on jvm
  • Loading branch information
FROGGS committed Dec 14, 2015
1 parent a51569c commit c0a52db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/vm/jvm/QAST/Compiler.nqp
Expand Up @@ -2022,6 +2022,8 @@ my %const_map := nqp::hash(
'C_TYPE_INT', -3,
'C_TYPE_LONG', -4,
'C_TYPE_LONGLONG', -5,
'C_TYPE_SIZE_T', -6,
'C_TYPE_BOOL', -7,
'C_TYPE_FLOAT', -1,
'C_TYPE_DOUBLE', -2,
'C_TYPE_LONGDOUBLE', -3,
Expand Down
10 changes: 10 additions & 0 deletions src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/P6int.java
@@ -1,6 +1,7 @@
package org.perl6.nqp.sixmodel.reprs;

import com.sun.jna.NativeLong;
import com.sun.jna.Native;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
Expand All @@ -23,6 +24,8 @@ public class P6int extends REPR {
public final static byte P6INT_C_TYPE_INT = -3;
public final static byte P6INT_C_TYPE_LONG = -4;
public final static byte P6INT_C_TYPE_LONGLONG = -5;
public final static byte P6INT_C_TYPE_SIZE_T = -6;
public final static byte P6INT_C_TYPE_BOOL = -7;

public SixModelObject type_object_for(ThreadContext tc, SixModelObject HOW) {
STable st = new STable(this, HOW);
Expand Down Expand Up @@ -64,6 +67,13 @@ public void compose(ThreadContext tc, STable st, SixModelObject repr_info) {
/* There is no LongLong in Java */
((StorageSpec)st.REPRData).bits = Long.SIZE;
break;
case P6INT_C_TYPE_SIZE_T:
((StorageSpec)st.REPRData).bits = (short)(8 * Native.SIZE_T_SIZE);
break;
case P6INT_C_TYPE_BOOL:
/* Let's just hope that a bool is 1 byte in size, always. */
((StorageSpec)st.REPRData).bits = Byte.SIZE;
break;
default:
((StorageSpec)st.REPRData).bits = bitwidth;
break;
Expand Down

0 comments on commit c0a52db

Please sign in to comment.