IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
IKVM.Runtime.RuntimeByteCodeJavaType Class Referencesealed
Inheritance diagram for IKVM.Runtime.RuntimeByteCodeJavaType:
IKVM.Tools.Importer.RuntimeImportByteCodeJavaType

Classes

class  FinishContext
 

Static Protected Member Functions

static void GetParameterNamesFromLVT (ClassFile.Method m, string[] parameterNames)
 
static void GetParameterNamesFromSig (string sig, string[] parameterNames)
 
static ParameterBuilder[] GetParameterBuilders (MethodBuilder mb, int parameterCount, string[] parameterNames)
 

Protected Attributes

readonly RuntimeClassLoader classLoader
 

Detailed Description

Definition at line 35 of file RuntimeByteCodeJavaType.Metadata.cs.

Member Function Documentation

◆ GetParameterBuilders()

static ParameterBuilder[] IKVM.Runtime.RuntimeByteCodeJavaType.GetParameterBuilders ( MethodBuilder mb,
int parameterCount,
string[] parameterNames )
staticprotected

Definition at line 592 of file RuntimeByteCodeJavaType.cs.

593 {
594 var parameterBuilders = new ParameterBuilder[parameterCount];
595 Dictionary<string, int> clashes = null;
596 for (int i = 0; i < parameterBuilders.Length; i++)
597 {
598 string name = null;
599 if (parameterNames != null && parameterNames[i] != null)
600 {
601 name = parameterNames[i];
602 if (Array.IndexOf(parameterNames, name, i + 1) >= 0 || (clashes != null && clashes.ContainsKey(name)))
603 {
604 clashes ??= new Dictionary<string, int>();
605
606 int clash = 1;
607 if (clashes.ContainsKey(name))
608 clash = clashes[name] + 1;
609
610 clashes[name] = clash;
611 name += clash;
612 }
613 }
614 parameterBuilders[i] = mb.DefineParameter(i + 1, ParameterAttributes.None, name);
615 }
616 return parameterBuilders;
617 }

◆ GetParameterNamesFromLVT()

static void IKVM.Runtime.RuntimeByteCodeJavaType.GetParameterNamesFromLVT ( ClassFile.Method m,
string[] parameterNames )
staticprotected

Definition at line 478 of file RuntimeByteCodeJavaType.cs.

479 {
480 var localVars = m.LocalVariableTableAttribute;
481 if (localVars != null)
482 {
483 for (int i = m.IsStatic ? 0 : 1, pos = 0; i < m.ArgMap.Length; i++)
484 {
485 // skip double & long fillers
486 if (m.ArgMap[i] != -1)
487 {
488 if (parameterNames[pos] == null)
489 {
490 for (int j = 0; j < localVars.Length; j++)
491 {
492 if (localVars[j].index == i)
493 {
494 parameterNames[pos] = localVars[j].name;
495 break;
496 }
497 }
498 }
499
500 pos++;
501 }
502 }
503 }
504 }

◆ GetParameterNamesFromSig()

static void IKVM.Runtime.RuntimeByteCodeJavaType.GetParameterNamesFromSig ( string sig,
string[] parameterNames )
staticprotected

Definition at line 506 of file RuntimeByteCodeJavaType.cs.

507 {
508 var names = new List<string>();
509 for (int i = 1; sig[i] != ')'; i++)
510 {
511 if (sig[i] == 'L')
512 {
513 i++;
514 int end = sig.IndexOf(';', i);
515 names.Add(GetParameterName(sig.Substring(i, end - i)));
516 i = end;
517 }
518 else if (sig[i] == '[')
519 {
520 while (sig[++i] == '[') ;
521 if (sig[i] == 'L')
522 {
523 i++;
524 int end = sig.IndexOf(';', i);
525 names.Add(GetParameterName(sig.Substring(i, end - i)) + "arr");
526 i = end;
527 }
528 else
529 {
530 switch (sig[i])
531 {
532 case 'B':
533 case 'Z':
534 names.Add("barr");
535 break;
536 case 'C':
537 names.Add("charr");
538 break;
539 case 'S':
540 names.Add("sarr");
541 break;
542 case 'I':
543 names.Add("iarr");
544 break;
545 case 'J':
546 names.Add("larr");
547 break;
548 case 'F':
549 names.Add("farr");
550 break;
551 case 'D':
552 names.Add("darr");
553 break;
554 }
555 }
556 }
557 else
558 {
559 switch (sig[i])
560 {
561 case 'B':
562 case 'Z':
563 names.Add("b");
564 break;
565 case 'C':
566 names.Add("ch");
567 break;
568 case 'S':
569 names.Add("s");
570 break;
571 case 'I':
572 names.Add("i");
573 break;
574 case 'J':
575 names.Add("l");
576 break;
577 case 'F':
578 names.Add("f");
579 break;
580 case 'D':
581 names.Add("d");
582 break;
583 }
584 }
585 }
586
587 for (int i = 0; i < parameterNames.Length; i++)
588 if (parameterNames[i] == null)
589 parameterNames[i] = names[i];
590 }

Member Data Documentation

◆ classLoader

readonly RuntimeClassLoader IKVM.Runtime.RuntimeByteCodeJavaType.classLoader
protected

Definition at line 68 of file RuntimeByteCodeJavaType.cs.


The documentation for this class was generated from the following files: