Skip to content

Commit

Permalink
Fix header bug in NativeObject
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Aug 22, 2022
1 parent 28a2ce9 commit e1df9b2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ public int getHash() {
return ObjectHeader.getHash(header);
}

public long getHeader() {
return header;
}

public ClassObject getSqueakClass() {
if (squeakClass == null) {
squeakClass = getClassChunk().asClassObject(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public NativeObject() { // constructor for special selectors
storage = ArrayUtils.EMPTY_ARRAY;
}

private NativeObject(final int header, final ClassObject classObject, final Object storage) {
private NativeObject(final long header, final ClassObject classObject, final Object storage) {
super(header, classObject);
assert storage != null : "Unexpected `null` value";
this.storage = storage;
Expand All @@ -62,7 +62,7 @@ private NativeObject(final NativeObject original, final Object storageCopy) {
}

public static NativeObject newNativeBytes(final SqueakImageChunk chunk) {
return new NativeObject(chunk.getHash(), chunk.getSqueakClass(), chunk.getBytes());
return new NativeObject(chunk.getHeader(), chunk.getSqueakClass(), chunk.getBytes());
}

public static NativeObject newNativeBytes(final SqueakImageContext img, final ClassObject klass, final byte[] bytes) {
Expand All @@ -74,7 +74,7 @@ public static NativeObject newNativeBytes(final SqueakImageContext img, final Cl
}

public static NativeObject newNativeInts(final SqueakImageChunk chunk) {
return new NativeObject(chunk.getHash(), chunk.getSqueakClass(), UnsafeUtils.toInts(chunk.getBytes()));
return new NativeObject(chunk.getHeader(), chunk.getSqueakClass(), UnsafeUtils.toInts(chunk.getBytes()));
}

public static NativeObject newNativeInts(final SqueakImageContext img, final ClassObject klass, final int size) {
Expand All @@ -86,7 +86,7 @@ public static NativeObject newNativeInts(final SqueakImageContext img, final Cla
}

public static NativeObject newNativeLongs(final SqueakImageChunk chunk) {
return new NativeObject(chunk.getHash(), chunk.getSqueakClass(), UnsafeUtils.toLongs(chunk.getBytes()));
return new NativeObject(chunk.getHeader(), chunk.getSqueakClass(), UnsafeUtils.toLongs(chunk.getBytes()));
}

public static NativeObject newNativeLongs(final SqueakImageContext img, final ClassObject klass, final int size) {
Expand All @@ -98,7 +98,7 @@ public static NativeObject newNativeLongs(final SqueakImageContext img, final Cl
}

public static NativeObject newNativeShorts(final SqueakImageChunk chunk) {
return new NativeObject(chunk.getHash(), chunk.getSqueakClass(), UnsafeUtils.toShorts(chunk.getBytes()));
return new NativeObject(chunk.getHeader(), chunk.getSqueakClass(), UnsafeUtils.toShorts(chunk.getBytes()));
}

public static NativeObject newNativeShorts(final SqueakImageContext img, final ClassObject klass, final int size) {
Expand Down

0 comments on commit e1df9b2

Please sign in to comment.