From a068eca13ca09ac1de50bc4572dd53333fab8718 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 23 May 2022 15:59:58 +0200 Subject: [PATCH] Update `PushCharacter` bytecode (fixes #158) and make `SmalltalkImage>>#interpreterVMMakerVersion` work. See https://lists.squeakfoundation.org/pipermail/squeak-dev/2022-March/219464.html --- .../image/SqueakSystemAttributes.java | 15 ++++++++++----- .../bytecodes/SqueakBytecodeSistaV1Decoder.java | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/image/SqueakSystemAttributes.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/image/SqueakSystemAttributes.java index ba759331f..5709d0617 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/image/SqueakSystemAttributes.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/image/SqueakSystemAttributes.java @@ -36,7 +36,7 @@ public final class SqueakSystemAttributes { private final NativeObject vmVersion; private final NativeObject windowSystemName; private final NativeObject vmBuildId; - private final NativeObject graalVMInformation; + private final NativeObject interpreterClass; private final NativeObject systemProperties; private final NativeObject vmInformation; private final NativeObject maxFilenameLength; @@ -96,7 +96,12 @@ public SqueakSystemAttributes(final SqueakImageContext image) { final String date = new SimpleDateFormat("MMM dd yyyy HH:mm:ss zzz", Locale.US).format(new Date(MiscUtils.getStartTime())); vmBuildId = asByteString(String.format("%s %s (%s) built on %s", osName, osVersion, osArch, date)); - graalVMInformation = asByteString(MiscUtils.getGraalVMInformation()); + /* + * For SmalltalkImage>>#interpreterVMMakerVersion (see + * https://lists.squeakfoundation.org/pipermail/squeak-dev/2022-March/219464.html). + */ + interpreterClass = asByteString(String.format("TruffleSqueak Interpreter VMMaker.oscog-fn.3184 (%s)", MiscUtils.getGraalVMInformation())); + systemProperties = asByteString(MiscUtils.getSystemProperties()); vmInformation = asByteString(MiscUtils.getVMInformation()); maxFilenameLength = asByteString("255"); @@ -125,7 +130,7 @@ public AbstractSqueakObject getSystemAttribute(final int index) { case 1006: return getVmBuildId(); case 1007: - return getGraalVMInformation(); + return getInterpreterClass(); case 1008: return getSystemProperties(); case 1009: @@ -210,8 +215,8 @@ private NativeObject getVmBuildId() { } /** Attribute #1007: "Interpreter class (Cog VM only)". */ - private NativeObject getGraalVMInformation() { - return graalVMInformation.shallowCopyBytes(); + private NativeObject getInterpreterClass() { + return interpreterClass.shallowCopyBytes(); } /** Attribute #1008: "Cogit class (Cog VM only)". */ diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/bytecodes/SqueakBytecodeSistaV1Decoder.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/bytecodes/SqueakBytecodeSistaV1Decoder.java index c4354e9c3..737f428c2 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/bytecodes/SqueakBytecodeSistaV1Decoder.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/bytecodes/SqueakBytecodeSistaV1Decoder.java @@ -205,7 +205,7 @@ private static AbstractBytecodeNode decodeBytecode(final VirtualFrame frame, fin case 0xE8: return new PushBytecodes.PushSmallIntegerNode(code, index, 2 + extBytes, Byte.toUnsignedInt(bytecode[indexWithExt + 1]) + (extB << 8)); case 0xE9: - return new PushBytecodes.PushCharacterNode(code, index, 2 + extBytes, Byte.toUnsignedInt(bytecode[indexWithExt + 1]) + (extB << 8)); + return new PushBytecodes.PushCharacterNode(code, index, 2 + extBytes, Byte.toUnsignedInt(bytecode[indexWithExt + 1]) + (extA << 8)); case 0xEA: { final int byte1 = Byte.toUnsignedInt(bytecode[indexWithExt + 1]); final int literalIndex = (byte1 >> 3) + (extA << 5);