Selaa lähdekoodia

* always return a LOC_JUMP from tjvmnotnode.second_boolean: required both
to correctly handle non-pasbool types (can't just "not" their value),
and for Dalvik (a "not pasbool" became "xori 1", which turned the value
from a boolean into an integer as far as the Dalvik type checker was
concerned)

git-svn-id: branches/jvmbackend@20525 -

Jonas Maebe 13 vuotta sitten
vanhempi
commit
83235a483b
5 muutettua tiedostoa jossa 1207 lisäystä ja 32 poistoa
  1. 1 0
      .gitattributes
  2. 23 32
      compiler/jvm/njvmmat.pas
  3. 1177 0
      tests/test/jvm/taddbool.pp
  4. 4 0
      tests/test/jvm/testall.bat
  5. 2 0
      tests/test/jvm/testall.sh

+ 1 - 0
.gitattributes

@@ -9778,6 +9778,7 @@ tests/test/jvm/nested.pp svneol=native#text/plain
 tests/test/jvm/outpara.pp svneol=native#text/plain
 tests/test/jvm/outpara.pp svneol=native#text/plain
 tests/test/jvm/sort.pp svneol=native#text/plain
 tests/test/jvm/sort.pp svneol=native#text/plain
 tests/test/jvm/tabs.pp svneol=native#text/plain
 tests/test/jvm/tabs.pp svneol=native#text/plain
+tests/test/jvm/taddbool.pp svneol=native#text/plain
 tests/test/jvm/taddset.pp svneol=native#text/plain
 tests/test/jvm/taddset.pp svneol=native#text/plain
 tests/test/jvm/taddsetint.pp svneol=native#text/plain
 tests/test/jvm/taddsetint.pp svneol=native#text/plain
 tests/test/jvm/tarray2.pp svneol=native#text/plain
 tests/test/jvm/tarray2.pp svneol=native#text/plain

+ 23 - 32
compiler/jvm/njvmmat.pas

@@ -41,6 +41,7 @@ interface
       end;
       end;
 
 
       tjvmnotnode = class(tcgnotnode)
       tjvmnotnode = class(tcgnotnode)
+         function pass_1: tnode; override;
          procedure second_boolean;override;
          procedure second_boolean;override;
       end;
       end;
 
 
@@ -170,45 +171,35 @@ implementation
                                tjvmnotnode
                                tjvmnotnode
 *****************************************************************************}
 *****************************************************************************}
 
 
+    function tjvmnotnode.pass_1: tnode;
+      begin
+        result:=inherited;
+        if not assigned(result) and
+           is_boolean(resultdef) then
+          expectloc:=LOC_JUMP;
+      end;
+
+
     procedure tjvmnotnode.second_boolean;
     procedure tjvmnotnode.second_boolean;
       var
       var
         hl : tasmlabel;
         hl : tasmlabel;
       begin
       begin
-        { if the location is LOC_JUMP, we do the secondpass after the
-          labels are allocated
-        }
-        if left.expectloc=LOC_JUMP then
-          begin
-            hl:=current_procinfo.CurrTrueLabel;
-            current_procinfo.CurrTrueLabel:=current_procinfo.CurrFalseLabel;
-            current_procinfo.CurrFalseLabel:=hl;
-            secondpass(left);
-            hlcg.maketojumpbool(current_asmdata.CurrAsmList,left);
-            hl:=current_procinfo.CurrTrueLabel;
-            current_procinfo.CurrTrueLabel:=current_procinfo.CurrFalseLabel;
-            current_procinfo.CurrFalseLabel:=hl;
-            location.loc:=LOC_JUMP;
-          end
-        else
-          begin
-            secondpass(left);
-            case left.location.loc of
-              LOC_REGISTER, LOC_CREGISTER,
-              LOC_REFERENCE, LOC_CREFERENCE:
-                begin
-                  location_reset(location,LOC_REGISTER,left.location.size);
-                  location.register:=hlcg.getintregister(current_asmdata.CurrAsmList,resultdef);
-                  thlcgjvm(hlcg).a_load_loc_stack(current_asmdata.CurrAsmList,left.resultdef,left.location);
-                  thlcgjvm(hlcg).a_op_reg_stack(current_asmdata.CurrAsmList,OP_NOT,left.resultdef,NR_NO);
-                  thlcgjvm(hlcg).a_load_stack_reg(current_asmdata.CurrAsmList,resultdef,location.register);
-                end;
-              else
-                internalerror(2011010417);
-            end;
-          end;
+        hl:=current_procinfo.CurrTrueLabel;
+        current_procinfo.CurrTrueLabel:=current_procinfo.CurrFalseLabel;
+        current_procinfo.CurrFalseLabel:=hl;
+        secondpass(left);
+        hlcg.maketojumpbool(current_asmdata.CurrAsmList,left);
+        hl:=current_procinfo.CurrTrueLabel;
+        current_procinfo.CurrTrueLabel:=current_procinfo.CurrFalseLabel;
+        current_procinfo.CurrFalseLabel:=hl;
+        location.loc:=LOC_JUMP;
       end;
       end;
 
 
 
 
+{*****************************************************************************
+                            tjvmunaryminustnode
+*****************************************************************************}
+
     procedure tjvmunaryminusnode.second_float;
     procedure tjvmunaryminusnode.second_float;
       var
       var
         opc: tasmop;
         opc: tasmop;

+ 1177 - 0
tests/test/jvm/taddbool.pp

@@ -0,0 +1,1177 @@
+{ Program to test Code generator secondadd()                 }
+{ with boolean values.                                       }
+{ FUNCTIONAL PRE-REQUISITES:                                 }
+{   - assignments function correctly.                        }
+{   - if statements function correctly.                      }
+{   - subroutine calls function correctly.                   }
+Program TAddBool;
+
+uses
+{$ifdef java}jdk15{$else}androidr14{$endif};
+
+procedure fail;
+begin
+  JLSystem.fout.println('Failed!');
+  halt(1);
+end;
+
+{ ---------------------------- BOOLEAN TEST ----------------------------- }
+{                              secondadd()                                }
+{ ----------------------------------------------------------------------- }
+
+procedure BoolTestAnd;
+var
+ b1, b2: boolean;
+ b161, b162: boolean16;
+ b321, b322: boolean32;
+ b641, b642: boolean64;
+ bb1, bb2: bytebool;
+ wb1, wb2: wordbool;
+ lb1, lb2: longbool;
+ result : boolean;
+begin
+ result := true;
+ { BOOLEAN AND BOOLEAN }
+ JLSystem.fout.print('boolean AND boolean test...');
+ b1 := true;
+ b2 := false;
+ if b1 and b2 then
+   result := false;
+ if b2 then
+   result := false;
+ b1 := false;
+ b2 := false;
+ if b1 and b2 then
+   result := false;
+
+ b1 := b1 and b2;
+ if b1 then
+   result := false;
+ if b1 and FALSE then
+   result := false;
+ b1 := true;
+ b2 := true;
+ if b1 and b2 then
+  begin
+    if result then
+      JLSystem.fout.println('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+
+ { BOOLEAN16 AND BOOLEAN16 }
+ JLSystem.fout.print('boolean16 AND boolean16 test...');
+ b161 := true;
+ b162 := false;
+ if b161 and b162 then
+   result := false;
+ if b162 then
+   result := false;
+ b161 := false;
+ b162 := false;
+ if b161 and b162 then
+   result := false;
+
+ b161 := b161 and b162;
+ if b161 then
+   result := false;
+ if b161 and FALSE then
+   result := false;
+ b161 := true;
+ b162 := true;
+ if b161 and b162 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+
+ { BOOLEAN32 AND BOOLEAN32 }
+ JLSystem.fout.print('boolean32 AND boolean32 test...');
+ b321 := true;
+ b322 := false;
+ if b321 and b322 then
+   result := false;
+ if b322 then
+   result := false;
+ b321 := false;
+ b322 := false;
+ if b321 and b322 then
+   result := false;
+
+ b321 := b321 and b322;
+ if b321 then
+   result := false;
+ if b321 and FALSE then
+   result := false;
+ b321 := true;
+ b322 := true;
+ if b321 and b322 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+
+ { BOOLEAN64 AND BOOLEAN64 }
+ JLSystem.fout.print('boolean64 AND boolean64 test...');
+ b641 := true;
+ b642 := false;
+ if b641 and b642 then
+   result := false;
+ if b642 then
+   result := false;
+ b641 := false;
+ b642 := false;
+ if b641 and b642 then
+   result := false;
+
+ b641 := b641 and b642;
+ if b641 then
+   result := false;
+ if b641 and FALSE then
+   result := false;
+ b641 := true;
+ b642 := true;
+ if b641 and b642 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+
+ { BYTEBOOL AND BYTEBOOL }
+ JLSystem.fout.print('bytebool AND bytebool test...');
+ bb1 := true;
+ bb2 := false;
+ if bb1 and bb2 then
+   result := false;
+ if bb2 then
+   result := false;
+ bb1 := false;
+ bb2 := false;
+ if bb1 and bb2 then
+   result := false;
+
+ bb1 := bb1 and bb2;
+ if bb1 then
+   result := false;
+ if bb1 and FALSE then
+   result := false;
+ bb1 := true;
+ bb2 := true;
+ if bb1 and bb2 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+
+ { WORDBOOL AND WORDBOOL }
+ result := true;
+ JLSystem.fout.print('wordbool AND wordbool test...');
+ wb1 := true;
+ wb2 := false;
+ if wb1 and wb2 then
+   result := false;
+ if wb2 then
+   result := false;
+ wb1 := false;
+ wb2 := false;
+ if wb1 and wb2 then
+   result := false;
+
+ wb1 := wb1 and wb2;
+ if wb1 then
+   result := false;
+ if wb1 and FALSE then
+   result := false;
+
+ wb1 := true;
+ wb2 := true;
+ if wb1 and wb2 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+
+ { LONGBOOL AND LONGBOOL }
+ result := true;
+ JLSystem.fout.print('longbool AND longbool test...');
+ lb1 := true;
+ lb2 := false;
+ if lb1 and lb2 then
+   result := false;
+ if lb2 then
+   result := false;
+ lb1 := false;
+ lb2 := false;
+ if lb1 and lb2 then
+   result := false;
+
+ lb1 := lb1 and lb2;
+ if lb1 then
+   result := false;
+ if lb1 and FALSE then
+   result := false;
+
+ lb1 := true;
+ lb2 := true;
+ if lb1 and lb2 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+end;
+
+
+procedure BoolTestOr;
+var
+ b1, b2: boolean;
+ b161, b162: boolean16;
+ b321, b322: boolean32;
+ b641, b642: boolean64;
+ bb1, bb2: bytebool;
+ wb1, wb2: wordbool;
+ lb1, lb2: longbool;
+ result : boolean;
+begin
+ result := false;
+ { BOOLEAN OR BOOLEAN }
+ JLSystem.fout.print('boolean OR boolean test...');
+ b1 := true;
+ b2 := false;
+ if b1 or b2 then
+   result := true;
+ b1 := false;
+ b2 := false;
+ if b1 or b2 then
+   result := false;
+
+ b1 := b1 or b2;
+ if b1 then
+   result := false;
+ if b1 or FALSE then
+   result := false;
+
+
+ b1 := true;
+ b2 := true;
+ if b1 or b2 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+
+ { BOOLEAN16 OR BOOLEAN16 }
+ JLSystem.fout.print('boolean16 OR boolean16 test...');
+ b161 := true;
+ b162 := false;
+ if b161 or b162 then
+   result := true;
+ b161 := false;
+ b162 := false;
+ if b161 or b162 then
+   result := false;
+
+ b161 := b161 or b162;
+ if b161 then
+   result := false;
+ if b161 or FALSE then
+   result := false;
+
+
+ b161 := true;
+ b162 := true;
+ if b161 or b162 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+
+ { BOOLEAN32 OR BOOLEAN32 }
+ JLSystem.fout.print('boolean32 OR boolean32 test...');
+ b321 := true;
+ b322 := false;
+ if b321 or b322 then
+   result := true;
+ b321 := false;
+ b322 := false;
+ if b321 or b322 then
+   result := false;
+
+ b321 := b321 or b322;
+ if b321 then
+   result := false;
+ if b321 or FALSE then
+   result := false;
+
+
+ b321 := true;
+ b322 := true;
+ if b321 or b322 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+
+ { BOOLEAN64 OR BOOLEAN64 }
+ JLSystem.fout.print('boolean64 OR boolean64 test...');
+ b641 := true;
+ b642 := false;
+ if b641 or b642 then
+   result := true;
+ b641 := false;
+ b642 := false;
+ if b641 or b642 then
+   result := false;
+
+ b641 := b641 or b642;
+ if b641 then
+   result := false;
+ if b641 or FALSE then
+   result := false;
+
+
+ b641 := true;
+ b642 := true;
+ if b641 or b642 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+
+ { BYTEBOOL OR BYTEBOOL }
+ JLSystem.fout.print('bytebool OR bytebool test...');
+ bb1 := true;
+ bb2 := false;
+ if bb1 or bb2 then
+   result := true;
+ bb1 := false;
+ bb2 := false;
+ if bb1 or bb2 then
+   result := false;
+
+ bb1 := bb1 or bb2;
+ if bb1 then
+   result := false;
+ if bb1 or FALSE then
+   result := false;
+
+
+ bb1 := true;
+ bb2 := true;
+ if bb1 or bb2 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+
+ { WORDBOOL OR WORDBOOL }
+ result := false;
+ JLSystem.fout.print('wordbool OR wordbool test...');
+ wb1 := true;
+ wb2 := false;
+ if wb1 or wb2 then
+   result := true;
+ wb1 := false;
+ wb2 := false;
+ if wb1 or wb2 then
+   result := false;
+
+ wb1 := wb1 or wb2;
+ if wb1 then
+   result := false;
+ if wb1 or FALSE then
+   result := false;
+
+ wb1 := true;
+ wb2 := true;
+ if wb1 or wb2 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+
+ { LONGBOOL OR LONGBOOL }
+ result := false;
+ JLSystem.fout.print('longbool OR longbool test...');
+ lb1 := true;
+ lb2 := false;
+ if lb1 or lb2 then
+   result := true;
+ if lb2 then
+   result := false;
+ lb1 := false;
+ lb2 := false;
+ if lb1 or lb2 then
+   result := false;
+
+ lb1 := lb1 or lb2;
+ if lb1 then
+   result := false;
+ if lb1 or FALSE then
+   result := false;
+
+ lb1 := true;
+ lb2 := true;
+ if lb1 or lb2 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+end;
+
+
+Procedure BoolTestXor;
+var
+ b1, b2: boolean;
+ b161, b162: boolean16;
+ b321, b322: boolean32;
+ b641, b642: boolean64;
+ bb1, bb2: bytebool;
+ wb1, wb2: wordbool;
+ lb1, lb2: longbool;
+ result : boolean;
+begin
+ result := false;
+ { BOOLEAN XOR BOOLEAN }
+ JLSystem.fout.print('boolean XOR boolean test...');
+ b1 := true;
+ b2 := false;
+ if b1 xor b2 then
+   result := true;
+ b1 := false;
+ b2 := false;
+ if b1 xor b2 then
+   result := false;
+
+ b1 := b1 xor b2;
+ if b1 then
+   result := false;
+ if b1 xor FALSE then
+   result := false;
+
+
+ b1 := true;
+ b2 := true;
+ if b1 xor b2 then
+  begin
+     Fail;
+  end
+ else
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end;
+
+  { BOOLEAN16 XOR BOOLEAN16 }
+  JLSystem.fout.print('boolean16 XOR boolean16 test...');
+  b161 := true;
+  b162 := false;
+  if b161 xor b162 then
+    result := true;
+  b161 := false;
+  b162 := false;
+  if b161 xor b162 then
+    result := false;
+
+  b161 := b161 xor b162;
+  if b161 then
+    result := false;
+  if b161 xor FALSE then
+    result := false;
+
+
+  b161 := true;
+  b162 := true;
+  if b161 xor b162 then
+   begin
+      Fail;
+   end
+  else
+   begin
+     if result then
+       JLSystem.fout.printLn('Success.')
+     else
+       Fail;
+   end;
+
+  { BOOLEAN32 XOR BOOLEAN32 }
+  JLSystem.fout.print('boolean32 XOR boolean32 test...');
+  b321 := true;
+  b322 := false;
+  if b321 xor b322 then
+    result := true;
+  b321 := false;
+  b322 := false;
+  if b321 xor b322 then
+    result := false;
+
+  b321 := b321 xor b322;
+  if b321 then
+    result := false;
+  if b321 xor FALSE then
+    result := false;
+
+
+  b321 := true;
+  b322 := true;
+  if b321 xor b322 then
+   begin
+      Fail;
+   end
+  else
+   begin
+     if result then
+       JLSystem.fout.printLn('Success.')
+     else
+       Fail;
+   end;
+
+  { BOOLEAN64 XOR BOOLEAN64 }
+  JLSystem.fout.print('boolean64 XOR boolean64 test...');
+  b641 := true;
+  b642 := false;
+  if b641 xor b642 then
+    result := true;
+  b641 := false;
+  b642 := false;
+  if b641 xor b642 then
+    result := false;
+
+  b641 := b641 xor b642;
+  if b641 then
+    result := false;
+  if b641 xor FALSE then
+    result := false;
+
+
+  b641 := true;
+  b642 := true;
+  if b641 xor b642 then
+   begin
+      Fail;
+   end
+  else
+   begin
+     if result then
+       JLSystem.fout.printLn('Success.')
+     else
+       Fail;
+   end;
+
+ { BYTEBOOL XOR BYTEBOOL }
+ JLSystem.fout.print('bytebool XOR bytebool test...');
+ bb1 := true;
+ bb2 := false;
+ if bb1 xor bb2 then
+   result := true;
+ bb1 := false;
+ bb2 := false;
+ if bb1 xor bb2 then
+   result := false;
+
+ bb1 := bb1 xor bb2;
+ if bb1 then
+   result := false;
+ if bb1 xor FALSE then
+   result := false;
+
+
+ bb1 := true;
+ bb2 := true;
+ if bb1 xor bb2 then
+  begin
+     Fail;
+  end
+ else
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end;
+
+ { WORDBOOL XOR WORDBOOL }
+ result := false;
+ JLSystem.fout.print('wordbool XOR wordbool test...');
+ wb1 := true;
+ wb2 := false;
+ if wb1 xor wb2 then
+   result := true;
+ wb1 := false;
+ wb2 := false;
+ if wb1 xor wb2 then
+   result := false;
+
+ wb1 := wb1 xor wb2;
+ if wb1 then
+   result := false;
+ if wb1 xor FALSE then
+   result := false;
+
+ wb1 := true;
+ wb2 := true;
+ if wb1 xor wb2 then
+  begin
+      Fail;
+  end
+ else
+   begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+   end;
+
+ { LONGBOOL XOR LONGBOOL }
+ result := false;
+ JLSystem.fout.print('longbool XOR longbool test...');
+ lb1 := true;
+ lb2 := false;
+ if lb1 xor lb2 then
+   result := true;
+ if lb2 then
+   result := false;
+ lb1 := false;
+ lb2 := false;
+ if lb1 xor lb2 then
+   result := false;
+
+ lb1 := lb1 xor lb2;
+ if lb1 then
+   result := false;
+ if lb1 xor FALSE then
+   result := false;
+
+ lb1 := true;
+ lb2 := true;
+ if lb1 xor lb2 then
+  begin
+      Fail;
+  end
+ else
+   begin
+     if result then
+       JLSystem.fout.printLn('Success.')
+     else
+       Fail;
+   end;
+end;
+
+Procedure BoolTestEqual;
+var
+ b1, b2, b3: boolean;
+ b161, b162, b163: boolean16;
+ b321, b322, b323: boolean32;
+ b641, b642, b643: boolean64;
+ bb1, bb2, bb3: bytebool;
+ wb1, wb2, wb3: wordbool;
+ lb1, lb2, lb3: longbool;
+ result : boolean;
+ values : longint;
+Begin
+ values := $02020202;
+
+ { BOOLEAN = BOOLEAN }
+ result := true;
+ JLSystem.fout.print('boolean = boolean test...');
+ b1 := true;
+ b2 := true;
+ b3 := false;
+ b1 := (b1 = b2) and (b2 and false);
+ if b1 then
+   result := false;
+ b1 := true;
+ b2 := true;
+ b3 := false;
+ b1 := (b1 = b2) and (b2 and true);
+ if not b1 then
+   result := false;
+ if b1 = b2 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+
+ { BOOLEAN16 = BOOLEAN16 }
+ result := true;
+ JLSystem.fout.print('boolean16 = boolean16 test...');
+ b161 := true;
+ b162 := true;
+ b163 := false;
+ b161 := (b161 = b162) and (b162 and false);
+ if b161 then
+   result := false;
+ b161 := true;
+ b162 := true;
+ b163 := false;
+ b161 := (b161 = b162) and (b162 and true);
+ if not b161 then
+   result := false;
+ if b161 = b162 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+
+ { BOOLEAN32 = BOOLEAN32 }
+ result := true;
+ JLSystem.fout.print('boolean32 = boolean32 test...');
+ b321 := true;
+ b322 := true;
+ b323 := false;
+ b321 := (b321 = b322) and (b322 and false);
+ if b321 then
+   result := false;
+ b321 := true;
+ b322 := true;
+ b323 := false;
+ b321 := (b321 = b322) and (b322 and true);
+ if not b321 then
+   result := false;
+ if b321 = b322 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+
+ { BOOLEAN64 = BOOLEAN64 }
+ result := true;
+ JLSystem.fout.print('boolean64 = boolean64 test...');
+ b641 := true;
+ b642 := true;
+ b643 := false;
+ b641 := (b641 = b642) and (b642 and false);
+ if b641 then
+   begin
+     JLSystem.fout.print(' -error 1- ');
+     result := false;
+   end;
+ b641 := true;
+ b642 := true;
+ b643 := false;
+ b641 := (b641 = b642) and (b642 and true);
+ if not b641 then
+   begin
+     JLSystem.fout.print(' -error 2- ');
+     result := false;
+   end;
+ if b641 = b642 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+
+ { BYTEBOOL = BYTEBOOL }
+ result := true;
+ JLSystem.fout.print('bytebool = bytebool test...');
+ bb1 := true;
+ bb2 := true;
+ bb3 := false;
+ bb1 := (bb1 = bb2) and (bb2 and false);
+ if bb1 then
+   result := false;
+ bb1 := true;
+ bb2 := true;
+ bb3 := false;
+ bb1 := (bb1 = bb2) and (bb2 and true);
+ if not bb1 then
+   result := false;
+ if bb1 = bb2 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+
+ { WORDBOOL = WORDBOOL }
+ result := true;
+ JLSystem.fout.print('wordbool = wordbool test...');
+ wb1 := true;
+ wb2 := true;
+ wb3 := false;
+ wb1 := (wb1 = wb2) and (wb2 and false);
+ if wb1 then
+   result := false;
+ wb1 := true;
+ wb2 := true;
+ wb3 := false;
+ wb1 := (wb1 = wb2) and (wb2 and true);
+ if not wb1 then
+   result := false;
+ if wb1 = wb2 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+ JLSystem.fout.print('wordbool conversion to boolean...');
+ result := TRUE;
+ lb1:=longbool(values);
+ if lb1 <> TRUE then
+    result := false;
+ if result then
+    JLSystem.fout.printLn('Success.')
+ else
+    Fail;
+
+ { LONGBOOL = LONGBOOL }
+ result := true;
+ JLSystem.fout.print('longbool = longbool test...');
+ lb1 := true;
+ lb2 := true;
+ lb3 := false;
+ lb1 := (lb1 = lb2) and (lb2 and false);
+ if lb1 then
+   result := false;
+ lb1 := true;
+ lb2 := true;
+ lb3 := false;
+ lb1 := (lb1 = lb2) and (lb2 and true);
+ if not lb1 then
+   result := false;
+ if lb1 = lb2 then
+  begin
+    if result then
+      JLSystem.fout.printLn('Success.')
+    else
+      Fail;
+  end
+ else
+   Fail;
+ JLSystem.fout.print('longbool conversion to boolean...');
+ result := TRUE;
+ lb1:=longbool(values);
+ if lb1 <> TRUE then
+    result := false;
+ if result then
+    JLSystem.fout.printLn('Success.')
+ else
+    Fail;
+end;
+
+
+Procedure BoolTestNotEqual;
+var
+ b1, b2, b3: boolean;
+ b161, b162, b163: boolean16;
+ b321, b322, b323: boolean32;
+ b641, b642, b643: boolean64;
+ bb1, bb2, bb3: bytebool;
+ wb1, wb2, wb3: wordbool;
+ lb1, lb2, lb3: longbool;
+ result : boolean;
+Begin
+ { BOOLEAN <> BOOLEAN }
+ result := true;
+ JLSystem.fout.print('boolean <> boolean test...');
+ b1 := true;
+ b2 := true;
+ b3 := false;
+ b1 := (b1 <> b2) and (b2 <> false);
+ if b1 then
+   result := false;
+ b1 := true;
+ b2 := true;
+ b3 := false;
+ b1 := (b1 <> b2) and (b2 <> true);
+ if b1 then
+   result := false;
+ b1 := false;
+ b2 := false;
+ if b1 <> b2 then
+  begin
+      Fail;
+  end
+ else
+  begin
+   if result then
+     JLSystem.fout.printLn('Success.')
+   else
+     Fail;
+  end;
+
+ { BOOLEAN16 <> BOOLEAN16 }
+ result := true;
+ JLSystem.fout.print('boolean16 <> boolean16 test...');
+ b161 := true;
+ b162 := true;
+ b163 := false;
+ b161 := (b161 <> b162) and (b162 <> false);
+ if b161 then
+   result := false;
+ b161 := true;
+ b162 := true;
+ b163 := false;
+ b161 := (b161 <> b162) and (b162 <> true);
+ if b161 then
+   result := false;
+ b161 := false;
+ b162 := false;
+ if b161 <> b162 then
+  begin
+      Fail;
+  end
+ else
+  begin
+   if result then
+     JLSystem.fout.printLn('Success.')
+   else
+     Fail;
+  end;
+
+ { BOOLEAN32 <> BOOLEAN32 }
+ result := true;
+ JLSystem.fout.print('boolean32 <> boolean32 test...');
+ b321 := true;
+ b322 := true;
+ b323 := false;
+ b321 := (b321 <> b322) and (b322 <> false);
+ if b321 then
+   result := false;
+ b321 := true;
+ b322 := true;
+ b323 := false;
+ b321 := (b321 <> b322) and (b322 <> true);
+ if b321 then
+   result := false;
+ b321 := false;
+ b322 := false;
+ if b321 <> b322 then
+  begin
+      Fail;
+  end
+ else
+  begin
+   if result then
+     JLSystem.fout.printLn('Success.')
+   else
+     Fail;
+  end;
+
+ { BOOLEAN64 <> BOOLEAN64 }
+ result := true;
+ JLSystem.fout.print('boolean64 <> boolean64 test...');
+ b641 := true;
+ b642 := true;
+ b643 := false;
+ b641 := (b641 <> b642) and (b642 <> false);
+ if b641 then
+   result := false;
+ b641 := true;
+ b642 := true;
+ b643 := false;
+ b641 := (b641 <> b642) and (b642 <> true);
+ if b641 then
+   result := false;
+ b641 := false;
+ b642 := false;
+ if b641 <> b642 then
+  begin
+      Fail;
+  end
+ else
+  begin
+   if result then
+     JLSystem.fout.printLn('Success.')
+   else
+     Fail;
+  end;
+
+ { BYTEBOOL <> BYTEBOOL }
+ result := true;
+ JLSystem.fout.print('bytebool <> bytebool test...');
+ bb1 := true;
+ bb2 := true;
+ bb3 := false;
+ bb1 := (bb1 <> bb2) and (bb2 <> false);
+ if bb1 then
+   result := false;
+ bb1 := true;
+ bb2 := true;
+ bb3 := false;
+ bb1 := (bb1 <> bb2) and (bb2 <> true);
+ if bb1 then
+   result := false;
+ bb1 := false;
+ bb2 := false;
+ if bb1 <> bb2 then
+  begin
+      Fail;
+  end
+ else
+  begin
+   if result then
+     JLSystem.fout.printLn('Success.')
+   else
+     Fail;
+  end;
+
+ { WORDBOOL <> WORDBOOL }
+ result := true;
+ JLSystem.fout.print('wordbool <> wordbool test...');
+ wb1 := true;
+ wb2 := true;
+ wb3 := false;
+ wb1 := (wb1 <> wb2) and (wb2 <> false);
+ if wb1 then
+   result := false;
+ wb1 := true;
+ wb2 := true;
+ wb3 := false;
+ wb1 := (wb1 <> wb2) and (wb2 <> true);
+ if wb1 then
+   result := false;
+ wb1 := false;
+ wb2 := false;
+ if wb1 <> wb2 then
+  begin
+      Fail;
+  end
+ else
+  begin
+   if result then
+     JLSystem.fout.printLn('Success.')
+   else
+     Fail;
+  end;
+
+ { LONGBOOL <> LONGBOOL }
+ result := true;
+ JLSystem.fout.print('longbool <> longbool test...');
+ lb1 := true;
+ lb2 := true;
+ lb3 := false;
+ lb1 := (lb1 <> lb2) and (lb2 <> false);
+ if lb1 then
+   result := false;
+ lb1 := true;
+ lb2 := true;
+ lb3 := false;
+ lb1 := (lb1 <> lb2) and (lb2 <> true);
+ if lb1 then
+   result := false;
+ lb1 := false;
+ lb2 := false;
+ if lb1 <> lb2 then
+  begin
+      Fail;
+  end
+ else
+  begin
+   if result then
+     JLSystem.fout.printLn('Success.')
+   else
+     Fail;
+  end;
+
+end;
+
+Procedure BoolLessThen;
+var
+ bb1, bb2: boolean;
+ wb1, wb2: wordbool;
+ lb1, lb2: longbool;
+Begin
+ {!!!!!!!!!!!}
+end;
+
+
+Procedure BoolGreaterThen;
+var
+ bb1, bb2: boolean;
+ wb1, wb2: wordbool;
+ lb1, lb2: longbool;
+Begin
+ {!!!!!!!!!!!!}
+End;
+
+
+
+
+
+
+
+Begin
+  BoolTestAnd;
+  BoolTestOr;
+  BoolTestXor;
+  BoolTestEqual;
+  BoolTestNotEqual;
+end.

+ 4 - 0
tests/test/jvm/testall.bat

@@ -232,4 +232,8 @@ ppcjvm -O2 -g -B tassert
 if %errorlevel% neq 0 exit /b %errorlevel%
 if %errorlevel% neq 0 exit /b %errorlevel%
 java -Dfile.encoding=UTF-8 -cp ..\..\..\rtl\units\jvm-java;. -Sa tassert
 java -Dfile.encoding=UTF-8 -cp ..\..\..\rtl\units\jvm-java;. -Sa tassert
 if %errorlevel% neq 0 exit /b %errorlevel%
 if %errorlevel% neq 0 exit /b %errorlevel%
+ppcjvm -O2 -g -B taddbool
+if %errorlevel% neq 0 exit /b %errorlevel%
+java -Dfile.encoding=UTF-8 -cp ..\..\..\rtl\units\jvm-java;. -Sa TAddBool
+if %errorlevel% neq 0 exit /b %errorlevel%
 
 

+ 2 - 0
tests/test/jvm/testall.sh

@@ -131,3 +131,5 @@ $PPC -O2 -g -B topovl
 java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/$RTLDIR:. topovl
 java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/$RTLDIR:. topovl
 $PPC -O2 -g -B -Sa tassert
 $PPC -O2 -g -B -Sa tassert
 java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/$RTLDIR:. tassert
 java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/$RTLDIR:. tassert
+$PPC -O2 -g -B -Sa taddbool
+java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/$RTLDIR:. TAddBool