Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ac9048b
Add support for Class objects (wip)
ggleyzer Feb 10, 2026
b9134db
Fix comments; refactor names to avoid collision/confusion
ggleyzer Feb 10, 2026
920da0d
Add support for FormalChildTypeConstant
ggleyzer Feb 10, 2026
0db656c
Fix IndexOp
ggleyzer Feb 10, 2026
7d1b143
Initial support for custom XVM primitives (e.g. Int128 and UInt128)
thegridman Feb 11, 2026
227b4d3
Delegate all TypeConstant.ensureJitClassName() calls to the correspon…
ggleyzer Feb 11, 2026
20eb3be
Fix OpCallable and MoveCast ops
ggleyzer Feb 11, 2026
23e8892
Simple refactoring
ggleyzer Feb 11, 2026
9347ffe
Add native Array methods
ggleyzer Feb 11, 2026
67aa790
Fix Array compilation (WIP)
ggleyzer Feb 11, 2026
452613d
Tighten GenericTypeResolver default implementation
ggleyzer Feb 12, 2026
a863dc2
Fix Int128 and UInt128 primitive conversions. Add GP ops for Int128 a…
thegridman Feb 12, 2026
689a757
Add Int128 and UInt128 inc (++), dec (--) and subtract IP and GP ops
thegridman Feb 12, 2026
e31f388
Trivial refactoring and docs
ggleyzer Feb 12, 2026
b1a3bf3
Fix FinallyEnd.java for multi slot primitive returns
thegridman Feb 13, 2026
96fda9d
Fix a typo
ggleyzer Feb 12, 2026
45dfbe8
Fix FormalTypeParam resolution
ggleyzer Feb 13, 2026
41be3f1
Extract RegisterInfo implementations into separate files
ggleyzer Feb 13, 2026
1c403ba
Adding Int128 and UInt128 support for more GP and IP ops.
thegridman Feb 17, 2026
ffc5e8c
Add call tests
ggleyzer Feb 16, 2026
a09a635
Exclude properties from narrowing
ggleyzer Feb 16, 2026
620428b
Add an "action" to the Label op
ggleyzer Feb 16, 2026
0d1cee1
Add scope ops for narrowed conditions
ggleyzer Feb 18, 2026
7fb6364
Simplify narrowed scope handling
ggleyzer Feb 19, 2026
0ee434f
Use AlwaysNull flavor for Narrowed registers
ggleyzer Feb 19, 2026
0ae0e8d
Simplify handling of registers of "*WithDefault" flavors
ggleyzer Feb 21, 2026
dff1ebe
Add Dec32, Dec64 and Dec128 primitive types
thegridman Feb 27, 2026
ce4a19d
Introduce ArrayBuilder
ggleyzer Feb 23, 2026
7c5a94e
Implement ConOpExpression.generateConditionalJump() specialization
ggleyzer Feb 27, 2026
01beba3
Add TypeConstant.isEquivalent() method
ggleyzer Feb 27, 2026
194b097
Compile Array.x
ggleyzer Feb 28, 2026
74a74ad
Add ArrayConstant initialization
ggleyzer Mar 1, 2026
625b7c0
Fix multi-slot property handling
ggleyzer Mar 1, 2026
9f8f972
Post review changes
ggleyzer Mar 2, 2026
4a34c39
Add Float32 and Float64 support to the JIT
thegridman Mar 3, 2026
0c56dd9
Fix Dec64 GP_Neg op
thegridman Mar 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions javatools/src/main/java/org/xvm/asm/Constant.java
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,9 @@ public TypeConstant getType(ConstantPool pool) {
case UInt64 -> pool.typeUInt64();
case UInt128 -> pool.typeUInt128();
case UIntN -> pool.typeUIntN();
case Dec32 -> pool.typeDec32();
case Dec64 -> pool.typeDec64();
case Dec128 -> pool.typeDec128();
default -> pool.ensureEcstasyTypeConstant(getEcstasyName());
};
}
Expand Down
26 changes: 26 additions & 0 deletions javatools/src/main/java/org/xvm/asm/ConstantPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,9 @@ public DifferenceTypeConstant ensureDifferenceTypeConstant(TypeConstant constTyp
public TypeConstant typeUInt64() {TypeConstant c = m_typeUInt64; if (c == null) {m_typeUInt64 = c = ensureTerminalTypeConstant(clzUInt64() );} return c;}
public TypeConstant typeUInt128() {TypeConstant c = m_typeUInt128; if (c == null) {m_typeUInt128 = c = ensureTerminalTypeConstant(clzUInt128() );} return c;}
public TypeConstant typeUIntN() {TypeConstant c = m_typeUIntN; if (c == null) {m_typeUIntN = c = ensureTerminalTypeConstant(clzUIntN() );} return c;}
public TypeConstant typeDec32() {TypeConstant c = m_typeDec32; if (c == null) {m_typeDec32 = c = ensureTerminalTypeConstant(clzDec32() );} return c;}
public TypeConstant typeDec64() {TypeConstant c = m_typeDec64; if (c == null) {m_typeDec64 = c = ensureTerminalTypeConstant(clzDec64() );} return c;}
public TypeConstant typeDec128() {TypeConstant c = m_typeDec128; if (c == null) {m_typeDec128 = c = ensureTerminalTypeConstant(clzDec128() );} return c;}
public TypeConstant typeFloat32() {TypeConstant c = m_typeFloat32; if (c == null) {m_typeFloat32 = c = ensureTerminalTypeConstant(clzFloat32() );} return c;}
public TypeConstant typeFloat64() {TypeConstant c = m_typeFloat64; if (c == null) {m_typeFloat64 = c = ensureTerminalTypeConstant(clzFloat64() );} return c;}
public TypeConstant typeIndexed() {TypeConstant c = m_typeIndexed; if (c == null) {m_typeIndexed = c = ensureTerminalTypeConstant(clzIndexed() );} return c;}
Expand Down Expand Up @@ -2217,13 +2219,19 @@ public DifferenceTypeConstant ensureDifferenceTypeConstant(TypeConstant constTyp
public TypeConstant typeException१() {TypeConstant c = m_typeException१; if (c == null) {m_typeException१ = c = ensureNullableTypeConstant(typeException() );} return c;}
public TypeConstant typeString१() {TypeConstant c = m_typeString१; if (c == null) {m_typeString१ = c = ensureNullableTypeConstant(typeString() );} return c;}
public TypeConstant typeInjector() {TypeConstant c = m_typeInjector; if (c == null) {m_typeInjector = c = ensureTerminalTypeConstant(clzInjector() );} return c;}
public TypeConstant typeRounding() {TypeConstant c = m_typeRounding; if (c == null) {m_typeRounding = c = ensureTerminalTypeConstant(clzRounding() );} return c;}

public IntConstant val0() {IntConstant c = m_val0; if (c == null) {m_val0 = c = ensureIntConstant(0) ;} return c;}
public SingletonConstant valFalse() {SingletonConstant c = m_valFalse; if (c == null) {m_valFalse = c = ensureSingletonConstConstant(clzFalse() );} return c;}
public SingletonConstant valTrue() {SingletonConstant c = m_valTrue; if (c == null) {m_valTrue = c = ensureSingletonConstConstant(clzTrue() );} return c;}
public SingletonConstant valLesser() {SingletonConstant c = m_valLesser; if (c == null) {m_valLesser = c = ensureSingletonConstConstant(clzLesser() );} return c;}
public SingletonConstant valEqual() {SingletonConstant c = m_valEqual; if (c == null) {m_valEqual = c = ensureSingletonConstConstant(clzEqual() );} return c;}
public SingletonConstant valGreater() {SingletonConstant c = m_valGreater; if (c == null) {m_valGreater = c = ensureSingletonConstConstant(clzGreater() );} return c;}
public SingletonConstant valTiesToEven() {SingletonConstant c = m_valTiesToEven; if (c == null) {m_valTiesToEven = c = ensureSingletonConstConstant(clzTiesToEven() );} return c;}
public SingletonConstant valTiesToAway() {SingletonConstant c = m_valTiesToAway; if (c == null) {m_valTiesToAway = c = ensureSingletonConstConstant(clzTiesToAway() );} return c;}
public SingletonConstant valTowardPositive() {SingletonConstant c = m_valTowardPositive; if (c == null) {m_valTowardPositive = c = ensureSingletonConstConstant(clzTowardPositive() );} return c;}
public SingletonConstant valTowardZero() {SingletonConstant c = m_valTowardZero; if (c == null) {m_valTowardZero = c = ensureSingletonConstConstant(clzTowardZero() );} return c;}
public SingletonConstant valTowardNegative() {SingletonConstant c = m_valTowardNegative; if (c == null) {m_valTowardNegative = c = ensureSingletonConstConstant(clzTowardNegative() );} return c;}

public RegisterConstant valDefault() {RegisterConstant c = m_valDefault; if (c == null) {m_valDefault = c = new RegisterConstant(this, Register.DEFAULT) ;} return c;}

Expand Down Expand Up @@ -2266,7 +2274,9 @@ public DifferenceTypeConstant ensureDifferenceTypeConstant(TypeConstant constTyp
protected ClassConstant clzUInt64() {return (ClassConstant) getImplicitlyImportedIdentity("UInt64" );}
protected ClassConstant clzUInt128() {return (ClassConstant) getImplicitlyImportedIdentity("UInt128" );}
protected ClassConstant clzUIntN() {return (ClassConstant) getImplicitlyImportedIdentity("UIntN" );}
protected ClassConstant clzDec32() {return (ClassConstant) getImplicitlyImportedIdentity("Dec32" );}
protected ClassConstant clzDec64() {return (ClassConstant) getImplicitlyImportedIdentity("Dec64" );}
protected ClassConstant clzDec128() {return (ClassConstant) getImplicitlyImportedIdentity("Dec128" );}
protected ClassConstant clzFloat32() {return (ClassConstant) getImplicitlyImportedIdentity("Float32" );}
protected ClassConstant clzFloat64() {return (ClassConstant) getImplicitlyImportedIdentity("Float64" );}
protected ClassConstant clzIndexed() {return (ClassConstant) getImplicitlyImportedIdentity("UniformIndexed" );}
Expand All @@ -2290,6 +2300,12 @@ public DifferenceTypeConstant ensureDifferenceTypeConstant(TypeConstant constTyp
protected ClassConstant clzFileNode() {return ensureEcstasyClassConstant ("fs.FileNode" );}
protected ClassConstant clzFileStore() {return (ClassConstant) getImplicitlyImportedIdentity("FileStore" );}
protected ClassConstant clzInjector() {return ensureEcstasyClassConstant ("reflect.Injector" );}
protected ClassConstant clzRounding() {return (ClassConstant) getImplicitlyImportedIdentity("Rounding" );}
protected ClassConstant clzTiesToEven() {return (ClassConstant) getImplicitlyImportedIdentity("TiesToEven" );}
protected ClassConstant clzTiesToAway() {return (ClassConstant) getImplicitlyImportedIdentity("TiesToAway" );}
protected ClassConstant clzTowardPositive(){return (ClassConstant) getImplicitlyImportedIdentity("TowardPositive" );}
protected ClassConstant clzTowardZero() {return (ClassConstant) getImplicitlyImportedIdentity("TowardZero" );}
protected ClassConstant clzTowardNegative(){return (ClassConstant) getImplicitlyImportedIdentity("TowardNegative" );}

/**
* A special TypeInfo that acts as a place-holder for "this TypeInfo is currently being built".
Expand Down Expand Up @@ -3688,7 +3704,9 @@ private void optimize() {
m_typeUInt64 = null;
m_typeUInt128 = null;
m_typeUIntN = null;
m_typeDec32 = null;
m_typeDec64 = null;
m_typeDec128 = null;
m_typeFloat32 = null;
m_typeFloat64 = null;
m_typeIndexed = null;
Expand Down Expand Up @@ -3988,7 +4006,9 @@ private void optimize() {
private transient TypeConstant m_typeUInt64;
private transient TypeConstant m_typeUInt128;
private transient TypeConstant m_typeUIntN;
private transient TypeConstant m_typeDec32;
private transient TypeConstant m_typeDec64;
private transient TypeConstant m_typeDec128;
private transient TypeConstant m_typeFloat32;
private transient TypeConstant m_typeFloat64;
private transient TypeConstant m_typeIndexed;
Expand Down Expand Up @@ -4023,13 +4043,19 @@ private void optimize() {
private transient TypeConstant m_typeFile;
private transient TypeConstant m_typeFileNode;
private transient TypeConstant m_typeInjector;
private transient TypeConstant m_typeRounding;
private transient IntConstant m_val0;
private transient SingletonConstant m_valFalse;
private transient SingletonConstant m_valTrue;
private transient SingletonConstant m_valLesser;
private transient SingletonConstant m_valEqual;
private transient SingletonConstant m_valGreater;
private transient SingletonConstant m_valNull;
private transient SingletonConstant m_valTiesToEven;
private transient SingletonConstant m_valTiesToAway;
private transient SingletonConstant m_valTowardPositive;
private transient SingletonConstant m_valTowardZero;
private transient SingletonConstant m_valTowardNegative;
private transient RegisterConstant m_valDefault;
private transient SignatureConstant m_sigToString;
private transient SignatureConstant m_sigEquals;
Expand Down
47 changes: 43 additions & 4 deletions javatools/src/main/java/org/xvm/asm/GenericTypeResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Map;

import org.xvm.asm.constants.FormalConstant;
import org.xvm.asm.constants.PropertyConstant;
import org.xvm.asm.constants.TypeConstant;


Expand All @@ -17,7 +18,7 @@ public interface GenericTypeResolver {
*
* @param sFormalName the formal parameter name
*
* @return a resolved type
* @return a resolved type, or null if it could not be resolved
*/
TypeConstant resolveGenericType(String sFormalName);

Expand All @@ -26,10 +27,12 @@ public interface GenericTypeResolver {
*
* @param constFormal the formal constant
*
* @return a resolved type
* @return a resolved type, or null if it could not be resolved
*/
default TypeConstant resolveFormalType(FormalConstant constFormal) {
return resolveGenericType(constFormal.getName());
return constFormal instanceof PropertyConstant
? resolveGenericType(constFormal.getName())
: null;
}

/**
Expand All @@ -38,6 +41,12 @@ default TypeConstant resolveFormalType(FormalConstant constFormal) {
static GenericTypeResolver of(Map<FormalConstant, TypeConstant> mapResolve) {
return new TypeParameterResolver(mapResolve);
}
/**
* Create a GenericTypeResolver based on two resolvers.
*/
static GenericTypeResolver chain(GenericTypeResolver resolver1, GenericTypeResolver resolver2) {
return new ChainResolver(resolver1, resolver2);
}

/**
* Trivial GenericTypeResolver implementation based on a Map<FormalConstant, TypeConstant>.
Expand All @@ -56,6 +65,36 @@ public TypeConstant resolveFormalType(FormalConstant constFormal) {
return mapResolve.get(constFormal);
}

Map<FormalConstant, TypeConstant> mapResolve;
private final Map<FormalConstant, TypeConstant> mapResolve;
}

/**
* Chain GenericTypeResolver implementation.
*/
class ChainResolver
implements GenericTypeResolver {
public ChainResolver(GenericTypeResolver resolver1, GenericTypeResolver resolver2) {
this.resolver1 = resolver1;
this.resolver2 = resolver2;
}

@Override
public TypeConstant resolveGenericType(String sFormalName) {
TypeConstant type = resolver1.resolveGenericType(sFormalName);
return type == null
? resolver2.resolveGenericType(sFormalName)
: type;
}

@Override
public TypeConstant resolveFormalType(FormalConstant constFormal) {
TypeConstant type = resolver1.resolveFormalType(constFormal);
return type == null
? resolver2.resolveFormalType(constFormal)
: type;
}

private final GenericTypeResolver resolver1;
private final GenericTypeResolver resolver2;
}
}
5 changes: 4 additions & 1 deletion javatools/src/main/java/org/xvm/asm/Op.java
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,11 @@ public void computeTypes(BuildContext bctx) {

/**
* Build the Java code for this op.
*
* @return -1 to proceed to the next op, or a positive op address to eliminate all code up to
* that address
*/
public void build(BuildContext bctx, CodeBuilder code) {
public int build(BuildContext bctx, CodeBuilder code) {
throw new UnsupportedOperationException(toString());
}

Expand Down
Loading
Loading