Changeset 4305 for trunk/ProjectFortress
- Timestamp:
- 11/02/09 14:49:00 (3 weeks ago)
- Location:
- trunk/ProjectFortress
- Files:
-
- 3 added
- 6 modified
-
compiler_tests/AfterTypeChecking.test (modified) (1 diff)
-
compiler_tests/Compiled12.inherit.fss (modified) (2 diffs)
-
compiler_tests/Compiled12.inherit.test (added)
-
compiler_tests/TreapAndTest.fss (added)
-
compiler_tests/TreapAndTest.test (added)
-
src/com/sun/fortress/compiler/NamingCzar.java (modified) (2 diffs)
-
src/com/sun/fortress/compiler/codegen/CodeGen.java (modified) (2 diffs)
-
src/com/sun/fortress/compiler/codegen/ManglingClassWriter.java (modified) (4 diffs)
-
src/com/sun/fortress/runtimeSystem/Naming.java (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ProjectFortress/compiler_tests/AfterTypeChecking.test
r4304 r4305 26 26 Compiled10.Comprehensions3 Compiled10.l Compiled10.m Compiled10.r \ 27 27 Compiled11 \ 28 Compiled12 Compiled12.inherit.fss28 Compiled12 29 29 typecheck -
trunk/ProjectFortress/compiler_tests/Compiled12.inherit.fss
r4302 r4305 18 18 export Executable 19 19 20 trait T (* comprises { U, V } *)20 trait T comprises { U, V } 21 21 abstract getter asString(): String 22 22 abstract m(t:T): T … … 30 30 end 31 31 32 trait V extends T (* comprises { W, X } *)32 trait V extends T comprises { W, X } 33 33 m(t:T): T = t.mv(self) 34 34 mv(v:V): T = self -
trunk/ProjectFortress/src/com/sun/fortress/compiler/NamingCzar.java
r4300 r4305 97 97 "$" + WellKnownNames.anyTypeName; 98 98 99 // java.lang.Object correctly formatted for asm generation100 public static final String javaObject = "java/lang/Object";101 102 99 // Base class for all executable Fortress Components 103 100 public static final String fortressExecutable = "com/sun/fortress/runtimeSystem/FortressExecutable"; … … 109 106 110 107 // Base class for non-executable Fortress Components 111 public static final String fortressComponent = javaObject;108 public static final String fortressComponent = Naming.javaObject; 112 109 113 110 public static final String primordialTask = "com/sun/fortress/runtimeSystem/PrimordialTask"; -
trunk/ProjectFortress/src/com/sun/fortress/compiler/codegen/CodeGen.java
r4300 r4305 971 971 972 972 body.accept(this); 973 exitMethodScope(selfIndex, selfVar, paramsGen); 974 } 973 try { 974 exitMethodScope(selfIndex, selfVar, paramsGen); 975 } catch (Throwable t) { 976 throw new Error("\n"+NodeUtil.getSpan(body)+": Error trying to close method scope.",t); 977 } 978 } 979 980 private static final Modifiers fnDeclCompilableModifiers = 981 Modifiers.GetterSetter.combine(Modifiers.IO).combine( 982 Modifiers.Private).combine(Modifiers.Abstract); 975 983 976 984 public void forFnDecl(FnDecl x) { … … 1043 1051 header.getThrowsClause().isNone() && // no throws clause 1044 1052 header.getContract().isNone() && // no contract 1045 header.getMods().isEmpty() && // nomodifiers1053 header.getMods().remove(fnDeclCompilableModifiers).isEmpty() && // no unhandled modifiers 1046 1054 !inABlock; // no local functions 1047 1055 -
trunk/ProjectFortress/src/com/sun/fortress/compiler/codegen/ManglingClassWriter.java
r4273 r4305 41 41 42 42 public MethodVisitor visitCGMethod(int access, String name, String desc, String signature, String[] exceptions) { 43 43 44 44 return new ManglingMethodVisitor(super.visitMethod(access, name, desc, signature, exceptions)); 45 45 } … … 49 49 protected String getCommonSuperClass(String type1, String type2) { 50 50 // We may need to do something interesting here. 51 // [added try/catch wrapper to get useful information out on failure - JWM]51 // Consider doing it pre-emptively rather than copping out on failure. 52 52 try { 53 53 return super.getCommonSuperClass(type1, type2); 54 54 } catch (Throwable e) { 55 throw new Error("Couldn't getCommonSuperClass("+type1+", "+type2+")",e); 55 // [added try/catch wrapper to get useful information out on failure - JWM] 56 // throw new Error("Couldn't getCommonSuperClass("+type1+", "+type2+")",e); 57 58 // Note: the following apparent cop-out was gleaned by perusing: 59 // http://www.java2s.com/Open-Source/Java-Document/Byte-Code/asm/org/objectweb/asm/ClassWriterComputeFramesTest.java.htm 60 // This returns java.lang.Object as the CommonSuperClass of anything involving an interface 61 // type. Since all Fortress traits correspond to interface types, we ought to be able to 62 // do the same. 63 // 64 // That said, it still feels wrong. 65 return Naming.javaObject; 56 66 } 57 67 } … … 63 73 name = Naming.mangleFortressIdentifier(name); 64 74 superName = Naming.mangleFortressIdentifier(superName); 65 75 66 76 String[] _interfaces = 67 77 interfaces == null ? null : new String[interfaces.length]; … … 110 120 111 121 } 112 113 122 -
trunk/ProjectFortress/src/com/sun/fortress/runtimeSystem/Naming.java
r4291 r4305 35 35 public final static String INDEX = "\u261e"; // "__"; // "\u261e"; // white right point index (for dotted of functional methods) 36 36 public final static String BOX = "\u2610"; // ballot box, used to indicate prefix or postfix. 37 37 38 38 public static final String BALLOT_BOX_WITH_CHECK = "\u2611"; // boolean static param 39 39 public static final String SCALES = "\u2696"; // dimension static param … … 43 43 public static final String YINYANG = "\u262f"; // type static param 44 44 public static final String ATOM = "\u269b"; // unit static param 45 46 public static final String GENERIC_TAGS = 45 46 public static final String GENERIC_TAGS = 47 47 BALLOT_BOX_WITH_CHECK + SCALES + MUSIC_SHARP + 48 48 HAMMER_AND_PICK + YINYANG + ATOM; … … 76 76 77 77 public static final String runtimeValues = "com/sun/fortress/compiler/runtimeValues/"; 78 79 // java.lang.Object correctly formatted for asm generation 80 public static final String javaObject = "java/lang/Object"; 78 81 79 82 /** … … 355 358 case 'Z': 356 359 case 'V': // should only appear in return if well-formed 357 360 358 361 case '[': // eat array indicator 359 362 case '(': // eat intro and outro, assume well-formed … … 371 374 } 372 375 return sb.toString(); 373 } 374 376 } 377 375 378 public static String demangleMethodSignature(String s) { 376 379 StringBuffer sb = new StringBuffer(); … … 389 392 case 'Z': 390 393 case 'V': // should only appear in return if well-formed 391 394 392 395 case '[': // eat array indicator 393 396 case '(': // eat intro and outro, assume well-formed … … 406 409 return sb.toString(); 407 410 } 408 411 409 412 /** 410 413 * Mangles the chunks of a fortress identifier, where the chunks are 411 414 * delimited by $, /, and ; appearing outside of Oxford brackets. 412 * 415 * 413 416 * Returns either when the string is exhausted, 414 417 * or after a semicolon is processed. 415 * 418 * 416 419 * @param s the string to mangle 417 420 * @param i the index to begin at … … 422 425 return mangleOrNotFortressIdentifier(s,start, sb,true); 423 426 } 424 427 425 428 public static String mangleFortressIdentifier(String s) { 426 429 if (s == null) … … 437 440 return t; 438 441 } 439 442 440 443 /** 441 444 * Expects a type, surrounded by L;, or one of the descriptor type characters. … … 460 463 * Names beginning and end with less-than and greater-than are left along 461 464 * (init, clinit) 462 * 465 * 463 466 * @param s 464 467 * @return … … 477 480 * DE-mangles the chunks of a fortress identifier, where the chunks are 478 481 * delimited by $, /, and ; appearing outside of Oxford brackets. 479 * 482 * 480 483 * Returns either when the string is exhausted, 481 484 * or after a semicolon is processed. 482 * 485 * 483 486 * @param s the string to mangle 484 487 * @param i the index to begin at … … 489 492 return mangleOrNotFortressIdentifier(s,start, sb,false); 490 493 } 491 494 492 495 public static String demangleFortressIdentifier(String s) { 493 496 if (s == null) 494 497 return null; 495 498 int l = s.length(); 496 499 497 500 // Special case of <init> and <clinit> 498 501 if (pointyDelimitedInitMethod(s)) … … 514 517 } 515 518 516 519 517 520 private static int mangleOrNotFortressIdentifier(String s, int start, StringBuffer sb, boolean mangleOrNot) { 518 521 int l = s.length(); 519 522 int nesting = 0; 520 523 521 524 for (int i = start; i < l; i++) { 522 525 char ch = s.charAt(i); … … 551 554 } 552 555 } 553 556 554 557 555 558 /** … … 637 640 if (mangledString.startsWith("\\-")) 638 641 mangledString = mangledString; 639 642 640 643 return mangledString; 641 644 }

