5858import com .oracle .svm .espresso .classfile .JavaVersion ;
5959import com .oracle .svm .espresso .classfile .ParserMethod ;
6060import com .oracle .svm .espresso .classfile .attributes .CodeAttribute ;
61+ import com .oracle .svm .espresso .classfile .descriptors .ByteSequence ;
6162import com .oracle .svm .espresso .classfile .descriptors .Name ;
6263import com .oracle .svm .espresso .classfile .descriptors .ParserSymbols ;
6364import com .oracle .svm .espresso .classfile .descriptors .Signature ;
@@ -283,7 +284,7 @@ public static InterpreterResolvedJavaMethod createForDeserialization(String name
283284 byte [] code , ExceptionHandler [] exceptionHandlers , LineNumberTable lineNumberTable , LocalVariableTable localVariableTable ,
284285 ReferenceConstant <FunctionPointerHolder > nativeEntryPoint , int vtableIndex , int gotOffset , int enterStubOffset , int methodId ) {
285286 Symbol <Name > nameSymbol = SymbolsSupport .getNames ().getOrCreate (name );
286- Symbol <Signature > signatureSymbol = CremaMethodAccess . toSymbol (signature , SymbolsSupport . getSignatures () );
287+ Symbol <Signature > signatureSymbol = toSymbol (signature );
287288 return new InterpreterResolvedJavaMethod (nameSymbol , maxLocals , maxStackSize , flags , declaringClass , signature , signatureSymbol , code ,
288289 exceptionHandlers , lineNumberTable , localVariableTable , nativeEntryPoint , vtableIndex , gotOffset , enterStubOffset , methodId );
289290 }
@@ -296,12 +297,26 @@ public static InterpreterResolvedJavaMethod createAtBuildTime(ResolvedJavaMethod
296297 byte [] code , ExceptionHandler [] exceptionHandlers , LineNumberTable lineNumberTable , LocalVariableTable localVariableTable ,
297298 ReferenceConstant <FunctionPointerHolder > nativeEntryPoint , int vtableIndex , int gotOffset , int enterStubOffset , int methodId ) {
298299 Symbol <Name > nameSymbol = SymbolsSupport .getNames ().getOrCreate (name );
299- Symbol <Signature > signatureSymbol = CremaMethodAccess . toSymbol (signature , SymbolsSupport . getSignatures () );
300+ Symbol <Signature > signatureSymbol = toSymbol (signature );
300301 int flags = createFlags (modifiers , declaringClass , signatureSymbol , isSubstitutedNative , originalMethod );
301302 return new InterpreterResolvedJavaMethod (originalMethod , nameSymbol , maxLocals , maxStackSize , flags , declaringClass , signature , signatureSymbol , code ,
302303 exceptionHandlers , lineNumberTable , localVariableTable , nativeEntryPoint , vtableIndex , gotOffset , enterStubOffset , methodId );
303304 }
304305
306+ private static Symbol <Signature > toSymbol (InterpreterUnresolvedSignature jvmciSignature ) {
307+ // hidden classes and SVM stable proxy name contain a `.`, replace with a `+`
308+ StringBuilder sb = new StringBuilder ();
309+ sb .append ('(' );
310+ for (int i = 0 ; i < jvmciSignature .getParameterCount (false ); i ++) {
311+ sb .append (jvmciSignature .getParameterType (i , null ).getName ().replace ('.' , '+' ));
312+ }
313+ sb .append (')' );
314+ sb .append (jvmciSignature .getReturnType (null ).getName ().replace ('.' , '+' ));
315+ Symbol <Signature > symbol = SymbolsSupport .getSignatures ().getOrCreateValidSignature (ByteSequence .create (sb .toString ()));
316+ assert symbol != null : jvmciSignature ;
317+ return symbol ;
318+ }
319+
305320 @ Platforms (Platform .HOSTED_ONLY .class )
306321 private static int createFlags (int modifiers , InterpreterResolvedObjectType declaringClass , Symbol <Signature > signatureSymbol , boolean isSubstitutedNative , ResolvedJavaMethod originalMethod ) {
307322 int newModifiers = modifiers ;
0 commit comments