Changeset 247551 in webkit


Ignore:
Timestamp:
Jul 17, 2019 6:18:55 PM (5 years ago)
Author:
rmorisset@apple.com
Message:

[WHLSL] Remove traps from the compiler
https://bugs.webkit.org/show_bug.cgi?id=195811
<rdar://problem/50746299>

Reviewed by Myles Maxfield.

Remove the Trap statement from the language, see https://github.com/gpuweb/WHLSL/issues/301.

No new tests, as this part of the language was already untested, and we are removing it, not adding anything.

  • Modules/webgpu/WHLSL/AST/WHLSLAST.h:
  • Modules/webgpu/WHLSL/AST/WHLSLStatement.h:

(WebCore::WHLSL::AST::Statement::isSwitchStatement const):

  • Modules/webgpu/WHLSL/AST/WHLSLTrap.h: Removed.
  • Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
  • Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
  • Modules/webgpu/WHLSL/WHLSLASTDumper.h:
  • Modules/webgpu/WHLSL/WHLSLLexer.cpp:

(WebCore::WHLSL::Token::typeName):
(WebCore::WHLSL::Lexer::recognizeKeyword):

  • Modules/webgpu/WHLSL/WHLSLLexer.h:
  • Modules/webgpu/WHLSL/WHLSLParser.cpp:

(WebCore::WHLSL::Parser::parseStatement):

  • Modules/webgpu/WHLSL/WHLSLParser.h:
  • Modules/webgpu/WHLSL/WHLSLStatementBehaviorChecker.cpp:
  • Modules/webgpu/WHLSL/WHLSLVisitor.cpp:

(WebCore::WHLSL::Visitor::visit):

  • Modules/webgpu/WHLSL/WHLSLVisitor.h:
  • WebCore.xcodeproj/project.pbxproj:
Location:
trunk/Source/WebCore
Files:
1 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r247549 r247551  
     12019-07-17  Robin Morisset  <rmorisset@apple.com>
     2
     3        [WHLSL] Remove traps from the compiler
     4        https://bugs.webkit.org/show_bug.cgi?id=195811
     5        <rdar://problem/50746299>
     6
     7        Reviewed by Myles Maxfield.
     8
     9        Remove the Trap statement from the language, see https://github.com/gpuweb/WHLSL/issues/301.
     10
     11        No new tests, as this part of the language was already untested, and we are removing it, not adding anything.
     12
     13        * Modules/webgpu/WHLSL/AST/WHLSLAST.h:
     14        * Modules/webgpu/WHLSL/AST/WHLSLStatement.h:
     15        (WebCore::WHLSL::AST::Statement::isSwitchStatement const):
     16        * Modules/webgpu/WHLSL/AST/WHLSLTrap.h: Removed.
     17        * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
     18        * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
     19        * Modules/webgpu/WHLSL/WHLSLASTDumper.h:
     20        * Modules/webgpu/WHLSL/WHLSLLexer.cpp:
     21        (WebCore::WHLSL::Token::typeName):
     22        (WebCore::WHLSL::Lexer::recognizeKeyword):
     23        * Modules/webgpu/WHLSL/WHLSLLexer.h:
     24        * Modules/webgpu/WHLSL/WHLSLParser.cpp:
     25        (WebCore::WHLSL::Parser::parseStatement):
     26        * Modules/webgpu/WHLSL/WHLSLParser.h:
     27        * Modules/webgpu/WHLSL/WHLSLStatementBehaviorChecker.cpp:
     28        * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
     29        (WebCore::WHLSL::Visitor::visit):
     30        * Modules/webgpu/WHLSL/WHLSLVisitor.h:
     31        * WebCore.xcodeproj/project.pbxproj:
     32
    1332019-07-17  Robin Morisset  <rmorisset@apple.com>
    234
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLAST.h

    r247499 r247551  
    9191#include "WHLSLSwitchStatement.h"
    9292#include "WHLSLTernaryExpression.h"
    93 #include "WHLSLTrap.h"
    9493#include "WHLSLType.h"
    9594#include "WHLSLTypeArgument.h"
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStatement.h

    r247499 r247551  
    6161    virtual bool isSwitchCase() const { return false; }
    6262    virtual bool isSwitchStatement() const { return false; }
    63     virtual bool isTrap() const { return false; }
    6463    virtual bool isVariableDeclarationsStatement() const { return false; }
    6564    virtual bool isWhileLoop() const { return false; }
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp

    r247499 r247551  
    127127    void visit(AST::SwitchStatement&) override;
    128128    void visit(AST::SwitchCase&) override;
    129     void visit(AST::Trap&) override;
    130129    void visit(AST::VariableDeclarationsStatement&) override;
    131130    void visit(AST::WhileLoop&) override;
     
    418417}
    419418
    420 void FunctionDefinitionWriter::visit(AST::Trap&)
    421 {
    422     // FIXME: https://bugs.webkit.org/show_bug.cgi?id=195811 Implement this
    423     notImplemented();
    424 }
    425 
    426419void FunctionDefinitionWriter::visit(AST::VariableDeclarationsStatement& variableDeclarationsStatement)
    427420{
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLASTDumper.cpp

    r247499 r247551  
    503503}
    504504
    505 void ASTDumper::visit(AST::Trap&)
    506 {
    507     m_out.print("trap");
    508 }
    509 
    510505void ASTDumper::visit(AST::SwitchStatement& switchStatement)
    511506{
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLASTDumper.h

    r247499 r247551  
    9999    void visit(AST::SwitchCase&) override;
    100100    void visit(AST::SwitchStatement&) override;
    101     void visit(AST::Trap&) override;
    102101    void visit(AST::VariableDeclarationsStatement&) override;
    103102    void visit(AST::WhileLoop&) override;
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLLexer.cpp

    r247329 r247551  
    7474    case Type::Return:
    7575        return "return";
    76     case Type::Trap:
    77         return "trap";
    7876    case Type::Null:
    7977        return "null";
     
    290288    if (substring == "return")
    291289        return Token::Type::Return;
    292     if (substring == "trap")
    293         return Token::Type::Trap;
    294290    if (substring == "null")
    295291        return Token::Type::Null;
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLLexer.h

    r247329 r247551  
    9090        Do,
    9191        Return,
    92         Trap,
    9392        Null,
    9493        True,
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp

    r247499 r247551  
    13001300        auto fallthroughObject = AST::Fallthrough(WTFMove(fallthroughToken));
    13011301        return { makeUniqueRef<AST::Fallthrough>(WTFMove(fallthroughObject)) };
    1302     }
    1303     case Token::Type::Trap: {
    1304         auto trapToken = m_lexer.consumeToken();
    1305         CONSUME_TYPE(semicolon, Semicolon);
    1306         auto trapObject = AST::Trap(WTFMove(trapToken));
    1307         return { makeUniqueRef<AST::Trap>(WTFMove(trapObject)) };
    13081302    }
    13091303    case Token::Type::Return: {
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.h

    r247499 r247551  
    8383#include "WHLSLSwitchStatement.h"
    8484#include "WHLSLTernaryExpression.h"
    85 #include "WHLSLTrap.h"
    8685#include "WHLSLType.h"
    8786#include "WHLSLTypeArgument.h"
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLStatementBehaviorChecker.cpp

    r247499 r247551  
    4242#include "WHLSLSwitchCase.h"
    4343#include "WHLSLSwitchStatement.h"
    44 #include "WHLSLTrap.h"
    4544#include "WHLSLVariableDeclarationsStatement.h"
    4645#include "WHLSLVisitor.h"
     
    8786
    8887    void visit(AST::Return&) override
    89     {
    90         m_stack.append({ Behavior::Return });
    91     }
    92 
    93     void visit(AST::Trap&) override
    9488    {
    9589        m_stack.append({ Behavior::Return });
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLVisitor.cpp

    r247499 r247551  
    330330    else if (is<AST::SwitchStatement>(statement))
    331331        checkErrorAndVisit(downcast<AST::SwitchStatement>(statement));
    332     else if (is<AST::Trap>(statement))
    333         checkErrorAndVisit(downcast<AST::Trap>(statement));
    334332    else if (is<AST::VariableDeclarationsStatement>(statement))
    335333        checkErrorAndVisit(downcast<AST::VariableDeclarationsStatement>(statement));
     
    468466}
    469467
    470 void Visitor::visit(AST::Trap&)
    471 {
    472 }
    473 
    474468void Visitor::visit(AST::VariableDeclarationsStatement& variableDeclarationsStatement)
    475469{
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLVisitor.h

    r247499 r247551  
    8484class SwitchCase;
    8585class SwitchStatement;
    86 class Trap;
    8786class VariableDeclarationsStatement;
    8887class WhileLoop;
     
    165164    virtual void visit(AST::SwitchCase&);
    166165    virtual void visit(AST::SwitchStatement&);
    167     virtual void visit(AST::Trap&);
    168166    virtual void visit(AST::VariableDeclarationsStatement&);
    169167    virtual void visit(AST::WhileLoop&);
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r247530 r247551  
    1324513245                C2138A1621DDECFB00F516BA /* WHLSLSpecializationConstantSemantic.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLSpecializationConstantSemantic.cpp; sourceTree = "<group>"; };
    1324613246                C2138A1721DDED0D00F516BA /* WHLSLStageInOutSemantic.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLStageInOutSemantic.cpp; sourceTree = "<group>"; };
    13247                 C21BF6F321CD89AD00227979 /* WHLSLTrap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLTrap.h; sourceTree = "<group>"; };
    1324813247                C21BF6F421CD89B300227979 /* WHLSLFunctionDefinition.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLFunctionDefinition.h; sourceTree = "<group>"; };
    1324913248                C21BF6F521CD89B500227979 /* WHLSLContinue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLContinue.h; sourceTree = "<group>"; };
     
    1714217141                                C21BF73121CD89EE00227979 /* WHLSLSwitchStatement.h */,
    1714317142                                C21BF71C21CD89DA00227979 /* WHLSLTernaryExpression.h */,
    17144                                 C21BF6F321CD89AD00227979 /* WHLSLTrap.h */,
    1714517143                                C21BF71D21CD89DB00227979 /* WHLSLType.h */,
    1714617144                                C288C72D21C991DA002DF5CA /* WHLSLTypeArgument.cpp */,
Note: See TracChangeset for help on using the changeset viewer.